Campaign Orchestrator Skill
Multi-channel follow-up campaign orchestrator for ShapeScale sales. Executes scheduled SMS + Email sequences with CRM integration and auto-termination on replies.
Overview
A Campaign is a defined sequence of steps (SMS/Email) that executes over time. When a lead replies to any message, the campaign automatically terminates.
Key Features
- - Multi-channel: SMS (Dialpad) + Email (Gmail)
- Scheduled: Cron-based execution with configurable delays
- Personalized: Templates filled from Attio CRM data
- Auto-terminating: Replies stop all future scheduled steps
- Logged: All activities recorded in Attio
Setup
Environment variables required:
CODEBLOCK0
Also ensure:
- - Dialpad webhook is configured to hit this server
- Attio has company/contact records for leads
- Gmail API access enabled for sales email
Usage
Start a Campaign
CODEBLOCK1
Pre-Campaign Checklist (MANDATORY)
Before starting ANY campaign, verify:
- 1. Customer Status Check
- Search memory/CRM for "already a customer" or "purchased" flags
- Check exclusion list in campaigns.json
- Verify email domain not in customer database
- 2. Email Formatting Check (for email steps)
- Preview template renders as proper paragraphs
- 2-4 sentences per paragraph, blank line between
- No single-sentence orphan paragraphs
- No hard line breaks mid-paragraph
- 3. Tone Check
- No apologetic language ("no worries", "sorry to bother")
- No easy outs ("if not relevant, no problem")
- Professional, not needy
NEVER campaign to existing customers unless explicitly requested for upsell.
Check Campaign Status
CODEBLOCK2
Stop a Campaign
CODEBLOCK3
Remove a Lead
CODEBLOCK4
Check for Responses
CODEBLOCK5
View Pending Steps
CODEBLOCK6
Template Management
CODEBLOCK7
Campaign Templates
| Template | Timing | Channel | Purpose |
|---|
| INLINECODE0 | +4 hours | SMS | Recap demo, share recording |
| INLINECODE1 |
+1 day | Email | Pricing, detailed ROI |
|
tertiary | +4 days | SMS | Quick check-in |
|
quaternary | +7 days | Email | Final follow-up, case study |
|
post-demo | +0 hours | SMS | Immediate thank you |
Template Variables
Templates support variable substitution:
CODEBLOCK8
Architecture
CODEBLOCK9
State Management
Campaign state is stored in <workspace>/state/campaigns.json:
CODEBLOCK10
Cron Integration
Campaign steps are executed via Clawdbot's cron system:
- - Executor job: Runs every 5 minutes to check for due steps
- Per-campaign jobs: Created for each scheduled step
The scheduler script creates and manages these jobs automatically.
Webhook Handling
When Dialpad receives a reply to a campaign message:
- 1. Dialpad sends webhook to server
- INLINECODE6 parses the reply
- Looks up which campaign the original message belonged to
- Marks campaign as terminated
- Logs the reply to Attio
Integration Points
Dialpad SMS
CODEBLOCK11
Gmail (via gog)
CODEBLOCK12
Attio CRM
CODEBLOCK13
Examples
Full Campaign Workflow
CODEBLOCK14
Monitoring Active Campaigns
CODEBLOCK15
Troubleshooting
Campaign not sending:
- - Check
cron is running: INLINECODE8 - Check logs:
journalctl -u moltbot or campaign logs - Verify API keys: INLINECODE10
Webhook not terminating:
- - Verify Dialpad webhook URL is configured
- Check webhook handler is running
- Check
campaigns.json for matching lead
Template variables not filling:
- - Verify lead exists in Attio with required fields
- Check template syntax:
{variable} not INLINECODE13
License
Part of shapescale-moltbot-skills. See parent repository.
活动编排技能
用于ShapeScale销售的多渠道跟进活动编排器。执行定时短信+邮件序列,集成CRM系统,并在收到回复时自动终止。
概述
活动是一系列按时间执行的步骤(短信/邮件)的预定义序列。当潜在客户回复任何消息时,活动会自动终止。
主要功能
- - 多渠道:短信(Dialpad)+ 邮件(Gmail)
- 定时执行:基于Cron的执行机制,支持可配置延迟
- 个性化:从Attio CRM数据填充模板
- 自动终止:回复将停止所有未来的计划步骤
- 日志记录:所有活动记录在Attio中
设置
所需环境变量:
bash
DIALPADAPIKEY=你的Dialpad API密钥
ATTIOAPIKEY=你的Attio API密钥
GOGKEYRINGPASSWORD=你的Google密码 # 用于Gmail访问
还需确保:
- - Dialpad webhook已配置指向此服务器
- Attio中有潜在客户的公司/联系人记录
- 已为销售邮件启用Gmail API访问
使用方法
启动活动
bash
为潜在客户启动主要跟进活动
python3 campaign.py start primary --lead Apex Fitness
使用自定义延迟覆盖(小时)
python3 campaign.py start primary --lead Apex Fitness --delay 2
使用Attio交易/公司ID启动
python3 campaign.py start post-demo --lead Apex Fitness --attio-id deal-uuid
活动前检查清单(必做)
在启动任何活动之前,请验证:
- 1. 客户状态检查
- 在记忆/CRM中搜索已是客户或已购买标记
- 检查campaigns.json中的排除列表
- 验证邮件域名不在客户数据库中
- 2. 邮件格式检查(针对邮件步骤)
- 预览模板渲染为正确的段落格式
- 每段2-4句话,段落间空行
- 无单句孤立段落
- 段落中间无硬换行
- 3. 语气检查
- 无道歉性语言(别担心、抱歉打扰)
- 无轻易放弃的措辞(如果不相关,没关系)
- 专业,而非迫切
除非明确要求进行追加销售,否则切勿向现有客户发送活动。
检查活动状态
bash
特定潜在客户的状态
python3 campaign.py status Apex Fitness
所有活跃活动
python3 campaign.py list
停止活动
bash
手动终止(潜在客户已回复、不感兴趣等)
python3 campaign.py stop Apex Fitness --reason replied_interested
移除潜在客户
bash
从活动中移除潜在客户(已选择退出、不感兴趣)
python3 campaign.py remove Apex Fitness
检查回复
bash
检查潜在客户是否回复了之前的任何消息
python3 campaign.py check Apex Fitness
显示每个已完成步骤的回复状态
如果检测到回复则发出警告(可安全继续或终止)
查看待处理步骤
bash
按时间排序显示所有待处理的活动步骤
python3 campaign.py pending
用于查看所有活动中即将到期的步骤
模板管理
bash
列出可用模板
python3 campaign.py templates
预览模板
python3 campaign.py preview primary
活动模板
| 模板 | 时间 | 渠道 | 目的 |
|---|
| primary | +4小时 | 短信 | 回顾演示,分享录制 |
| secondary |
+1天 | 邮件 | 定价,详细ROI |
| tertiary | +4天 | 短信 | 快速跟进 |
| quaternary | +7天 | 邮件 | 最终跟进,案例研究 |
| post-demo | +0小时 | 短信 | 即时感谢 |
模板变量
模板支持变量替换:
{name} - 潜在客户名字
{company} - 公司名称
{deal_value} - Attio中的交易价值
{owner} - 销售负责人姓名
{demo_notes} - 演示对话记录
{checkout_link} - 个性化结账链接
架构
campaign-orchestrator/
├── SKILL.md # 本文件
├── campaign.py # 主CLI(启动、停止、状态、列表)
├── webhook_handler.py # 处理回复→终止
├── primary.md # 短信跟进模板
├── secondary.md # 邮件模板
├── post-demo.md # 即时跟进模板
└── state/
└── campaigns.json # 活动状态持久化
状态管理
活动状态存储在/state/campaigns.json中:
json
{
campaigns: {
Apex Fitness: {
template: primary,
attio_id: deal-uuid,
started: 2026-01-27T13:00:00Z,
stepscompleted: [smsprimary],
nextstep: emailsecondary,
next_scheduled: 2026-01-28T13:00:00Z,
status: active
}
},
templates: {
primary: {...},
secondary: {...}
}
}
Cron集成
活动步骤通过Clawdbot的cron系统执行:
- - 执行器任务:每5分钟运行一次,检查到期的步骤
- 每个活动的任务:为每个计划步骤创建
调度脚本自动创建和管理这些任务。
Webhook处理
当Dialpad收到活动消息的回复时:
- 1. Dialpad向服务器发送webhook
- webhook_handler.py解析回复
- 查找原始消息所属的活动
- 将活动标记为已终止
- 将回复记录到Attio
集成点
Dialpad短信
bash
python3 /home/art/niemand/skills/dialpad/send_sms.py --to +14155551234 --message ...
Gmail(通过gog)
bash
gog-shapescale --account martin@shapescale.com send-email --to lead@company.com --subject ... --body ...
Attio CRM
bash
attio note companies company-uuid 活动消息已发送:{message}
示例
完整活动工作流程
bash
1. 演示后,启动活动
/campaign start post-demo --lead Dr. Smiths Clinic
2. 第二天检查状态
/campaign status Dr. Smiths Clinic
输出:步骤1已发送,步骤2计划明天发送
3. 潜在客户回复感兴趣
Webhook自动终止活动
将回复记录到Attio
4. 如需手动跟进
/campaign start secondary --lead Dr. Smiths Clinic --delay 0
监控活跃活动
bash
列出所有活跃活动
/campaign list
输出:
活跃活动:
- Apex Fitness (primary) - 步骤2/4,下一步:邮件
- Dr. Smiths Clinic (post-demo) - 已完成
- Wellness Center (tertiary) - 步骤1/3,下一步:短信
故障排除
活动未发送:
- - 检查cron是否运行:crontab -l
- 检查日志:journalctl -u moltbot或活动日志
- 验证API密钥:echo $DIALPADAPIKEY
Webhook未终止:
- - 验证Dialpad webhook URL已配置
- 检查webhook处理程序是否运行
- 检查campaigns.json中是否有匹配的潜在客户
模板变量未填充:
- - 验证潜在客户在Attio中存在且包含必填字段
- 检查模板语法:{variable}而非{ variable }
许可证
属于shapescale-moltbot-skills的一部分。请参阅父仓库。