Get Contact
Get Contact by Phone
Create Contact
create, delete, merge, dismissMergeSuggestion and the channel operations
are not generated in the PHP SDK yet. The endpoints work: call them directly, as
shown below. See the coverage table.Documentation Index
Fetch the complete documentation index at: /llms.txt
Use this file to discover all available pages before exploring further.
Create, list, retrieve and update contacts via the Zavu PHP SDK. Manage profile metadata, channels and merge suggestions from your code.
$result = $client->contacts->retrieve([
'contactId' => 'con_abc123',
]);
echo $result->id . "\n";
echo $result->phoneNumber . "\n";
echo $result->countryCode . "\n";
echo implode(', ', $result->availableChannels) . "\n";
echo $result->defaultChannel . "\n";
$result = $client->contacts->retrieveByPhone([
'phoneNumber' => '+14155551234',
]);
echo $result->id . "\n";
echo implode(', ', $result->availableChannels) . "\n"; // ["sms", "whatsapp"]
create, delete, merge, dismissMergeSuggestion and the channel operations
are not generated in the PHP SDK yet. The endpoints work: call them directly, as
shown below. See the coverage table.curl -X POST https://api.zavu.dev/v1/contacts \
-H "Authorization: Bearer $ZAVUDEV_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"displayName": "John Doe",
"channels": [
{ "channel": "sms", "identifier": "+14155551234", "isPrimary": true }
]
}'
$result = $client->contacts->update([
'contactId' => 'con_abc123',
'defaultChannel' => 'whatsapp',
'metadata' => [
'name' => 'John Doe',
'tier' => 'premium',
],
]);
$result = $client->contacts->list([
'limit' => 50,
]);
foreach ($result->items as $contact) {
echo $contact->id . " " . $contact->phoneNumber . "\n";
}
// Filter by phone number
$result = $client->contacts->list([
'phoneNumber' => '+1415',
]);
// Pagination
$cursor = null;
do {
$result = $client->contacts->list(['cursor' => $cursor, 'limit' => 50]);
foreach ($result->items as $contact) {
echo $contact->id . "\n";
}
$cursor = $result->nextCursor;
} while ($cursor !== null);
# Add
curl -X POST https://api.zavu.dev/v1/contacts/con_abc123/channels \
-H "Authorization: Bearer $ZAVUDEV_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "channel": "email", "identifier": "john.work@company.com", "label": "work" }'
# Update
curl -X PATCH https://api.zavu.dev/v1/contacts/con_abc123/channels/ch_xyz789 \
-H "Authorization: Bearer $ZAVUDEV_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "label": "personal", "verified": true }'
# Set as primary for its type
curl -X POST https://api.zavu.dev/v1/contacts/con_abc123/channels/ch_xyz789/primary \
-H "Authorization: Bearer $ZAVUDEV_API_KEY"
# Remove
curl -X DELETE https://api.zavu.dev/v1/contacts/con_abc123/channels/ch_xyz789 \
-H "Authorization: Bearer $ZAVUDEV_API_KEY"
# Merge the source contact into this one
curl -X POST https://api.zavu.dev/v1/contacts/con_abc123/merge \
-H "Authorization: Bearer $ZAVUDEV_API_KEY" \
-H "Content-Type: application/json" \
-d '{ "sourceContactId": "con_xyz789" }'
# Or dismiss the suggestion
curl -X DELETE https://api.zavu.dev/v1/contacts/con_abc123/merge-suggestion \
-H "Authorization: Bearer $ZAVUDEV_API_KEY"
$result = $client->introspect->phone([
'phoneNumber' => '+14155551234',
]);
echo $result->validNumber . "\n"; // true
echo $result->countryCode . "\n"; // "US"
echo $result->nationalFormat . "\n"; // "(415) 555-1234"
echo $result->lineType . "\n"; // "mobile"
echo implode(', ', $result->availableChannels) . "\n"; // ["sms", "whatsapp"]
echo $result->carrier?->name . "\n"; // "Verizon Wireless"
