Answer the question
In order to leave comments, you need to log in
How to send notifications in the cloud version of bitrix24?
Good afternoon, I ran into a rather strange situation, notifications do not want to work for me at close range, although other parts of the API work quite well, as an example, tasks are successfully created for me, requests to the client card work, etc.
Given:
1. Cloud bitrix24.
2. bitrix24 -
rest 1.1.1
_ _
from bitrix24 import *
import datetime
sendString = ['Attention! Bla-bla-bla']
bx24 = Bitrix24('https://bla.bitrix24.com/rest/4/bla/profile/')
bx24.callMethod('tasks.task.add', fields={'TITLE': 'Test',
'DESCRIPTION' : sendString[0],
'DEADLINE' : datetime.datetime.now() + datetime.timedelta(days=7),
'AUDITORS': {'1':'10'},
'RESPONSIBLE_ID' : '4',
'CREATED_BY': '1',
'DESCRIPTION_IN_BBCODE' : 'Yes'
})
bx24.callMethod('crm.contact.list',
filter={'UF_CRM_1571409252888': date},
select=['ID', 'NAME', 'LAST_NAME', 'EMAIL', 'PHONE']
)
BX24.callMethod('im.notify', {to: user.id, message: 'Привет, '+user.name+'!'});
bx24.callMethod('im.notify', fields={'TO': '4', 'MESSAGE': 'Bla-bla-bla'})
in callMethod
raise BitrixError(r)
bitrix24.exceptions.BitrixError: User ID can't be empty
bx24.callMethod('im.message.add', fields={'DIALOG_ID': '4', 'MESSAGE': 'Bla-bla-bla'})
bitrix24.exceptions.BitrixError: Message can't be empty
Answer the question
In order to leave comments, you need to log in
im.notify parameters are written in lowercase
bx24.callMethod('im.notify', fields={'to': '4', 'message': 'Bla-bla-bla'})
Literally ran into the exact same situation today. CRM api works, but when notifying and working with chat, the error "ID cannot be empty" is returned. Tried it this way and that, it didn't work.
Faced exactly the same problem.
As a result, in my case, the error was due to inattention:
In the API rights setting, there were "CRM" and "Chat and notifications".
But for this functionality, "Messaging Service" is required. . After adding it everything works.
Check... maybe you have the same problem.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question