Senders are phone numbers or identities used to send messages. Each project can have multiple senders with one designated as default.
List Senders
$result = $client->senders->list([]);
foreach ($result->items as $sender) {
echo $sender->id . " " . $sender->name . " " . $sender->phoneNumber . "\n";
if ($sender->isDefault) {
echo "(Default sender)\n";
}
}
// With pagination
$result = $client->senders->list([
'limit' => 50,
'cursor' => 'cursor_xxx',
]);
Get Sender
$result = $client->senders->get([
'senderId' => 'snd_abc123',
]);
echo $result->id . "\n";
echo $result->name . "\n";
echo $result->phoneNumber . "\n";
echo $result->isDefault . "\n";
Create Sender
$result = $client->senders->create([
'name' => 'Marketing',
'phoneNumber' => '+15551234567',
'setAsDefault' => true,
]);
echo $result->id . "\n"; // snd_xxx
With Webhook
$result = $client->senders->create([
'name' => 'Marketing',
'phoneNumber' => '+15551234567',
'webhookUrl' => 'https://your-app.com/webhooks',
'webhookEvents' => ['message.inbound', 'message.delivered', 'message.failed'],
]);
// Webhook secret is only returned on create
if ($result->webhook?->secret) {
echo "Save this secret: " . $result->webhook->secret . "\n";
}
Update Sender
$result = $client->senders->update([
'senderId' => 'snd_abc123',
'name' => 'Support',
'setAsDefault' => true,
]);
Update Webhook Configuration
$result = $client->senders->update([
'senderId' => 'snd_abc123',
'webhookUrl' => 'https://new-url.com/webhooks',
'webhookEvents' => ['message.inbound'],
'webhookActive' => true,
]);
Disable Webhook
$result = $client->senders->update([
'senderId' => 'snd_abc123',
'webhookActive' => false,
]);
Remove Webhook
$result = $client->senders->update([
'senderId' => 'snd_abc123',
'webhookUrl' => null,
]);
Delete Sender
$client->senders->delete([
'senderId' => 'snd_abc123',
]);
You cannot delete the default sender. Set another sender as default first.
Regenerate Webhook Secret
If your webhook secret is compromised, generate a new one:
$result = $client->senders->regenerateWebhookSecret([
'senderId' => 'snd_abc123',
]);
echo "New secret: " . $result->secret . "\n";
After regenerating the secret, update your webhook handler to use the new secret. The old secret will no longer work.
WhatsApp Business Profile
Manage the WhatsApp Business Profile for senders with a connected WhatsApp Business Account.
Get Profile
$response = $client->senders->getProfile('snd_abc123');
echo $response->profile->about . "\n";
echo $response->profile->description . "\n";
echo $response->profile->address . "\n";
echo $response->profile->email . "\n";
echo implode(', ', $response->profile->websites ?? []) . "\n";
echo $response->profile->vertical . "\n";
echo $response->profile->profilePictureUrl . "\n";
Update Profile
$response = $client->senders->updateProfile('snd_abc123', [
'about' => 'Your trusted online store',
'description' => 'Best products at competitive prices',
'address' => '123 Main St, San Francisco, CA',
'email' => 'support@example.com',
'websites' => ['https://example.com'],
'vertical' => 'RETAIL',
]);
Upload Profile Picture
$response = $client->senders->uploadProfilePicture('snd_abc123', [
'imageUrl' => 'https://example.com/logo.png',
'mimeType' => 'image/png',
]);
Profile methods are only available for senders with a WhatsApp Business Account connected.
Using Senders in Messages
Specify a sender when sending a message:
$result = $client->messages->send([
'to' => '+14155551234',
'text' => 'Hello!',
'Zavu-Sender' => 'snd_abc123',
]);
If no sender is specified, the default sender is used.