Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Name

Mandatory

Type

Description

servicePhoneNumber

Status
colourRed
titleYES

Status
titleSTRING

whatsapp business number

customerPhoneNumber

Status
colourRed
titleYES

Status
titlestring

customer phone number

templateName

Status
colourRed
titleYES

Status
titlestring

template name

language

Status
colourRed
titleYES

Status
titlestring

template language

header

Status
colourRed
titleYES

Status
titleobject

template header (null if there is no header or no multimedia header). See table below for details.

headerData

Status
colourRed
titleYES

Status
titlearray

array of strings representing the header parameters. (pass empty array in case there are no parameters)

headerText

Status
colourRed
titleYES

Status
titlestring

header text (null if header type is not text)

bodyData

Status
colourRed
titleYES

Status
titlearray

array of strings representing the body parameters. (pass empty array in case there are no parameters)

bodyText

Status
colourRed
titleYES

Status
titlestring

body text

footerText

Status
colourRed
titleYES

Status
titlestring

footer text (null if there is no footer)

url

Status
colourRed
titleYES

Status
titlestring

url (null if there is no url)

dynamic_url

Status
colourRed
titleYES

Status
titlearray

array of string representing the url parameter. (pass empty array in case there is no url parameter)

Header object:

Name

Mandatory

Type

Description

type

Status
colourRed
titleYES

Status
titleSTRING

header type. Can assume one of the following values:

  • image

  • video

  • document

data

Status
colourRed
titleYES

Status
titlestring

base64 string

documentType

Status
colourRed
titleYES

Status
titlestring

document extension

fileName

Status
colourRed
titleYES

Status
titlestring

file name (extension included)

Returns:

Type

Description

JS Promise

A Javascript Promise that return an object containing the following properties:

  • result: if true, the service response was performed correctly

  • error: contains the error description if an error has occurred in the request

Example:

template only text:

Code Block
languagejs
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:

Code Block
languagejs
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:

Code Block
languagejs
self.sendCTLiveSocialTemplateMessage("3902124122690", "393403602056", "sample_purchase_feedback", "en_US",
{
  "type": "image",
  "data": "iVBORw0KGgo…=",
  "documentType": "png",
  "fileName": "infobip-logo"
},
[], null,
["our latest product"],
  "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, []
);