How to Send Template Messages Using the Atom API?
From Atom, we enable our Endpoint within Cloud Functions to allow sending Template Messages using your Official WhatsApp number and the templateId. When the number sent is already linked to a conversation, the message will be sent on the same conversation and the sending confirmation will be immediate. Otherwise, confirmation will be awaited through the Official WhatsApp provider, so an immediate sending confirmation will not be provided.
Below we explain the parameters that must be included in the request on a mandatory basis, and others that can be added optionally:
| Parameter Name |
| Description |
| Data Type |
| Required |
| templateId |
templateId
| Identifier (Id) of the AtomChat Template Message. |
Identifier (Id) of the AtomChat Template Message.
| string |
string
| Yes |
Yes
| phoneNumber |
phoneNumber
| Phone number to which the Template Message will be sent. The country code must be prefixed, without using the + sign
Correct:50755667788 ✅Incorrecto: +50555667788❌Incorrecto:55667788 ❌ |
Phone number to which the Template Message will be sent. The country code must be prefixed, without using the + sign
Correct:50755667788 ✅
Incorrect: +50555667788❌
Incorrect:55667788 ❌
| string |
string
| Yes |
Yes
| clientName |
clientName
| Name of the client to whom the Template Message will be sent. |
Name of the client to whom the Template Message will be sent.
| string |
string
| No. The default value will be the phone number. |
No. The default value will be the phone number.
| groupName |
groupName
| Name of the group to be assigned. |
Name of the group to be assigned.
| string |
string
| No. The default value is obtained from the first group associated with the integration. |
No. The default value is obtained from the first group associated with the integration.
| assign |
assign
| Indicates whether the conversation should be assigned to an Agent (with the valuetrue). Otherwise, it is assigned to Bot. |
Indicates whether the conversation should be assigned to an Agent (with the valuetrue). Otherwise, it is assigned to Bot.
| boolean |
boolean
| No. The default value isfalse. |
No. The default value isfalse.
| params |
params
| Collection of parameters with their required values for the use of the Template Message. |
Collection of parameters with their required values for the use of the Template Message.
| object |
object
| No |
No
The request to send Template Messages using the AtomChat API is made as follows:
| Connection Type |
Connection Type
| Public internet access |
Public internet access
| Endpoint |
Endpoint
| Method |
Method
| POST |
POST
| Headers |
Headers
| Content-type: application/jsonCharset: utf-8Authorization: Bearer (public token) |
Content-type: application/json
Charset: utf-8
Authorization: Bearer (public token)
| Body |
Body
| {“templateId”: “iddeltemplate”,“phoneNumber”: “numerodetelefono”,“clientName”: “nombredelcliente”,“groupName”: “nombredelgrupo”,“assign”:true/false,“params”: {“param1”: “valor”,“param2”: “valor”,…},} |
{
“templateId”: “iddeltemplate”,
“phoneNumber”: “numerodetelefono”,
“clientName”: “nombredelcliente”,
“groupName”: “nombredelgrupo”,
“assign”:true/false,
“params”: {
“param1”: “valor”,
“param2”: “valor”,
…
},
}
The expected responses for the request made are the following:
| Scenario |
| Response Code |
| Response Body |
| New number |
New number
| 200 |
200
| {success: true,message: "Pending"} |
{
success: true,
message: "Pending"
}
| Existing number |
Existing number
| 200 |
200
| {success: true,message: "Sent",data: {conversation_id : conversation.id }} |
{
success: true,
message: "Sent",
data: {conversation_id : conversation.id }
}
| Incorrect parameters |
Incorrect parameters
| 400 |
400
| {success: false,message: "No data to send"} |
{
success: false,
message: "No data to send"
}