SendMessageToRecipient
Send an OTT message to the recipient. Supported OTT networks are Facebook Messenger and LINE.
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 | User-defined message identifier. |
MessageGroupKey | String | False | User-defined message identifier to group a number of send requests. |
SenderType | String | True | Indicates the name of the OTT network the resource is being registered with values: line, messenger. |
SenderId | String | True | Indicates the identifier of the OTT resource sending the message: LINE Channel Id, Messenger Page Id. |
OttId | String | True | Recipient ID of the user. For LINE, if userReference is invalid, a retry is attempted with ottId as senderId. |
UserReference | String | True | Alternate Recipient ID of the user. For Messenger: user_ref can be passed as userReference. For LINE, reply_token can be passed as userReference. |
Subject | String | False | Message name. |
ValidityPeriod | Integer | True | Time period for which the request is valid. |
Result Set Columns
Name | Type | Description |
OttRequestId | String | The request ID of the OTT. |