Criar Contato
Criar Contato
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://painel.robomensageiro/api/contacts',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"name":"Casas Bahia",
"number":"5511995845527",
"email": "email@email.com"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer tokenmeu'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
Retorno com sucesso:
JSON
{
"alreadyExists": true, // Somente em caso de já existir o contato
"existingContact": {
"id": 9698,
"name": "Casas Bahia",
"number": "5511995845527",
"email": "",
"profilePicUrl": "",
"isGroup": false,
"disableBot": false,
"acceptAudioMessage": true,
"active": true,
"channel": "whatsapp",
"perfexId": "",
"rdId": "",
"cvId": "",
"picupdatedAt": null,
"companyId": 1,
"createdAt": "2023-11-25T17:34:51.008Z",
"updatedAt": "2023-11-25T17:34:51.008Z"
}
}