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()
for sender in result.items:
print(sender.id, sender.name, sender.phone_number)
if sender.is_default:
print("(Default sender)")
# With pagination
result = client.senders.list(
limit=50,
cursor="cursor_xxx"
)
Get Sender
result = client.senders.get(sender_id="snd_abc123")
print(result.id)
print(result.name)
print(result.phone_number)
print(result.is_default)
Create Sender
result = client.senders.create(
name="Marketing",
phone_number="+15551234567",
set_as_default=True
)
print(result.id) # snd_xxx
With Webhook
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 and result.webhook.secret:
print(f"Save this secret: {result.webhook.secret}")
Update Sender
result = client.senders.update(
sender_id="snd_abc123",
name="Support",
set_as_default=True
)
Update Webhook Configuration
result = client.senders.update(
sender_id="snd_abc123",
webhook_url="https://new-url.com/webhooks",
webhook_events=["message.inbound"],
webhook_active=True
)
Disable Webhook
result = client.senders.update(
sender_id="snd_abc123",
webhook_active=False
)
Remove Webhook
result = client.senders.update(
sender_id="snd_abc123",
webhook_url=None
)
Delete Sender
client.senders.delete(sender_id="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.regenerate_webhook_secret(
sender_id="snd_abc123"
)
print(f"New secret: {result.secret}")
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.get_profile(sender_id="snd_abc123")
print(response.profile.about)
print(response.profile.description)
print(response.profile.address)
print(response.profile.email)
print(response.profile.websites)
print(response.profile.vertical)
print(response.profile.profile_picture_url)
Update Profile
response = client.senders.update_profile(
sender_id="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.upload_profile_picture(
sender_id="snd_abc123",
image_url="https://example.com/logo.png",
mime_type="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.