跳到主要内容

WhatsApp 与 SMS 通知

针对订单事件、弃购购物车等发送 WhatsApp 或 SMS 通知。


概述

流程:

  1. 管理员在 Settings 中配置 gateway URLs
  2. 管理员在 Products → Notifications(或类似)中创建 notification templates
  3. 当 triggers 触发(如 order placed、invoice paid、abandoned cart)时,模块向 gateway 发送请求。
  4. Gateway 通过 WhatsApp 或 SMS 交付消息。

配置

Gateway URLs

  1. 前往 Setup → Settings → Products
  2. WhatsApp / SMS Notifications 下:
    • 启用该功能。
    • 输入 SMS Gateway URL - SMS 提供商的 webhook/API 端点。
    • 输入 WhatsApp Gateway URL - WhatsApp 提供商的 webhook/API 端点。
  3. 保存。

每模板覆盖

每个通知模板可使用 global gatewaycustom webhook URL


创建通知模板

  1. 前往 Products → Notifications(或 Product Notifications)。
  2. 点击 New Notification
  3. 配置:
字段描述
Name内部名称
ChannelWhatsApp 或 SMS
Triggerabandoned_cart、order_placed、order_paid
Recipientclient 或 staff
Message template带 merge fields 的文本
Webhook URL覆盖全局(可选)
Webhook methodPOST 或 GET
Webhook bodyAPI 的 JSON 模板
  1. 保存。

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 模板。