I have a API
that returns me some results, but with your help I managed to make the code work but after a few days the code stopped.
I have this code:
<?php
$email = $_GET['email'];
$nome = $_GET['nome'];
//Não mexer//
require_once "vendor/autoload.php";
use Intercom\IntercomClient;
$client = new IntercomClient('App_ID', 'App_Key');
//Não mexer//
$client->leads->create(["email" => $email]);
sleep(40);
//Pega dados Lead//
$leads = $client->leads->getLeads(['email' => $email]);
foreach($leads->contacts as $contact){
echo "type: " . $contact->type ."<br>";
echo "id: " . $contact->id ."<br>";
echo "user_id: " . $contact->user_id ."<br>";
echo "email: " . $contact->email ."<br>";
echo "name: " . $contact->name ."<br>";
$id = $contact->id;
}
//Termina de Pegar//
//Cria a Tag//
$client->tags->tag([
"name" => "beneficio-em-dobro",
"users" => [
["id" => $id]
]
]);
//end//
As you can see, I have to give a "pause" of 40 seconds, otherwise the code does not work. I did not understand why, if it was working normally.