Skip to content

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 DID indicated 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:

CodeCase
400Bad Request
401Unauthorized

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:

FieldTypeRequiredDescription
idIntegerNoMessage identifier. Only for output; for input it must be null.
didStringYesChannel identifier. E.g. phone number for WHATSAPP.
msisdnStringYesDestination identifier. E.g. final customer phone number.
nameStringYesName of the person writing the message.
typeStringYesmedia for attachments, text for simple messages.
channelStringYesWHATSAPP|FACEBOOK|WEBCHAT|MESSENGER.
contentStringYesMessage content. Max 3000 characters.
campaignIdIntegerNoCampaign identifier.
isAttachmentBooleanYesIndicates whether the message carries an attachment.
attachmentAttachmentNoStructure when the message carries an attachment.

attachment:

FieldTypeRequiredDescription
mediaUrlStringYesAttachment URL.
mimeTypeStringYesMultimedia 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:

CodeCase
400Bad Request
500Internal 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:

ParameterDescription
didChannel 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:

FieldTypeRequiredDescription
idIntegerYesAgent identifier.
nameStringYesAgent name.
addressStringYesAgent physical location.
maxChatsIntegerNoMaximum number of concurrent chats.
activeBooleanNoIndicates whether the user is active in the system.
statusString EnumYesAgent status.
photoStringYesAgent photo path.
idClientIntegerYesUnique client identifier.
groupObject GroupYesGroup the agent belongs to.

Status enum:

LOGOUTONLINEALMUERZOREUNIÓNDESCANSO

Groups enum:

FieldTypeRequiredDescription
idIntegerYesUnique group identifier.
nameStringYesGroup name.

Get CRM contacts by phone

Service to retrieve CRM contacts.

Endpoint: GET /webhook/chattigo/crm/phone/{phone}/campaign/{campaign}

Params:

ParameterDescription
phoneContact msisdn.
campaignCampaign 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:

CodeCase
400Bad Request
500Internal Server Error

Get CRM contacts by identifier

Service to retrieve CRM contacts by identifier.

Endpoint: GET /webhook/chattigo/crm/identifier/{identifier}/campaign/{campaign}

Params:

ParameterDescription
identifierContact identifier.
campaignCampaign identifier.

Header:

["Authorization" : "<JWT>"]

Response (200):

[
  {
    "id": "ejemplo12345",
    "name": "namePrueba",
    "lastName": "lastName Prueba",
    "email": "mail@mail.com",
    "phone": "5491133332211"
  }
]

Errors:

CodeCase
400Bad Request
500Internal 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:

FieldTypeRequiredDescription
idStringYesIdentifier in the Chattigo CRM. E.g. phone.
nameStringYesContact name.
emailStringYesContact email.
phoneStringYesContact phone.
campo6campo10StringNoFree for any type of information.
idCampaignIntYesCampaign ID associated with the contact.
The JSON values are examples; all fields are editable.

Response (200):

[
  {
    "code": 200,
    "msg": "Updated"
  }
]

Errors:

CodeCase
400Bad Request
500Internal Server Error