SendMessageToRecipient
Sends an over-the-top (OTT) message to a specific recipient in Salesforce Marketing Cloud. Supported OTT networks include Facebook Messenger and LINE. This procedure facilitates cross-platform communication with customers through integrated messaging channels.
MessageContents
You cannot send an OTT message to the recipient without specifying the content of the message. To create message contents, you must insert data in a temporary table called 'MessageContents#TEMP'. The columns available for this temporary table are the following:
| Column | Description |
| Type | Indicates the message content type of the send request with values: text, image, audio, video, native. |
| Text | Message text to be sent out to the recipient. Required for 'text' type message content. |
| Url | URL of the multimedia attachment to be sent out to the recipient. Required for 'image, audio, video' type message content. |
| AltUrl | Alternate URL of the multimedia attachment to be sent out to the recipient. Required for LINE for 'image, video' type message content. |
| Duration | Length of the audio multimedia attachment to be sent out to the recipient. Required for LINE for 'audio' type message content. |
| NativePayload | Ott-network-specific blob of JSON payload passed in message request. |
| IsReusable | Indicates if a multimedia attachment can be reused for future messages. Only supported for Messenger. |
| AttachmentId | Attachment Id of a reusable multimedia asset. Only supported for Messenger. |
MessageCustomKeys
You can also specify message custom keys to pass-through in the message payload by inserting data in a temporary table called 'MessageCustomKeys#TEMP'. The columns available for this temporary table are the following:
| Column | Description |
| messagingType | Indicates the messaging_type of a messenger send request with values: RESPONSE, UPDATE, MESSAGE_TAG. Required for Messenger send requests. |
| tag | Message Tag of a messenger send request. Required for Messenger send request if messagingType = Message_TAG. |
| notificationType | Indicates the push notification type for message send request with values: REGULAR, SILENT_PUSH, NO_PUSH. Required for Messenger. Optional for Messenger send requests. |
Execute
Messenger message send:
INSERT INTO MessageContents#TEMP (type, text) VALUES ('text', 'thanks for purchase')
INSERT INTO MessageCustomKeys#TEMP (messagingType) VALUES ('RESPONSE')
EXECUTE SendMessageToRecipient MessageKey = 'e1c35141-6e5c-4bc2-813b-60f969e52b0d', MessageGroupKey = 'CanBeAGUIDorAny100UnicodeCharString', SenderType = 'messenger', SenderId = '503868699681937', OttId = 'FBfacdb735074f7c492c0bf190fa99020', UserReference = '1938cd4d34cc4db0b109756b8a9b14ff', Subject = 'Message Name', ValidityPeriod = 30"
Different Messenger Content Types:
INSERT INTO MessageContents#TEMP (type, url, AltUrl, IsReusable, AttachmentId) VALUES ('image', 'https://example.com/original.jpg', 'https://example.com/preview.jpg', true, 12345)
INSERT INTO MessageCustomKeys#TEMP (messagingType) VALUES ('RESPONSE')
EXECUTE SendMessageToRecipient MessageKey = 'e1c35141-6e5c-4bc2-813b-60f969e52b0d', MessageGroupKey = 'CanBeAGUIDorAny100UnicodeCharString', SenderType = 'messenger', SenderId = '503868699681937', OttId = 'FBfacdb735074f7c492c0bf190fa99020', UserReference = '1938cd4d34cc4db0b109756b8a9b14ff', Subject = 'Message Name', ValidityPeriod = 30"
LINE message send:
INSERT INTO MessageContents#TEMP (type, text) VALUES ('text', 'thanks for purchase')
INSERT INTO MessageCustomKeys#TEMP (messagingType) VALUES ('RESPONSE')
EXECUTE SendMessageToRecipient MessageKey = 'CanBeAGUIDorAny100UnicodeCharString', MessageGroupKey = 'CanBeAGUIDorAny100UnicodeCharString', SenderType = 'line', SenderId = '2145435435632435', OttId = 'U42348yafsd8y3248yfsq8cy9088934d', UserReference = '1938cd4d34cc4db0b109756b8a9b14ff', Subject = 'Message Name', ValidityPeriod = 30"
Input
| Name | Type | Required | Description |
| MessageKey | String | True | Specifies the user-defined identifier (Id) for the outbound message. This key distinguishes the message from other requests and is used for tracking and reporting. |
| MessageGroupKey | String | False | Specifies a user-defined identifier that groups multiple send requests together. This grouping allows related message requests to be tracked and managed as a single logical set. |
| SenderType | String | True | Specifies the name of the over-the-top (OTT) messaging network that is used to deliver the message. This value determines the routing behavior and required authentication context. |
| SenderId | String | True | Specifies the Id of the OTT resource that sends the message. For LINE, this value is the LINE channel Id. For Messenger, this value is the Facebook page Id. |
| OttId | String | True | Specifies the recipient's identifier within the OTT network. For LINE, if the system cannot validate the userReference value, it retries by using the OttId value together with the sender Id. |
| UserReference | String | True | Specifies an alternate Id for the recipient. For Messenger, this value corresponds to the user_ref token. For LINE, this value corresponds to the reply token that LINE generates for an inbound message event. This token is used to send a direct reply to that event and is valid only for a short period. |
| Subject | String | False | Specifies the message name or subject label that identifies the content or purpose of the outbound message. |
| ValidityPeriod | Integer | True | Specifies the length of time during which the request remains valid. If delivery cannot be completed within this period, the request expires and is not processed. |
Result Set Columns
| Name | Type | Description |
| OttRequestId | String | Specifies the identifier (Id) that represents the OTT send request. This Id can be used in follow-up operations to check the status or outcome of the request. |