According to documentation , you will receive JSON
like this:
{
"type": "contact.list",
"total_count": 105,
"contacts": [
{
"type": "contact",
"id": "530370b477ad7120001d",
},
{
"type": "contact",
"id": "530370b477ad7120001d",
"user_id": "8a88a590-e1c3-41e2-a502-e0649dbf721c",
"email": "[email protected]",
"name": "Winston Smith",
},
{
"type": "contact",
"id": "530370b477ad7120001d",
"user_id": "8a88a590-e1c3-41e2-a502-e0649dbf721c",
"email": "[email protected]",
"name": "Winston Smith",
},
{
"type": "contact",
"id": "530370b477ad7120001d",
"user_id": "8a88a590-e1c3-41e2-a502-e0649dbf721c",
"email": "[email protected]",
"name": "Winston Smith",
}
],
"pages": {
"next": "https://api.intercom.io/contacts?per_page=50&page=2",
"page": 1,
"per_page": 50,
"total_pages": 3
}
}
It looks like this:
require "vendor/autoload.php";
use Intercom\IntercomClient;
$client = new IntercomClient(App_ID, App_Key);
$leads = $client->leads->getLeads(['email' => '[email protected]']);
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;
}