Clients API: How to Use and Configure
This API (Application Programming Interface) allows the integration between your applications with Atom's client management. This API allows:
Create or Update a client.
Get a list of clients.
View client data through their ID.
View client data through their phone number
Endpoint: Create client - Create/Update Client
This service allows the creation or update of a client in Atom.
Parameters
Below we describe the parameters that must be included in the request in a mandatory way, and others that can be optionally added:
| Parameter Name |
Parameter Name
| Description |
Description
| Data Type |
Data Type
| Required |
Required
| firstName |
firstName
| Client's name |
Client's name
| string |
string
| Yes |
Yes
| lastName |
lastName
| Client's last name |
Client's last name
| string |
string
| Yes |
Yes
| phone |
phone
| Client's phone number. The country code must be prefixed, without using the + sign. Correct:50755667788 ✅ Incorrect:+50555667788 ❌ Incorrect:55667788 ❌ |
Client's phone number. The country code must be prefixed, without using the + sign.
Correct:50755667788 ✅
Incorrect:+50555667788 ❌
Incorrect:55667788 ❌
| string |
string
| Yes |
Yes
| email |
| Client's email |
Client's email
| string |
string
| Optional. |
Optional.
| optionals |
optionals
| Additional parameters to map the information fields associated with the client, the values are written as {key: value} |
Additional parameters to map the information fields associated with the client, the values are written as {key: value}
| object |
object
| Yes |
Yes
| tags |
tags
| Tags for the client |
Tags for the client
| string |
string
| Optional. |
Optional.
The request to create a client using the 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
| {“firstName”: “customer'sname”,“lastName”: customer'slast name”,“phone”: “phonenumber”,“email”: “customer'semail”,“optionals”: {“option1”: “value”,“option2”: “value”,…},“tags”: [“tag 1”, “tag2”]} |
{
“firstName”: “customer'sname”,
“lastName”: customer'slast name”,
“phone”: “phonenumber”,
“email”: “customer'semail”,
“optionals”: {
“option1”: “value”,
“option2”: “value”,
…
},
“tags”: [“tag 1”, “tag2”]
}
Responses
The expected responses for the request made are the following:
| Scenario |
Scenario
| Response Code |
Response Code
| Response Body |
Response Body
| New client |
New client
| 200 |
200
| {"client":"clientID"} |
{
"client":"clientID"
}
| Incorrect token |
Incorrect token
| 400 |
400
| {"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"
}
| Could not create client |
Could not create client
| 500 |
500
| {message: "Cannot perform the creation of the client at ${new Date()}"} |
{
message: "Cannot perform the creation of the client at ${new Date()}"
}
| Could not update client |
Could not update client
| 500 |
500
| {message: "Cannot perform the update of the client"} |
{
message: "Cannot perform the update of the client"
}
| Could not update client |
Could not update client
| 500 |
500
| {message: "Cannot perform the update of the client at ${new Date()}"} |
{
message: "Cannot perform the update of the client at ${new Date()}"
}
Endpoint: Client list - Get list of clients
This service allows you to obtain a list of all clients.
Parameters
Below we explain the parameters that must be included in the request in a mandatory way, and others that can be optionally added
| 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. Default 1 |
NO. Default 1
| size |
size
| Number of records to recover. Default: 10 |
Number of records to recover. Default: 10
| string |
string
| NO. Default 10 |
NO. Default 10
| tags |
tags
| Tags to filter, optional |
Tags to filter, optional
| string |
string
| NO |
NO
| sort |
sort
| Order of results. Accepted values: asc | desc. Default: asc |
Order of results. Accepted values: asc | desc. Default: asc
| string |
string
| NO |
NO
The request to receive the list of clients using the AtomChat API is made as follows:
| Connection Type |
Connection Type
| Public access via Internet |
Public access via Internet
| Endpoint |
Endpoint
| https://us-central1-atomchat-io.cloudfunctions.net/clients?page={string}&size={string}&sort={string} |
https://us-central1-atomchat-io.cloudfunctions.net/clients?page={string}&size={string}&sort={string}
| 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 the following:
| Scenario |
Scenario
| Response Code |
Response Code
| Response Body |
Response Body
| List clients |
List clients
| 200 |
200
| {length: int,page: int,items: [{id: string,firstName: string,lastName:string,email: string,optionals: [key: value]phone: string,tags: [],user: {id: string,name: string},updatedAt: Date,createdAt: Date},]} |
{
length: int,
page: int,
items: [
{
id: string,
firstName: string,
lastName:string,
email: string,
optionals: [key: value]
phone: string,
tags: [],
user: {
id: string,
name: string
},
updatedAt: Date,
createdAt: Date
},
]
}
| There is no list of clients |
There is no list of clients
| 500 |
500
| {message: "Something went wrong while the operation was being performed"} |
{
message: "Something went wrong while the operation was being performed"
}
| Incorrect token |
Incorrect token
| 400 |
400
| {"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"
}
JSON structure example
{
"page": 1,
"length": 1,
"items": [
{
"id": "V2EON8A6SPwC2VudgFbp",
"firstName": "Silvio Nicole",
"lastName": "Carballo",
"email": null,
"optionals": {
"texto 3": "Excelente",
"texto 1": "¡Excelente!",
"texto 9": "Hola",
"texto 8": "1",
"dos": "¡Excelente! 🤩 ",
"nuevo4": "martillo",
"Monto": "21",