🧩 How to Use the Templates API in Atom?
The Atom Templates API allows you to integrate your own applications with the WhatsApp messaging service using pre-approved templates (Template Messages). With this API you can:
✅ Send a message with a template
📋 Get a list of available templates
🔍 Consult the details of a template by its ID
🌐 Available Environments
| Environment |
| Intended Use |
| Base Endpoint |
| Production |
| For end customers and real operations |
| AI |
| Alternative environment available for specific integrations or designated use cases. |
1. Send a Template (Template Message)
This service allows sending a Template Message using an Official WhatsApp number and the corresponding templateId.
Behavior
Number with active conversation:If the number already has a conversation, the message will be sent on that conversation and the confirmation will be immediate.
Number with active conversation:
If the number already has a conversation, the message will be sent on that conversation and the confirmation will be immediate.
Number without active conversation:If there is no previous conversation, the message will remain in a "pending" state until confirmation from the Official WhatsApp provider is received.
Number without active conversation:
If there is no previous conversation, the message will remain in a "pending" state until confirmation from the Official WhatsApp provider is received.
Technical Details
Connection type:Public access via Internet
Method:POST
Required headers:Content-type: application/jsonCharset: utf-8Authorization: Bearer (public token)
Content-type: application/json
Charset: utf-8
Authorization: Bearer (public token)
Endpoint according to environment:Production:https://us-central1-atomchat-io.cloudfunctions.net/templatesAI:https://us-central1-atom-ai.cloudfunctions.net/templates
Production:
AI:
Body Parameters (JSON)
| Parameter |
| Description |
| Type |
| Required |
| templateId |
| ID of the AtomChat Template Message. |
| string |
| Yes |
| phoneNumber |
| Phone number to which the template will be sent. Must include the country code without the + sign and without spaces.Correct:50755667788Incorrect:+50755667788,55667788,507 55667788 |
| string |
| Yes |
| clientName |
| Client name. If not included, the phone number will be used as the default value. |
| string |
| Optional |
| groupName |
| Group to which the conversation will be assigned. If not specified, the first group associated with the integration will be used. |
| string |
| Optional |
| assign |
| Defines whether the conversation is assigned to an agent (true) or to the bot (false, default value). |
| boolean |
| Optional |
| params |
| Object with the parameters required by the template. Example:{ "param1": "value", "param2": "another value" } |
| object |
| Optional |
Body Example (JSON)
Possible Responses
| Scenario |
| Code |
| Response |
| Template sent |
| 200 |
| { "success": true, "message": "Sent", "data": { "conversation_id": "abc123" } } |
| Template pending sending |
| 202 |
| { "success": false, "conversationId": "abc123", "status": 202 } |
| Incorrect parameters |
| 400 |
| { "success": false, "message": "No data to send" } |
| Required parameters are missing |
| 400 |
| Response with technical detail about themissingparams |
| Template without ID or message defined |
| 400 |
| Response with technical detail about thefieldstemplate.appIdortemplate.message |
| Channel not connected |
| 401 |
| Error response indicating that the WhatsApp channel is not configured |
| Incorrect token |
| 401 |
| Error response due to invalid public token |
| Conversation limit reached |
| 401 |
| { "success": false, "message": "The client has reached conversations limit" } |
| Internal system error |
| 500 |
| { "message": "Something went wrong while the operation was executed", "type": "Internal Server Error" } |
2. List Templates
This endpoint allows retrieving a list of active templates available in the channel associated with the public token.
Technical Details
Connection type:Public access via Internet
Method:GET
Required headers:Content-type: application/jsonCharset: utf-8Authorization: Bearer (public token)
Content-type: application/json
Charset: utf-8
Authorization: Bearer (public token)
Endpoint
Use the base URL corresponding to the environment:
Production:
AI:
Optional Parameters
| Parameter |
| Description |
| Type |
| Required |
| page |
| Page number. Default: 1 |
| string |
| No |
| size |
| Number of results per page |
| string |
| No |
| sort |
| Order of results (e.g., asc or desc) |
| string |
| No |
JSON Response Example
3. Get Template by ID
This service allows you to obtain the complete details of a specific template using itstemplateId.
Technical Details
Connection type:Public access via Internet
Method:GET
Required headers:Content-type: application/jsonCharset: utf-8Authorization: Bearer (public token)
Content-type: application/json
Charset: utf-8
Authorization: Bearer (public token)
Endpoint
Use the base URL corresponding to the environment:
Production:
AI:
Replace {templateId} with the actual ID of the template you want to query.
JSON Response Example
Final Considerations
Environment:Verify that you are using the correct endpoint according to the environment (Production or AI), especially in internal tests and developments.
Environment:
Verify that you are using the correct endpoint according to the environment (Production or AI), especially in internal tests and developments.
phoneNumber validation:Make sure to use the correct phone number format (country code without the + sign or spaces) to avoid sending errors.
phoneNumber validation:
Make sure to use the correct phone number format (country code without the + sign or spaces) to avoid sending errors.
Common errors:Check the error responses to identify problems in parameters, authorization (token), or limitations in the WhatsApp channel.
Common errors:
Check the error responses to identify problems in parameters, authorization (token), or limitations in the WhatsApp channel.