Criar Contato (Com Validação)
Criar Contato (Com Validação)
PHP
<?php
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://api.robomensageiro.com.br/api/contactswv',
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": "Novo Teste",
"number": "5511978097649",
"email": "email@email.com",
"carteiraId": "", // null ou vazio para não utilizar
"extraInfo": [
{
"name": "Código",
"value": "0"
},
{
"name": "Valor do Lead",
"value": "0"
},
{
"name": "CEP",
"value": "0"
}
]
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer tokenmeu'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
JSON
{
"profilePicUrl": "",
"isGroup": false,
"disableBot": false,
"acceptAudioMessage": true,
"active": true,
"channel": "whatsapp",
"perfexId": "",
"rdId": "",
"cvId": "",
"id": 24294,
"name": "Novo Teste",
"number": "5521995027350",
"email": "email@email.com",
"extraInfo": [
{
"id": 8,
"name": "Código",
"value": "0",
"contactId": 24294,
"updatedAt": "2023-12-10T19:48:59.252Z",
"createdAt": "2023-12-10T19:48:59.252Z"
},
{
"id": 9,
"name": "Valor do Lead",
"value": "0",
"contactId": 24294,
"updatedAt": "2023-12-10T19:48:59.252Z",
"createdAt": "2023-12-10T19:48:59.252Z"
},
{
"id": 10,
"name": "CEP",
"value": "0",
"contactId": 24294,
"updatedAt": "2023-12-10T19:48:59.252Z",
"createdAt": "2023-12-10T19:48:59.252Z"
}
],
"companyId": 1,
"updatedAt": "2023-12-10T19:48:59.248Z",
"createdAt": "2023-12-10T19:48:59.248Z",
"picupdatedAt": null
}
JSON
{
"alreadyExists": true, // Somente em caso de já existir o contato
"existingContact": {
"id": 9698,
"name": "Casas Bahia",
"number": "5521995027179",
"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"
}
}