API - SISTEMA | BAILEYS | OFIC...

Criar Contato (com validação)

2min
\<?php $curl = curl init(); curl setopt array($curl, array( curlopt url => 'https //{backend url}/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" "teste extra22 2", "number" "5521995027350", "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; { "profilepicurl" "", "isgroup" false, "disablebot" false, "acceptaudiomessage" true, "active" true, "channel" "whatsapp", "perfexid" "", "rdid" "", "cvid" "", "id" 24294, "name" "teste extra22 2", "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 } { "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" } }