> ## 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.

# Senders

> Manage sender profiles with the Ruby SDK

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

## List Senders

```ruby theme={null}
result = client.senders.list

result.items.each do |sender|
  puts "#{sender.id} #{sender.name} #{sender.phone_number}"
  puts "(Default sender)" if sender.is_default
end

# With pagination
result = client.senders.list(
  limit: 50,
  cursor: "cursor_xxx"
)
```

## Get Sender

```ruby theme={null}
result = client.senders.get(sender_id: "snd_abc123")

puts result.id
puts result.name
puts result.phone_number
puts result.is_default
```

## Create Sender

```ruby theme={null}
result = client.senders.create(
  name: "Marketing",
  phone_number: "+15551234567",
  set_as_default: true
)

puts result.id # snd_xxx
```

### With Webhook

```ruby theme={null}
result = client.senders.create(
  name: "Marketing",
  phone_number: "+15551234567",
  webhook_url: "https://your-app.com/webhooks",
  webhook_events: ["message.inbound", "message.delivered", "message.failed"]
)

# Webhook secret is only returned on create
if result.webhook&.secret
  puts "Save this secret: #{result.webhook.secret}"
end
```

## Update Sender

```ruby theme={null}
result = client.senders.update(
  sender_id: "snd_abc123",
  name: "Support",
  set_as_default: true
)
```

### Update Webhook Configuration

```ruby theme={null}
result = client.senders.update(
  sender_id: "snd_abc123",
  webhook_url: "https://new-url.com/webhooks",
  webhook_events: ["message.inbound"],
  webhook_active: true
)
```

### Disable Webhook

```ruby theme={null}
result = client.senders.update(
  sender_id: "snd_abc123",
  webhook_active: false
)
```

### Remove Webhook

```ruby theme={null}
result = client.senders.update(
  sender_id: "snd_abc123",
  webhook_url: nil
)
```

## Delete Sender

```ruby theme={null}
client.senders.delete(sender_id: "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:

```ruby theme={null}
result = client.senders.regenerate_webhook_secret(
  sender_id: "snd_abc123"
)

puts "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

```ruby theme={null}
response = client.senders.get_profile("snd_abc123")

puts response.profile.about
puts response.profile.description
puts response.profile.address
puts response.profile.email
puts response.profile.websites
puts response.profile.vertical
puts response.profile.profile_picture_url
```

### Update Profile

```ruby theme={null}
response = client.senders.update_profile("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

```ruby theme={null}
response = client.senders.upload_profile_picture("snd_abc123",
  image_url: "https://example.com/logo.png",
  mime_type: "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:

```ruby theme={null}
result = client.messages.send(
  to: "+14155551234",
  text: "Hello!",
  zavu_sender: "snd_abc123"
)
```

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