- Print
- DarkLight
- PDF
Send a WhatsApp Template Message
- Print
- DarkLight
- PDF
Send template messages via WhatsApp to targeted contacts directly from your workspace using this endpoint. It supports only WhatsApp Cloud App and WhatsApp Sandbox App. To get the valid endpoint URL for sending template messages in your workspace,
- Go to Administration > Apps > Marketplace
- Search for WhatsApp Cloud app
- Navigate to App Info > Details > POST templateMessage.
- Copy the endpoint URL for sending template messages in your workspace. The URL also includes the
appId
.
We strongly recommend including the + prefix for all phone numbers in the payload. While you can submit numbers without the leading + sign, we have encountered cases where WhatsApp will return an invalid response despite the number being in use.
Recipient WhatsApp IDs where you want to send the template message. You can validate a WhatsApp id from here.
The WhatsApp Number from which you want to send this template message. The WhatsApp number connected to your workspace via the app.
Username of the agent you want to transfer the chat to when the WhatsApp user replies.
Department name or ID where you want to transfer the chat to when the WhatsApp user replies.
Provide information about the template message you wish to send. Refer to Message Templates and Sending WhatsApp template messages from your workspace for template examples.
OK
{
"success": true
}
Bad Request
{
"success": false,
"error": "Too many phone numbers! Please make sure that phoneNumbers are <= 250"
}
{
"success": false,
"error": "No Agent found with username abc98"
}
{
"success": false,
"error": "No Department found with id/Name SalesDepartment"
}
{
"success": false,
"error": "Connected WhatsApp Number (connectedWhatsAppNo) i.e. 565412001234 is not a valid WhatsApp contact. Contact Status is invalid"
}
{
"success": false,
"error": "Error! Connected WhatsApp Number (connectedWhatsAppNo) i.e. 565412001234 has not been registered yet on Rocket.Chat. Please goto #omnichannel-whatsapp-setup channel and connect this WhatsApp number first there before sending this request again."
}
Unauthorized
{
"status": "error",
"message": "You must be logged in to do this."
}
Forbidden
{
"success": false,
"error": "User does not have the permissions required for this action [error-unauthorized]"
}