Send a CTLiveSocial template message to a customer in a whatsapp chat.
Parameters:
Name | Mandatory | Type | Description |
---|---|---|---|
servicePhoneNumber | YES | STRING | whatsapp business number |
customerPhoneNumber | YES | STRING | customer phone number |
templateName | YES | STRING | template name |
language | YES | STRING | template language |
header | YES | OBJECT | template header (null if there is no header or no multimedia header). See table below for details. |
headerData | YES | ARRAY | array of strings representing the header parameters. (pass empty array in case there are no parameters) |
headerText | YES | STRING | header text (null if header type is not text) |
bodyData | YES | ARRAY | array of strings representing the body parameters. (pass empty array in case there are no parameters) |
bodyText | YES | STRING | body text |
footerText | YES | STRING | footer text (null if there is no footer) |
url | YES | STRING | url (null if there is no url) |
dynamic_url | YES | ARRAY | array of string representing the url parameter. (pass empty array in case there is no url parameter) |
Header object:
Name | Mandatory | Type | Description |
---|---|---|---|
type | YES | STRING | header type. Can assume one of the following values:
|
data | YES | STRING | base64 string |
documentType | YES | STRING | document extension |
fileName | YES | STRING | file name (extension included) |
Returns:
Type | Description |
---|---|
JS Promise | A Javascript Promise that return an object containing the following properties:
|
Example:
template only text:
LIVECHAT.sendCTLiveSocialTemplateMessage("3902124122690", "393403602056", "hello_world", "en_US", null, [], "Hello World", [], "Welcome and congratulations!! This message demonstrates your ability to send a WhatsApp message notification from the Cloud API, hosted by Meta. Thank you for taking the time to test with us.", "WhatsApp Business Platform sample message", null, [] );
template text with parameter:
LIVECHAT.sendCTLiveSocialTemplateMessage("3902124122690", "393403602056", "sample_shipping_confirmation", "en_US", null, [], null, ["5"], "Your package has been shipped. It will be delivered in {{1}} business days.", "This message is from an unverified business.", null, [] );
multimedia template with image header:
self.sendCTLiveSocialTemplateMessage("3902124122690", "393403602056", "sample_purchase_feedback", "en_US", { "type": "image", "data": "iVBORw0KGgo…=", "documentType": "png", "fileName": "infobip-logo" }, [], null, ["PlayStation 5"], "Thank you for purchasing {{1}}! We value your feedback and would like to learn more about your experience.", "This message is from an unverified business.", null, [] );