Send a message to the CRM Feed crm.livefeedmessage.add

Scope: crm

Who can execute the method: any user

This method adds a message to the CRM feed.

Method Parameters

Required parameters are marked with *

Name
type

Description

POST_TITLE
string

Message title

MESSAGE
text

Message text.

SPERM

Permissions to view the message, example:

"SPERM": {
            "CRMCONTACT": ["CRMCONTACT3", "CRMCONTACT7"], // CRM contacts
            "CRMCOMPANY": ["CRMCOMPANY1", "CRMCOMPANY3"], // CRM companies
            "CRMDEAL": ["CRMDEAL3", "CRMDEAL5"], // CRM deals
            "CRMLEAD": ["CRMLEAD9", "CRMLEAD11"], // CRM leads
            "SG": ["SG5", "SG9"], // social network workgroups
            "U": ["U1", "U3"], // users
            "DR": ["DR1", "DR7"], // departments with subdivisions
        }
        

ENTITYTYPEID
integer

Type of the entity where the message is published:

  • 1 - lead;
  • 2 - deal;
  • 3 - contact;
  • 4 - company

ENTITYID
integer

ID of the specific lead/deal/contact/company where the message is published.

FILES
file

Message files

Code Examples

How to Use Examples in Documentation

Example 1

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 -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