broadcast-campaign
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseBroadcast Campaign
广播营销活动
When to Use
使用场景
Use this skill when building code to send messages to multiple recipients in a campaign — including bulk email. Covers the full broadcast lifecycle from creation to monitoring.
当你需要编写代码向活动中的多个接收者发送消息(包括批量邮件)时,可使用此技能。覆盖从创建到监控的完整广播生命周期。
Broadcast Lifecycle
广播生命周期
draft -> pending_review -> approved -> sending -> completed
-> rejected -> (edit) -> pending_review (retry, max 3)
-> rejected -> escalated (manual review by Zavu team)
-> rejected_final
approved -> scheduled -> sending -> completed
sending -> paused (can resume)
(any active) -> cancelled
(any) -> failed (permanent failure)draft -> pending_review -> approved -> sending -> completed
-> rejected -> (edit) -> pending_review (retry, max 3)
-> rejected -> escalated (manual review by Zavu team)
-> rejected_final
approved -> scheduled -> sending -> completed
sending -> paused (can resume)
(any active) -> cancelled
(any) -> failed (permanent failure)Step-by-Step Workflow
分步工作流程
1. Create Broadcast
1. 创建广播活动
typescript
const result = await zavu.broadcasts.create({
name: "Black Friday Sale",
channel: "sms", // smart | sms | sms_oneway | whatsapp | telegram | email | instagram | voice
text: "Hi {{name}}, check out our Black Friday deals! Code: FRIDAY20",
});
const broadcastId = result.broadcast.id; // brd_xxxPython:
python
result = zavu.broadcasts.create(
name="Black Friday Sale",
channel="sms",
text="Hi {{name}}, check out our Black Friday deals! Code: FRIDAY20",
)
broadcast_id = result.broadcast.idGo:
go
result, err := client.Broadcasts.Create(context.TODO(), zavudev.BroadcastCreateParams{
Name: zavudev.String("Black Friday Sale"),
Channel: zavudev.String("sms"),
Text: zavudev.String("Hi {{name}}, check out our Black Friday deals! Code: FRIDAY20"),
})
broadcastID := result.Broadcast.IDRuby:
ruby
result = client.broadcasts.create(
name: "Black Friday Sale",
channel: "sms",
text: "Hi {{name}}, check out our Black Friday deals! Code: FRIDAY20",
)
broadcast_id = result.broadcast.idPHP:
php
$result = $client->broadcasts->create([
'name' => 'Black Friday Sale',
'channel' => 'sms',
'text' => 'Hi {{name}}, check out our Black Friday deals! Code: FRIDAY20',
]);
$broadcastId = $result->broadcast->id;typescript
const result = await zavu.broadcasts.create({
name: "Black Friday Sale",
channel: "sms", // smart | sms | sms_oneway | whatsapp | telegram | email | instagram | voice
text: "Hi {{name}}, check out our Black Friday deals! Code: FRIDAY20",
});
const broadcastId = result.broadcast.id; // brd_xxxPython:
python
result = zavu.broadcasts.create(
name="Black Friday Sale",
channel="sms",
text="Hi {{name}}, check out our Black Friday deals! Code: FRIDAY20",
)
broadcast_id = result.broadcast.idGo:
go
result, err := client.Broadcasts.Create(context.TODO(), zavudev.BroadcastCreateParams{
Name: zavudev.String("Black Friday Sale"),
Channel: zavudev.String("sms"),
Text: zavudev.String("Hi {{name}}, check out our Black Friday deals! Code: FRIDAY20"),
})
broadcastID := result.Broadcast.IDRuby:
ruby
result = client.broadcasts.create(
name: "Black Friday Sale",
channel: "sms",
text: "Hi {{name}}, check out our Black Friday deals! Code: FRIDAY20",
)
broadcast_id = result.broadcast.idPHP:
php
$result = $client->broadcasts->create([
'name' => 'Black Friday Sale',
'channel' => 'sms',
'text' => 'Hi {{name}}, check out our Black Friday deals! Code: FRIDAY20',
]);
$broadcastId = $result->broadcast->id;Channel Options
渠道选项
| Channel | Description |
|---|---|
| Per-contact intelligent routing |
| SMS to all contacts |
| One-way SMS (no replies) |
| WhatsApp (requires template for non-window contacts) |
| Telegram |
| Email (requires KYC, needs |
| Instagram Direct |
| Voice call with text-to-speech |
| 渠道 | 描述 |
|---|---|
| 针对每个联系人的智能路由 |
| 向所有联系人发送短信 |
| 单向短信(不接收回复) |
| WhatsApp(对非窗口联系人需使用模板) |
| Telegram |
| 邮件(需完成KYC,需指定 |
| Instagram私信 |
| 带文本转语音功能的语音通话 |
Message Types
消息类型
| Type | Description |
|---|---|
| Plain text (default) |
| Image with optional caption |
| Video message |
| Audio message |
| Document file |
| WhatsApp pre-approved template |
| 类型 | 描述 |
|---|---|
| 纯文本(默认) |
| 图片(可附带说明文字) |
| 视频消息 |
| 音频消息 |
| 文档文件 |
| WhatsApp预审批模板 |
Email Broadcast (with HTML body)
邮件广播(含HTML正文)
For bulk email campaigns, use with an HTML body. This is the recommended way to send mass email through Zavu.
channel: "email"typescript
const result = await zavu.broadcasts.create({
name: "Newsletter",
channel: "email",
emailSubject: "Special offer for {{name}}",
text: "Hi {{name}}, check out our latest sale!", // plain text fallback
emailHtmlBody: "<h1>Hi {{name}}!</h1><p>Check out our latest sale.</p>",
metadata: { campaign_id: "camp_123", region: "US" },
});对于批量邮件活动,请使用并搭配HTML正文。这是通过Zavu发送批量邮件的推荐方式。
channel: "email"typescript
const result = await zavu.broadcasts.create({
name: "Newsletter",
channel: "email",
emailSubject: "Special offer for {{name}}",
text: "Hi {{name}}, check out our latest sale!", // 纯文本备选内容
emailHtmlBody: "<h1>Hi {{name}}!</h1><p>Check out our latest sale.</p>",
metadata: { campaign_id: "camp_123", region: "US" },
});2. Add Contacts (batch, max 1000/request)
2. 添加联系人(批量,每次请求最多1000个)
typescript
const result = await zavu.broadcasts.contacts.add({
broadcastId: broadcastId,
contacts: [
{ recipient: "+14155551234", templateVariables: { name: "John" } },
{ recipient: "+14155555678", templateVariables: { name: "Jane" } },
],
});
console.log(result.added, result.duplicates, result.invalid);typescript
const result = await zavu.broadcasts.contacts.add({
broadcastId: broadcastId,
contacts: [
{ recipient: "+14155551234", templateVariables: { name: "John" } },
{ recipient: "+14155555678", templateVariables: { name: "Jane" } },
],
});
console.log(result.added, result.duplicates, result.invalid);3. Send (triggers AI content review)
3. 发送(触发AI内容审核)
typescript
// Send immediately
await zavu.broadcasts.send({ broadcastId });
// Or schedule
await zavu.broadcasts.send({
broadcastId,
scheduledAt: "2024-01-15T10:00:00Z",
});typescript
// 立即发送
await zavu.broadcasts.send({ broadcastId });
// 或定时发送
await zavu.broadcasts.send({
broadcastId,
scheduledAt: "2024-01-15T10:00:00Z",
});4. Monitor Progress
4. 监控进度
typescript
const progress = await zavu.broadcasts.progress({ broadcastId });
console.log(`${progress.percentComplete}% complete`);
console.log(`Delivered: ${progress.delivered}, Failed: ${progress.failed}, Skipped: ${progress.skipped}`);
console.log(`Estimated completion: ${progress.estimatedCompletionAt}`);Per-contact statuses: , , , , , (excluded — opted out, duplicate, or invalid).
pendingqueuedsendingdeliveredfailedskippedtypescript
const progress = await zavu.broadcasts.progress({ broadcastId });
console.log(`${progress.percentComplete}% complete`);
console.log(`Delivered: ${progress.delivered}, Failed: ${progress.failed}, Skipped: ${progress.skipped}`);
console.log(`Estimated completion: ${progress.estimatedCompletionAt}`);单联系人状态:(待处理)、(已排队)、(发送中)、(已送达)、(发送失败)、(已跳过——退订、重复或无效联系人)。
pendingqueuedsendingdeliveredfailedskipped5. Handle Rejection (if content review fails)
5. 处理审核驳回(若内容审核未通过)
typescript
// Check remaining review attempts
const broadcast = await zavu.broadcasts.get({ broadcastId });
console.log(`Review attempts: ${broadcast.reviewAttempts}/3`);
// Edit content
await zavu.broadcasts.update({
broadcastId,
text: "Updated message content with {{name}}",
});
// Retry review (max 3 attempts)
await zavu.broadcasts.retryReview({ broadcastId });
// Or escalate to manual review
await zavu.broadcasts.escalate({ broadcastId });typescript
// 查看剩余审核重试次数
const broadcast = await zavu.broadcasts.get({ broadcastId });
console.log(`Review attempts: ${broadcast.reviewAttempts}/3`);
// 编辑内容
await zavu.broadcasts.update({
broadcastId,
text: "Updated message content with {{name}}",
});
// 重试审核(最多3次)
await zavu.broadcasts.retryReview({ broadcastId });
// 或升级至人工审核
await zavu.broadcasts.escalate({ broadcastId });Other Operations
其他操作
typescript
// Reschedule
await zavu.broadcasts.reschedule({
broadcastId, scheduledAt: "2024-01-16T14:00:00Z",
});
// Cancel (pending contacts skipped, queued may still deliver)
await zavu.broadcasts.cancel({ broadcastId });
// List contacts in broadcast
const contacts = await zavu.broadcasts.contacts.list({
broadcastId, status: "delivered", limit: 100,
});
// Delete (draft only)
await zavu.broadcasts.delete({ broadcastId });typescript
// 重新定时
await zavu.broadcasts.reschedule({
broadcastId, scheduledAt: "2024-01-16T14:00:00Z",
});
// 取消(待处理联系人将被跳过,已排队的消息可能仍会送达)
await zavu.broadcasts.cancel({ broadcastId });
// 列出广播活动中的联系人
const contacts = await zavu.broadcasts.contacts.list({
broadcastId, status: "delivered", limit: 100,
});
// 删除(仅草稿状态的活动可删除)
await zavu.broadcasts.delete({ broadcastId });Template Variables
模板变量
Use in broadcast text. Override per-contact via :
{{variable_name}}templateVariablestypescript
await zavu.broadcasts.contacts.add({
broadcastId,
contacts: [
{ recipient: "+14155551234", templateVariables: { name: "John", order_id: "ORD-001" } },
],
});在广播文本中使用。可通过为单个联系人覆盖变量:
{{variable_name}}templateVariablestypescript
await zavu.broadcasts.contacts.add({
broadcastId,
contacts: [
{ recipient: "+14155551234", templateVariables: { name: "John", order_id: "ORD-001" } },
],
});Constraints
限制条件
- Max 1000 contacts per request (batch for larger lists)
add - Content goes through AI review before sending
- Balance is reserved (estimated cost) when sending
- Max 3 review retry attempts, then escalate
- Can only update/delete broadcasts in status
draft - Cancelling doesn't stop already-queued messages
- 每次请求最多添加1000个联系人(更大列表需分批处理)
add - 内容发送前需经过AI审核
- 发送时会预留余额(预估成本)
- 最多可重试审核3次,之后需升级至人工审核
- 仅状态的广播活动可更新/删除
draft - 取消操作无法停止已排队的消息