> ## 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 TypeScript SDK

> Create, update and list sender profiles via the Zavu TypeScript 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

```typescript theme={null}
const result = await client.senders.list({});

for (const sender of result.items) {
  console.log(sender.id, sender.name, sender.phoneNumber);
  if (sender.isDefault) {
    console.log("(Default sender)");
  }
}

// With pagination
const result = await client.senders.list({
  limit: 50,
  cursor: "cursor_xxx",
});
```

## Get Sender

```typescript theme={null}
const result = await client.senders.get({
  senderId: "snd_abc123",
});

console.log(result.id);
console.log(result.name);
console.log(result.phoneNumber);
console.log(result.isDefault);
```

## Create Sender

```typescript theme={null}
const result = await client.senders.create({
  name: "Marketing",
  phoneNumber: "+15551234567",
  setAsDefault: true,
});

console.log(result.id); // snd_xxx
```

### With Webhook

```typescript theme={null}
const result = await 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) {
  console.log("Save this secret:", result.webhook.secret);
}
```

## Update Sender

```typescript theme={null}
const result = await client.senders.update({
  senderId: "snd_abc123",
  name: "Support",
  setAsDefault: true,
});
```

### Update Webhook Configuration

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

### Disable Webhook

```typescript theme={null}
const result = await client.senders.update({
  senderId: "snd_abc123",
  webhookActive: false,
});
```

### Remove Webhook

```typescript theme={null}
const result = await client.senders.update({
  senderId: "snd_abc123",
  webhookUrl: null,
});
```

## Delete Sender

```typescript theme={null}
await 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:

```typescript theme={null}
const result = await client.senders.regenerateWebhookSecret({
  senderId: "snd_abc123",
});

console.log("New secret:", result.secret);
```

<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

```typescript theme={null}
const response = await client.senders.getProfile("snd_abc123");

console.log(response.profile.about);
console.log(response.profile.description);
console.log(response.profile.address);
console.log(response.profile.email);
console.log(response.profile.websites);
console.log(response.profile.vertical);
console.log(response.profile.profilePictureUrl);
```

### Update Profile

```typescript theme={null}
const response = await 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

```typescript theme={null}
const response = await 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:

```typescript theme={null}
const result = await client.messages.send({
  to: "+14155551234",
  text: "Hello!",
  'Zavu-Sender': "snd_abc123",
});
```

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