Working with contacts

Contact is an entity that connects the user and the customer who has written. It is a kind of “contact card” where the client’s contact information (phone number to contact in WhatsApp, id in Telegram, username in Instagram) is stored and the manager responsible for him is specified.

Adding and updating the contact list

To add a contact list or change existing ones, send a request

 POST https://api.wazzup24.com/v3/contacts

There’s a limit of 100 entities per request.

Parameter

Required parameters are marked with an asterisk

Type Description
id* String Contact ID in the CRM system. No more than 100 characters
responsibleUserId* String The ID of the responsible user. No more than 100 characters.

Fill in this field to have the dialog displayed in the Wazzup chat window of the person responsible for the contact

name* String Contact Name. No more than 200 characters
contactData* Array An array of objects with contact data
contactData.chatType* String Chat type. Available values:

  • WhatsApp: “whatsapp”,
  • WhatsApp group chat: “whatsgroup”,
  • Instagram: “instagram”,
  • Telegram: “telegram”.
contactData.chatId* String Chat Id (contact’s account in messenger):

  • for “whatsapp” — only numbers, without spaces and special characters in the format 79011112233,
  • for “instagram” — an account without “@” in the beginning,
  • for “whatsgroup” — comes in webhooks of incoming messages,
  • for “telegram” — comes in webhooks of incoming messages and in response to a request when sending an outgoing one with phone or username parameters.
contactData.username String For Telegram only.
The username of the Telegram contact, with no @ at the beginning. Can be used when sending messages via Telegram if chatId is not known
contactData.phone String For Telegram only.
Contact’s phone number in international format, without + and other symbols, only numbers, with the correct country code. Can be used when sending messages via Telegram if the chatId is not known
uri String A link to the contact in the CRM. Not more than 200 characters. If specified, in the “suitcase” tool, the user will see a button leading to the contact’s page in the CRM
Request example
fetch("https://api.wazzup24.com/v3/contacts", {
  method: "POST",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer {apiKey}",
  },
  body: [
{
        "id": "1",
        "responsibleUserId": "1",
        "name": "3301",
        "contactData": [
            {
                "chatType": "whatsapp",
                "chatId": "79991114433"
            }
        ],
        "uri": "https://link-to-contact-in-crm.com"
    },
    {
        "id": "2",
        "responsibleUserId": "1",
        "name": "3302",
        "contactData": [
            {
                "chatType": "whatsapp",
                "chatId": "79884447788"
            }
        ]
    }
]
Errors

In addition to the common errors for all routes, in this one it is still possible:

Error Description
INVALID_CONTACTS_DATA The body of the request is empty or some of the passed fields are invalid.
TOO_MACH_ENTITIES Limit of 100 entities per request exceeded

 HTTP/1.1 400 Bad Request
{
"error": "INVALID_CONTACTS_DATA",
"description": "One or more of provided contacts data are not valid."
"data": [
{
index: 12,
fields: [
"responsibleUserId",
]
}
]
}

 HTTP/1.1 400 Bad Request
{
"error": "TOO_MACH_ENTITIES",
"description": "Too mach entities per request.",
"data": {
"count": 123,
"limit": 100,
}
}

Obtaining the contact list

To get the list of contacts call:

 GET https://api.wazzup24.com/v3/contacts?offset=

You can get up to 100 records in one query, including offset, sorted by ascending id (ASC).

offset — pagination offset, non-negative integer.

Response

The data from the query result will come in an array of objects with the following parameters:

Parameter Type Description
count Number Total number of contacts
data Object Array with data about the contact
data.id String Contact Id in the CRM system. No more than 100 characters
data.responsibleUserId String Id of the responsible user. No more than 100 characters
data.name String Contact name. No more than 200 characters
data.contactData Object An array of objects with contact data that contains chatType and chatId
data.uri String A link to the contact in the CRM. Not more than 200 characters.

If specified, in the “suitcase” tool, the user can see a button leading to the contact’s page in the CRM

Getting information about an individual contact

To get information about a single contact uploaded from CRM to Wazzup you need to call

 GET https://api.wazzup24.com/v3/contacts/{contact id}
Request example
 curl --location --request GET 'https://api.wazzup24.com/v3/contacts/111-2e0df379-0e3c-470f-9b36' \

--header 'Authorization: Bearer c8cf904467023482f909520d454368d27'
Response

The data from the query result will come in the form of an object with the following parameters:

Параметр Тип Описание
id String Contact Id in the CRM system. No more than 100 characters
responsibleUserId String Id of the responsible user. No more than 100 characters
name String Contact name. No more than 200 characters
contactData Object An array of objects with contact data that contains chatType and chatId
uri String A link to the contact in the CRM. Not more than 200 characters.

If specified, in the “suitcase” tool, the user will see a button leading to the contact’s page in the CRM

Deleting a contact

To delete a contact, call:

 DELETE https://api.wazzup24.com/v3/contacts/{contact id}

If there is a dialog with this contact in the general chat, it will remain there.

Request example
 curl --location --request DELETE 'https://api.wazzup24.com/v3/contacts/111-2e0df379-0e3c-470f-9b36' \

--header 'Authorization: Basic c8cf90444023482f909520d454368d27'
Errors

Deleting multiple contacts

To delete the list of contacts, call

 PATCH https://api.wazzup24.com/v3/contacts/bulk_delete

In the body of the request you must pass an array of id of contacts to be deleted. If the deletion is successful, 200 OK and an empty array will be returned. If you specified contacts in the deletion request, some of which are absent in Wazzup, their IDs will be returned as an array in the response.

Request example
fetch("https://api.wazzup24.com/v3/contacts/bulk_delete", {
  method: "PATCH",
  headers: {
    "Content-Type": "application/json",
    "Authorization": "Bearer {apiKey}",
  },
  body: [
    "contact-id-123",
    "contact-id-456",
  ]
});