Skip to main content

Add Contacts

Method#

/contacts/add#

POST https://api.z-api.io/instances/SUA_INSTANCIA/token/SEU_TOKEN/contacts/add

Header#

KeyValue
Client-TokenACCOUNT SECURITY TOKEN

Concept#

This method is responsible for saving WhatsApp contacts to your phone's contact list.


About This Feature

The method for adding contacts to the WhatsApp list will only work for accounts that have already received the necessary update. Make sure your WhatsApp account has received the update before using this feature; otherwise, the operation will not be completed successfully.

Additionally, you must allow WhatsApp to add contacts directly on your device. To do this, go to your app’s privacy settings and adjust the permissions so that WhatsApp can access and modify your contacts.

See the example in the images below:

Click here to display the images.

image image

Attributes#

Required#

AttributesTypeDescription
firstNamestringFirst name of the contact to be added to the address book
phonestringPhone number of the contact to be added to the address book

Optionals#

AttributesTypeDescription
lastNamestringLast name of the contact to be added to the address book

Request Body#

[
{
"firstName": "contact 1",
"lastName": "name 2",
"phone": "554499999999"
},
{
"firstName": "contact 2",
"lastName": "name 2",
"phone": "554499998888"
}
]

Response#

200#

AtributosTipoDescrição
successboolean
errorsarray

Exemplo

{
"success": true,
"errors": []
}

405#

In this case, make sure you are sending the method specification correctly, meaning check if you sent POST or GET as specified at the beginning of this topic.

415#

If you receive a 415 error, ensure you add the "Content-Type" of the object you are sending in the request headers, which is mostly "application/json".


Code#