Send a message to the CRM Feed crm.livefeedmessage.add
Scope:
crmWho can execute the method: any user
This method adds a message to the CRM feed.
Method Parameters
Required parameters are marked with *
|
Name |
Description |
|
POST_TITLE |
Message title |
|
MESSAGE |
Message text. |
|
SPERM |
Permissions to view the message, example:
|
|
ENTITYTYPEID |
Type of the entity where the message is published:
|
|
ENTITYID |
ID of the specific lead/deal/contact/company where the message is published. |
|
FILES |
Message files |
Code Examples
How to Use Examples in Documentation
Example 1
cURL (Webhook)
cURL (OAuth)
JS
PHP
BX24.js
PHP CRest
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"POST_TITLE":"A bit about the service","MESSAGE":"Bitrix24 is built on the Bitrix Framework platform.","SPERM":{"CRMCONTACT":["CRMCONTACT3","CRMCONTACT7"],"CRMCOMPANY":["CRMCOMPANY1","CRMCOMPANY3"],"CRMDEAL":["CRMDEAL3","CRMDEAL5"],"CRMLEAD":["CRMLEAD9","CRMLEAD11"],"SG":["SG5","SG9"],"U":["U1","U3"],"DR":["DR1","DR7"]},"ENTITYTYPEID":3,"ENTITYID":3}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.livefeedmessage.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"POST_TITLE":"A bit about the service","MESSAGE":"Bitrix24 is built on the Bitrix Framework platform.","SPERM":{"CRMCONTACT":["CRMCONTACT3","CRMCONTACT7"],"CRMCOMPANY":["CRMCOMPANY1","CRMCOMPANY3"],"CRMDEAL":["CRMDEAL3","CRMDEAL5"],"CRMLEAD":["CRMLEAD9","CRMLEAD11"],"SG":["SG5","SG9"],"U":["U1","U3"],"DR":["DR1","DR7"]},"ENTITYTYPEID":3,"ENTITYID":3},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.livefeedmessage.add
try
{
const response = await $b24.callMethod(
"crm.livefeedmessage.add",
{
fields:
{
"POST_TITLE": "A bit about the service",
"MESSAGE": "Bitrix24 is built on the Bitrix Framework platform.",
"SPERM": {
"CRMCONTACT": ["CRMCONTACT3", "CRMCONTACT7"],
"CRMCOMPANY": ["CRMCOMPANY1", "CRMCOMPANY3"],
"CRMDEAL": ["CRMDEAL3", "CRMDEAL5"],
"CRMLEAD": ["CRMLEAD9", "CRMLEAD11"],
"SG": ["SG5", "SG9"],
"U": ["U1", "U3"],
"DR": ["DR1", "DR7"],
},
"ENTITYTYPEID": 3,
"ENTITYID": 3,
}
}
);
const result = response.getData().result;
console.info("Message created with ID " + result);
}
catch(error)
{
console.error(error);
}
try {
$response = $b24Service
->core
->call(
'crm.livefeedmessage.add',
[
'fields' => [
'POST_TITLE' => 'A bit about the service',
'MESSAGE' => 'Bitrix24 is built on the Bitrix Framework platform.',
'SPERM' => [
'CRMCONTACT' => ['CRMCONTACT3', 'CRMCONTACT7'],
'CRMCOMPANY' => ['CRMCOMPANY1', 'CRMCOMPANY3'],
'CRMDEAL' => ['CRMDEAL3', 'CRMDEAL5'],
'CRMLEAD' => ['CRMLEAD9', 'CRMLEAD11'],
'SG' => ['SG5', 'SG9'],
'U' => ['U1', 'U3'],
'DR' => ['DR1', 'DR7'],
],
'ENTITYTYPEID' => 3,
'ENTITYID' => 3,
],
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Message created with ID ' . $result;
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error creating live feed message: ' . $e->getMessage();
}
BX24.callMethod(
"crm.livefeedmessage.add",
{
fields:
{
"POST_TITLE": "A bit about the service",
"MESSAGE": "Bitrix24 is built on the Bitrix Framework platform.",
"SPERM": {
"CRMCONTACT": ["CRMCONTACT3", "CRMCONTACT7"],
"CRMCOMPANY": ["CRMCOMPANY1", "CRMCOMPANY3"],
"CRMDEAL": ["CRMDEAL3", "CRMDEAL5"],
"CRMLEAD": ["CRMLEAD9", "CRMLEAD11"],
"SG": ["SG5", "SG9"],
"U": ["U1", "U3"],
"DR": ["DR1", "DR7"],
},
"ENTITYTYPEID": 3,
"ENTITYID": 3,
}
},
function(result)
{
if(result.error())
console.error(result.error());
else
console.info("Message created with ID " + result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'crm.livefeedmessage.add',
[
'fields' => [
'POST_TITLE' => 'A bit about the service',
'MESSAGE' => 'Bitrix24 is built on the Bitrix Framework platform.',
'SPERM' => [
'CRMCONTACT' => ['CRMCONTACT3', 'CRMCONTACT7'],
'CRMCOMPANY' => ['CRMCOMPANY1', 'CRMCOMPANY3'],
'CRMDEAL' => ['CRMDEAL3', 'CRMDEAL5'],
'CRMLEAD' => ['CRMLEAD9', 'CRMLEAD11'],
'SG' => ['SG5', 'SG9'],
'U' => ['U1', 'U3'],
'DR' => ['DR1', 'DR7'],
],
'ENTITYTYPEID' => 3,
'ENTITYID' => 3,
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Example 2
cURL (Webhook)
cURL (OAuth)
JS
PHP
BX24.js
PHP CRest
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"POST_TITLE":"POST_TITLE","MESSAGE":"MESSAGE","SPERM":{"CRMLEAD":["CRMLEAD9","CRMLEAD11"],"U":["U1"]},"ENTITYTYPEID":1,"ENTITYID":56374,"FILES":[["1.gif","R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="],["2.gif","..."]]}}' \
https://**put_your_bitrix24_address**/rest/**put_your_user_id_here**/**put_your_webhook_here**/crm.livefeedmessage.add
curl -X POST \
-H "Content-Type: application/json" \
-H "Accept: application/json" \
-d '{"fields":{"POST_TITLE":"POST_TITLE","MESSAGE":"MESSAGE","SPERM":{"CRMLEAD":["CRMLEAD9","CRMLEAD11"],"U":["U1"]},"ENTITYTYPEID":1,"ENTITYID":56374,"FILES":[["1.gif","R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="],["2.gif","..."]]},"auth":"**put_access_token_here**"}' \
https://**put_your_bitrix24_address**/rest/crm.livefeedmessage.add
try
{
const response = await $b24.callMethod(
"crm.livefeedmessage.add",
{
fields:
{
"POST_TITLE": "POST_TITLE",
"MESSAGE": "MESSAGE",
"SPERM": {
"CRMLEAD": ["CRMLEAD9", "CRMLEAD11"],
"U": ["U1"],
},
"ENTITYTYPEID": 1,
"ENTITYID": 56374,
"FILES": [
["1.gif", "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="],
["2.gif", "..."]
],
}
}
);
const result = response.getData().result;
console.info("Message created with ID " + result);
}
catch(error)
{
console.error(error);
}
try {
$response = $b24Service
->core
->call(
'crm.livefeedmessage.add',
[
'fields' => [
'POST_TITLE' => 'POST_TITLE',
'MESSAGE' => 'MESSAGE',
'SPERM' => [
'CRMLEAD' => ['CRMLEAD9', 'CRMLEAD11'],
'U' => ['U1'],
],
'ENTITYTYPEID' => 1,
'ENTITYID' => 56374,
'FILES' => [
['1.gif', 'R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='],
['2.gif', '...'],
],
],
]
);
$result = $response
->getResponseData()
->getResult();
echo 'Message created with ID ' . $result;
} catch (Throwable $e) {
error_log($e->getMessage());
echo 'Error creating message: ' . $e->getMessage();
}
BX24.callMethod(
"crm.livefeedmessage.add",
{
fields:
{
"POST_TITLE": "POST_TITLE",
"MESSAGE": "MESSAGE",
"SPERM": {
"CRMLEAD": ["CRMLEAD9", "CRMLEAD11"],
"U": ["U1"],
},
"ENTITYTYPEID": 1,
"ENTITYID": 56374,
"FILES": [
["1.gif", "R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=="],
["2.gif", "..."]
],
}
},
function(result)
{
if(result.error())
console.error(result.error());
else
console.info("Message created with ID " + result.data());
}
);
require_once('crest.php');
$result = CRest::call(
'crm.livefeedmessage.add',
[
'fields' => [
'POST_TITLE' => 'POST_TITLE',
'MESSAGE' => 'MESSAGE',
'SPERM' => [
'CRMLEAD' => ['CRMLEAD9', 'CRMLEAD11'],
'U' => ['U1'],
],
'ENTITYTYPEID' => 1,
'ENTITYID' => 56374,
'FILES' => [
['1.gif', 'R0lGODlhAQABAIAAAP///wAAACH5BAEAAAAALAAAAAABAAEAAAICRAEAOw=='],
['2.gif', '...']
],
]
]
);
echo '<PRE>';
print_r($result);
echo '</PRE>';
Additional
Copied
Previous