WhatsApp 与 SMS 通知
针对订单事件、弃购购物车等发送 WhatsApp 或 SMS 通知。
概述
流程:
- 管理员在 Settings 中配置 gateway URLs。
- 管理员在 Products → Notifications(或类似)中创建 notification templates。
- 当 triggers 触发(如 order placed、invoice paid、abandoned cart)时,模块向 gateway 发送请求。
- Gateway 通过 WhatsApp 或 SMS 交付消息。
配置
Gateway URLs
- 前往 Setup → Settings → Products。
- 在 WhatsApp / SMS Notifications 下:
- 启用该功能。
- 输入 SMS Gateway URL - SMS 提供商的 webhook/API 端点。
- 输入 WhatsApp Gateway URL - WhatsApp 提供商的 webhook/API 端点。
- 保存。
每模板覆盖
每个通知模板可使用 global gateway 或 custom webhook URL。
创建通知模板
- 前往 Products → Notifications(或 Product Notifications)。
- 点击 New Notification。
- 配置:
| 字段 | 描述 |
|---|---|
| Name | 内部名称 |
| Channel | WhatsApp 或 SMS |
| Trigger | abandoned_cart、order_placed、order_paid |
| Recipient | client 或 staff |
| Message template | 带 merge fields 的文本 |
| Webhook URL | 覆盖全局(可选) |
| Webhook method | POST 或 GET |
| Webhook body | API 的 JSON 模板 |
- 保存。
Merge Fields
在消息模板中使用以下占位符:
| 字段 | 描述 |
|---|---|
| {companyname} | 您的公司名称 |
| {cart_link} | 结账链接 |
| {cart_total} | 购物车总额(弃购购物车) |
| {client_name} | 客户姓名 |
| {contact_phonenumber} | 电话号码 |
| {order_id} | Order ID |
| {order_date} | 订单日期 |
| {total} | 订单总额 |
| {invoice_number} | 发票号码 |
| {invoice_link} | 发票链接 |
Trigger 事件
- abandoned_cart - 当 cron 发送弃购购物车提醒时。
- order_placed - 创建订单/发票时。
- order_paid - 发票标记为已支付时。
Webhook Body
默认 body 格式通常为:
{"to":"{contact_phonenumber}","body":"{message}"}
{message} 占位符会被渲染后的消息替换(JSON 编码)。根据您的 gateway API 要求调整 body 模板。