> ## Documentation Index
> Fetch the complete documentation index at: https://docs.zavu.dev/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage Senders with the PHP SDK

> Create, update and list sender profiles via the Zavu PHP SDK. Combine phone numbers, WhatsApp accounts and webhooks into routing identities.

Senders are phone numbers or identities used to send messages. Each project can have multiple senders with one designated as default.

## List Senders

```php theme={null}
$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

```php theme={null}
$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

```php theme={null}
$result = $client->senders->create([
    'name' => 'Marketing',
    'phoneNumber' => '+15551234567',
    'setAsDefault' => true,
]);

echo $result->id . "\n"; // snd_xxx
```

### With Webhook

```php theme={null}
$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

```php theme={null}
$result = $client->senders->update([
    'senderId' => 'snd_abc123',
    'name' => 'Support',
    'setAsDefault' => true,
]);
```

### Update Webhook Configuration

```php theme={null}
$result = $client->senders->update([
    'senderId' => 'snd_abc123',
    'webhookUrl' => 'https://new-url.com/webhooks',
    'webhookEvents' => ['message.inbound'],
    'webhookActive' => true,
]);
```

### Disable Webhook

```php theme={null}
$result = $client->senders->update([
    'senderId' => 'snd_abc123',
    'webhookActive' => false,
]);
```

### Remove Webhook

```php theme={null}
$result = $client->senders->update([
    'senderId' => 'snd_abc123',
    'webhookUrl' => null,
]);
```

## Delete Sender

```php theme={null}
$client->senders->delete([
    'senderId' => 'snd_abc123',
]);
```

<Note>
  You cannot delete the default sender. Set another sender as default first.
</Note>

## Regenerate Webhook Secret

If your webhook secret is compromised, generate a new one:

```php theme={null}
$result = $client->senders->regenerateWebhookSecret([
    'senderId' => 'snd_abc123',
]);

echo "New secret: " . $result->secret . "\n";
```

<Warning>
  After regenerating the secret, update your webhook handler to use the new secret. The old secret will no longer work.
</Warning>

## WhatsApp Business Profile

Manage the WhatsApp Business Profile for senders with a connected WhatsApp Business Account.

### Get Profile

```php theme={null}
$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

```php theme={null}
$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

```php theme={null}
$response = $client->senders->uploadProfilePicture('snd_abc123', [
    'imageUrl' => 'https://example.com/logo.png',
    'mimeType' => 'image/png',
]);
```

<Note>
  Profile methods are only available for senders with a WhatsApp Business Account connected.
</Note>

## Using Senders in Messages

Specify a sender when sending a message:

```php theme={null}
$result = $client->messages->send([
    'to' => '+14155551234',
    'text' => 'Hello!',
    'Zavu-Sender' => 'snd_abc123',
]);
```

If no sender is specified, the default sender is used.
