I have the following code.
<?php
$email = $_POST['email'];
$nome = $_POST['nome'];
//Não mexer//
require_once "vendor/autoload.php";
use Intercom\IntercomClient;
$client = new IntercomClient('App_ID', 'App_Key');
//Não mexer//
//Cria o Lead//
$client->leads->create([
"name" => "$nome",
"email" => "$email"
]);
//Termina de Criar//
//Pega dados Lead//
$leads = $client->leads->getLeads(['email' => $email]);
foreach($leads->contacts as $contact){
echo "type: " . $contact->type;
echo "id: " . $contact->id;
echo "user_id: " . $contact->user_id;
echo "email: " . $contact->email;
echo "name: " . $contact->name;
}
//Termina de Pegar//
//Adiciona a Tag//
$client->tags->tag([
"name" => "Beneficio-em-Dobro",
"leads" => [
["id" => "$id"]
]
]);
//Termina de Adicionar// ?>
But when executing this code, it creates the 'Lead' but does not create the TAG. and does not show me his data. already tried to pass in "" bad will not.