/
sendTemplateMessage

sendTemplateMessage

Send a IMChannel template message to a customer in a whatsapp chat.

Parameters:

 

Name

Mandatory

Type

Description

Name

Mandatory

Type

Description

type

YES

STRING

template type. Can be one of the following:

  • template_txt

  • template_img

  • template_doc

messageObj

yes

object

message template object. See table below for details.

Message object:

Name

Mandatory

Type

Description

Name

Mandatory

Type

Description

customerPhoneNumber

YES

STRING

customer phone number

servicePhoneNumber

yes

STRING

whatsapp business number

templateName

YES

STRING

template name

templateNamespace

YES

STRING

template namespace

templateMessage

YES

STRING

template text message

templateData

YES

array

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

document

YES

STRING

base64 string (only for template_img or template_doc type)

documentType

YES

STRING

document extension (only for template_img or template_doc type)

caption

YES

STRING

caption (only for template_img or template_doc type)

fileName

YES

STRING

file name (extension included) (only for template_img or template_doc type)

language

YES

STRING

template language

policy

no

STRING

template policy

Returns:

Type

Description

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_txt messageObj:

{ "customerPhoneNumber":"3401234567", "servicePhoneNumber":"3409876543", "templateName":"template_1", "templateNamespace": "cd533c49_d806_4e5a_aa10_494e0bd8851f", "templateMessage": "Hi! Thank you for reaching out our Team", "templateData": [], "language": "it" }

template_img messageObj:

{ "customerPhoneNumber":"3401234567", "servicePhoneNumber":"3409876543", "templateName":"template_1", "templateNamespace": "cd533c49_d806_4e5a_aa10_494e0bd8851f", "templateMessage": "Hi! Thank you for reaching out our Team", "img": "iVBORw0...", "documentType": "png", "caption": "immagine 1", "fileName": "infobip.png", "templateData": [], "language": "it" }

 

Related content

sendCTLiveSocialTemplateMessage
sendCTLiveSocialTemplateMessage
More like this
sendExternalTemplateMessageToCtlivesocial
sendExternalTemplateMessageToCtlivesocial
More like this
sendExternalMultimediaMessageToCtlivesocial
sendExternalMultimediaMessageToCtlivesocial
More like this
sendExternalMessageToCtlivesocial
sendExternalMessageToCtlivesocial
More like this
getAllTemplatesMessages
getAllTemplatesMessages
More like this
sendExternalTextMessageToActiveChat
sendExternalTextMessageToActiveChat
More like this