Skip to main content

Use our Templates API in Atom

```html

Use our Templates API in Atom

This API (Application Programming Interface) enables integration between your applications and the Atom Templates sending service. This API allows you to:

  • Send a template.

  • Get a list of templates.

  • View details of a template through its ID.

Endpoint: Templates - Sending Template

This service enables the sending of Template Messages using the Official WhatsApp number and the templateId.

When the number sent is already linked to a conversation, the message will be sent on it and the sending confirmation will be immediate. Otherwise, confirmation will be expected through the Official WhatsApp provider, so an immediate sending confirmation will not be provided.

Parameters

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 |

Parameter Name

| Description |

Description

| Data Type |

Data Type

| Required |

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 ✅

Incorrect:+50555667788 ❌

Incorrect: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

| firstName |

firstName

| Customer's name |

Customer's name

| string |

string

| Yes |

Yes

| lastName |

lastName

| Customer's last name |

Customer's last name

| string |

string

| Yes |

Yes

| assign |

assign

| Indicates whether the conversation should be assigned to an Agent (with the value true). Otherwise, it is assigned to Bot. |

Indicates whether the conversation should be assigned to an Agent (with the value true). Otherwise, it is assigned to Bot.

| boolean |

boolean

| No. The default value is false. |

No. The default value is false.

| params |

params

| Collection of parameters with their required values for the use of the Template Message.{key: value} |

Collection of parameters with their required values for the use of the Template Message.

{key: value}

| object |

object

| No |

No

The request to send Templates Messages (messages with templates) using the new AtomChat API, is made as follows:

| Connection Type |

Connection Type

| Public access via Internet |

Public access via Internet

| 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”,“firstName”: “nombredelcliente”,“lastName”: apellidodelcliente”,“groupName”: “nombredelgrupo”,“assign”:true/false,“params”: {“param1”: “valor”,“param2”: “valor”,…},} |

{

“templateId”: “iddeltemplate”,

“phoneNumber”: “numerodetelefono”,

“firstName”: “nombredelcliente”,

“lastName”: apellidodelcliente”,

“groupName”: “nombredelgrupo”,

“assign”:true/false,

“params”: {

“param1”: “valor”,

“param2”: “valor”,

},

}

Responses

The expected responses for the request made are as follows:

| Scenario |

Scenario

| Response Code |

Response Code

| Response Body |

Response Body

| Template sent |

Template sent

| 200 |

200

| {success: true,message: "Sent",data: {conversation_id : conversation.id }} |

{

success: true,

message: "Sent",

data: {conversation_id : conversation.id }

}

| Template pending sending |

Template pending sending

| 202 |

202

| {"success": false,"conversationId":conversation.id,"status": 202} |

{

"success": false,

"conversationId":conversation.id,

"status": 202

}

| Incorrect parameters |

Incorrect parameters

| 400 |

400

| {success: false,message: "No hay datos para enviar"} |

{

success: false,

message: "No hay datos para enviar"

}

| Missing Required Template Parameters |

Missing Required Template Parameters

| 400 |

400

| {code: 400,body: {context: { key: 'Body', label: 'body.params' },message: "Missing params:[] ",path: ['body.params'],type: 'Bad format',},} |

{

code: 400,

body: {

context: { key: 'Body', label: 'body.params' },

message: "Missing params:[] ",

path: [

'body.params'

],

type: 'Bad format',

},

}

| Template without ID or Template without defined message |

Template without ID or Template without defined message

| 400 |

400

| {code: 400,body: {context: { key: 'Body', label: ['template.appId', 'template.message'] },message: 'No data to send',path: ['template.appId', 'template.message'],type: 'Bad format',},} |

{

code: 400,

body: {

context: { key: 'Body', label: ['template.appId', 'template.message'] },

message: 'No data to send',

path: [

'template.appId', 'template.message'

],

type: 'Bad format',

},

}

| Channel not connected |

Channel not connected

| 401 |

401

| {code: 401,body: {context: {value: atom.channel?.status, key: 'Channel', label: 'channel.status'},message: 'The channel associated to the template is not configured yet, please contact the support team',path: ['channel.status'],type: 'Bad format',},} |

{

code: 401,

body: {

context: {

value: atom.channel?.status, key: 'Channel', label: 'channel.status'

},

message: 'The channel associated to the template is not configured yet, please contact the support team',

path: ['channel.status'],

type: 'Bad format',

},

}

| Incorrect Token |

Incorrect Token

| 401 |

401

| {"context": {"key": "Authorization","label": "headers.authorization","value":Bearer},"message": "Cannot find a channel associated with the public tokenBearer","path": ["headers.authorization"],"type": "Bad format"} |

{

"context": {

"key": "Authorization",

"label": "headers.authorization",

"value":Bearer

},

"message": "Cannot find a channel associated with the public tokenBearer",

"path": [

"headers.authorization"

],

"type": "Bad format"

}

| The conversation limit of the plan was reached |

The conversation limit of the plan was reached

| 401 |

401

| {"success": false,"message": "The client has reached conversations limit","conversationId": null,"status": 401} |

{

"success": false,

"message": "The client has reached conversations limit",

"conversationId": null,

"status": 401

}

| Internal Error |

Internal Error

| 500 |

500

| {context: { key: 'Api', label: 'api.SendTemplateController', value: error },message: 'Something went wrong while the operation was executed',path: ['api.SendTemplateController'],type: 'Internal Server Error',} |

{

context: { key: 'Api', label: 'api.SendTemplateController', value: error },

message: 'Something went wrong while the operation was executed',

path: ['api.SendTemplateController'],

type: 'Internal Server Error',

}

Endpoint: Get List of templates - List templates

This service allows you to list the templates belonging to a channel determined by the public token.

Parameters

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 |

Parameter Name

| Description |

Description

| Data Type |

Data Type

| Required |

Required

| page |

page

| Indicator of the page on which you want to obtain the records. Default: 1 |

Indicator of the page on which you want to obtain the records. Default: 1

| string |

string

| No |

No

| size |

size

| Number of records to retrieve. Default: 10 |

Number of records to retrieve. Default: 10

| string |

string

| No |

No

The request to receive a list of templates using the AtomChat API is done as follows:

| Connection Type |

Connection Type

| Public access via Internet |

Public access via Internet

| Endpoint |

Endpoint

| Method |

Method

| GET |

GET

| Headers |

Headers

| Content-type: application/jsonCharset: utf-8Authorization: Bearer (public token) |

Content-type: application/json

Charset: utf-8

Authorization: Bearer (public token)

Responses

The expected responses for the request made are as follows:

| Scenario |

Scenario

| Response Code |

Response Code

| Response Body |

Response Body

| List templates |

List templates

Did this answer your question?