Documentation

messageservice.sender.add

Scope: catalog Permissions to execute: for all

messageservice.sender.add - registers new SMS-provider. Method can be executed successfully only within context of a created application.

Parameters

Parameter Description
CODE Internal provider ID.
Accesible symbols are a-z, A-Z, 0-9, period, hyphen and underscore.
TYPE Provider type.
HANDLER Application URL to which the data will be sent.
NAME Provider name. Can be a string or an associative array of localized strings.
DESCRIPTION Provider description. Can be a string or an associative array of localized strings.

The following data is passed to HANDLER:

  • module_id - module-initiator. crm - means that the message was sent from the CRM details (other variants may be available in the future), bizproc - sent from Workflows or an Automation Rule.
  • bindings - parameter, current only for module_id = crm. It contains an array of associations to CRM entities (to which a deal will attach).
  • workflow_id, document_id, document_type - parameters, current only for module_id = bizproc. Parameters are not always passed: if we send them from CRM details, then they will not be available)
  • message_id - unique message ID. It may be used to request messageservice.message.status.update.
  • message_to - message recipient ID
  • message_body - message text

Example

		var params = {
			CODE: 'provider1',
			TYPE: 'SMS',
			HANDLER: 'http:///',
			NAME: 'Provider SMS.com',
			DESCRIPTION: 'Provider SMS.com'
		};

		BX24.callMethod(
			'messageservice.sender.add',
			params,
			function(result)
			{
				if(result.error())
					alert("Error: " + result.error());
				else
					alert("Success: " + result.data());
			}
		);

Sent from the CRM details

Array
(
    [module_id] => crm
    [bindings] => Array
        (
            [0] => Array
                (
                    [OWNER_TYPE_ID] => 1
                    [OWNER_ID] => 98
                )

        )

    [properties] => Array
        (
            [phone_number] => +79097932304
            [message_text] => test message
        )

    [type] => SMS
    [code] => example
    [message_id] => 72dd742c8270db0ddbbab92f98877537
    [message_to] => +79097932304
    [message_body] => test message
    [ts] => 1506687055
    [auth] => /*auth*/

)

Sent from a Workflow or an Automation Rule.

Array
(
    [module_id] => bizproc
    [workflow_id] => 59ce38567ff2a5.26351167
    [document_id] => Array
        (
            [0] => crm
            [1] => CCrmDocumentLead
            [2] => LEAD_98
        )

    [document_type] => Array
        (
            [0] => crm
            [1] => CCrmDocumentLead
            [2] => LEAD
        )

    [properties] => Array
        (
            [phone_number] => +79097932304
            [message_text] => test message
        )

    [type] => SMS
    [code] => example
    [message_id] => 8b3fc6cd0cb4a7b91f6632889cdf46e0
    [message_to] => +79097932304
    [message_body] => test message
    [ts] => 1506687103
    [auth] => /*auth*/

)

© «Bitrix24», 2001-2024