Chattigo Webhook
Connect external channels to Chattigo and manage your inbound and outbound messages from the platform.
Considerations
- The client must request a username and password with their KAM, indicating the name of the campaign or the client that will use the API.
- The client must provide the Endpoint for outbound messages from Chattigo (see Message reception).
- The channels that will use the application must be preconfigured in Chattigo. The channels are the
DIDindicated in the JSON structure described below.
Authentication
Service to obtain the authentication token used in each iteration. It is valid for 8 hours and only for the logged-in user.
Endpoint: POST /login
Body:
{
"username": "<User>",
"password": "<Password>"
}Response (200):
{
"access_token": "<JWT>"
}Errors:
| Code | Case |
|---|---|
400 | Bad Request |
401 | Unauthorized |
Message sending
Service that allows the client to send messages to the platform to be managed by connected agents.
Endpoint: POST /inbound
Header:
["Authorization" : "Bearer <JWT>"]Body:
{
"id": "<identifier>",
"did": "<channel identifier>",
"msisdn": "<destination identifier>",
"name": "<name>",
"type": "<media|text>",
"channel": "<WHATSAPP|FACEBOOK|WEBCHAT|MESSENGER>",
"content": "<message content>",
"isAttachment": "<true|false>",
"attachment": {
"mediaUrl": "<multimedia url>",
"mimeType": "<multimedia type>"
}
}Response (200):
Asynchronous service — the response is always successful.
Object definition:
| Field | Type | Required | Description |
|---|---|---|---|
id | Integer | No | Message identifier. Only for output; for input it must be null. |
did | String | Yes | Channel identifier. E.g. phone number for WHATSAPP. |
msisdn | String | Yes | Destination identifier. E.g. final customer phone number. |
name | String | Yes | Name of the person writing the message. |
type | String | Yes | media for attachments, text for simple messages. |
channel | String | Yes | WHATSAPP|FACEBOOK|WEBCHAT|MESSENGER. |
content | String | Yes | Message content. Max 3000 characters. |
campaignId | Integer | No | Campaign identifier. |
isAttachment | Boolean | Yes | Indicates whether the message carries an attachment. |
attachment | Attachment | No | Structure when the message carries an attachment. |
attachment:
| Field | Type | Required | Description |
|---|---|---|---|
mediaUrl | String | Yes | Attachment URL. |
mimeType | String | Yes | Multimedia type. E.g. video, image. |
Message reception
Service that dispatches messages to customers interacting with agents.
Endpoint: POST /{https URL provided by the client}
Header:
["Authorization" : "Bearer <JWT>"]Body:
{
"id": "<identifier>",
"did": "<channel identifier>",
"msisdn": "<destination identifier>",
"name": "<name>",
"type": "<media|text>",
"channel": "<WHATSAPP|FACEBOOK|WEBCHAT|MESSENGER>",
"content": "<message content>",
"isAttachment": "<true|false>",
"attachment": {
"mediaUrl": "<multimedia url>",
"mimeType": "<multimedia type>"
}
}Errors:
| Code | Case |
|---|---|
400 | Bad Request |
500 | Internal Server Error |
The object definition is identical to Message sending.
Available agents
Service that lists the agents connected to the platform by channel identifier.
Endpoint: GET /agents/{did}
Params:
| Parameter | Description |
|---|---|
did | Channel identifier. |
Header:
["Authorization": "Bearer <JWT>"]Response (200):
[
{
"id": 3089,
"name": "Juan Gonzalez",
"address": "San Joaquin",
"maxChats": 5,
"active": true,
"idClient": 235,
"photo": "https://...",
"status": "ONLINE",
"groups": [{ "id": 262, "name": "contabilidad_general" }]
}
]Object definition:
| Field | Type | Required | Description |
|---|---|---|---|
id | Integer | Yes | Agent identifier. |
name | String | Yes | Agent name. |
address | String | Yes | Agent physical location. |
maxChats | Integer | No | Maximum number of concurrent chats. |
active | Boolean | No | Indicates whether the user is active in the system. |
status | String Enum | Yes | Agent status. |
photo | String | Yes | Agent photo path. |
idClient | Integer | Yes | Unique client identifier. |
group | Object Group | Yes | Group the agent belongs to. |
Status enum:
LOGOUT | ONLINE | ALMUERZO | REUNIÓN | DESCANSO |
|---|
Groups enum:
| Field | Type | Required | Description |
|---|---|---|---|
id | Integer | Yes | Unique group identifier. |
name | String | Yes | Group name. |
Get CRM contacts by phone
Service to retrieve CRM contacts.
Endpoint: GET /webhook/chattigo/crm/phone/{phone}/campaign/{campaign}
Params:
| Parameter | Description |
|---|---|
phone | Contact msisdn. |
campaign | Campaign identifier. |
Header:
["Authorization" : "<JWT>"]Response (200):
[
{
"id": "ejemplo12345",
"name": "namePrueba",
"lastName": "lastName Prueba",
"email": "mail@mail.com",
"phone": "5491133332211",
"campo6": "ejemplo campo6",
"campo7": "ejemplo campo7",
"campo8": "ejemplo campo8",
"campo9": "ejemplo campo9",
"campo10": "ejemplo campo10"
}
]Errors:
| Code | Case |
|---|---|
400 | Bad Request |
500 | Internal Server Error |
Get CRM contacts by identifier
Service to retrieve CRM contacts by identifier.
Endpoint: GET /webhook/chattigo/crm/identifier/{identifier}/campaign/{campaign}
Params:
| Parameter | Description |
|---|---|
identifier | Contact identifier. |
campaign | Campaign identifier. |
Header:
["Authorization" : "<JWT>"]Response (200):
[
{
"id": "ejemplo12345",
"name": "namePrueba",
"lastName": "lastName Prueba",
"email": "mail@mail.com",
"phone": "5491133332211"
}
]Errors:
| Code | Case |
|---|---|
400 | Bad Request |
500 | Internal Server Error |
Create a contact in CRM
Service to create a contact in the Chattigo CRM.
Endpoint: POST /webhook/chattigo/crm/create
Header:
["Authorization" : "<JWT>"]Body:
[
{
"id": "12345",
"name": "namePrueba",
"lastName": "lastName Prueba",
"email": "mail@mail.com",
"phone": "5491133332211",
"campo6": "ejemplo campo6",
"campo7": "ejemplo campo7",
"campo8": "ejemplo campo8",
"campo9": "ejemplo campo9",
"campo10": "ejemplo campo10",
"idCampaign": 2246
}
]Object definition:
| Field | Type | Required | Description |
|---|---|---|---|
id | String | Yes | Identifier in the Chattigo CRM. E.g. phone. |
name | String | Yes | Contact name. |
email | String | Yes | Contact email. |
phone | String | Yes | Contact phone. |
campo6–campo10 | String | No | Free for any type of information. |
idCampaign | Int | Yes | Campaign ID associated with the contact. |
Response (200):
[
{
"code": 200,
"msg": "Updated"
}
]Errors:
| Code | Case |
|---|---|
400 | Bad Request |
500 | Internal Server Error |