whatsapp-automation

whatsapp-automation

热门

WhatsApp Business 自动化 - 客户支持、通知、聊天机器人和广播消息

306Star
68Fork
更新于 2026/1/31
SKILL.md
只读
名称
whatsapp-automation
描述

WhatsApp Business 自动化 - 客户支持、通知、聊天机器人和广播消息

版本
1.0.0

WhatsApp 自动化

自动化 WhatsApp Business 通信,包括客户支持、通知、聊天机器人和广播消息。基于 n8n 的 WhatsApp 集成模板。

概述

本技能涵盖:

  • WhatsApp Business API 设置
  • 自动化聊天机器人流程
  • 订单/发货通知
  • 客户支持自动化
  • 广播消息

设置与配置

WhatsApp Business API

setup_requirements:
  1. meta_business_account:
      - 在 business.facebook.com 创建
      - 验证企业
      
  2. whatsapp_business_api:
      - 通过 Meta 开发者门户访问
      - 创建 WhatsApp Business 应用
      - 获取电话号码 ID
      - 获取访问令牌
      
  3. webhook_configuration:
      - 设置回调 URL
      - 验证令牌
      - 订阅消息
      
  4. message_templates:
      - 在 Business Manager 中创建模板
      - 等待审批(24-48 小时)

消息模板

template_categories:
  transactional:
    - order_confirmation
    - shipping_update
    - delivery_notification
    - appointment_reminder
    
  marketing:
    - promotional_offer
    - product_launch
    - newsletter
    
  utility:
    - account_verification
    - password_reset
    - payment_reminder
    
template_example:
  name: "order_confirmation"
  language: "en"
  category: "TRANSACTIONAL"
  components:
    - type: HEADER
      format: TEXT
      text: "订单已确认!🎉"
      
    - type: BODY
      text: |
        您好 {{1}},
        
        您的订单 #{{2}} 已确认!
        
        商品:{{3}}
        总计:{{4}}
        
        我们会在发货时通知您。
        
    - type: FOOTER
      text: "回复 HELP 获取支持"
      
    - type: BUTTONS
      buttons:
        - type: URL
          text: "追踪订单"
          url: "https://example.com/track/{{1}}"

聊天机器人流程

客户支持机器人

chatbot_flow:
  name: "客户支持"
  
  welcome:
    trigger: first_message
    response: |
      👋 欢迎来到 {Company} 支持!
      
      今天我能为您做什么?
      
      1️⃣ 追踪订单
      2️⃣ 退货/换货
      3️⃣ 产品咨询
      4️⃣ 转接人工客服
      
      回复数字继续。
      
  flows:
    track_order:
      trigger: "1" OR "track" OR "order"
      steps:
        - ask: "请输入您的订单号:"
        - validate: order_number_format
        - lookup: order_status
        - respond: |
            📦 *订单 #{order_number}*
            
            状态:{status}
            {if_shipped: 追踪号:{tracking_number}}
            预计送达:{eta}
            
            [追踪包裹]({tracking_url})
            
    return_exchange:
      trigger: "2" OR "return" OR "exchange"
      steps:
        - ask: "要退货的订单号?"
        - check: return_eligibility
        - if_eligible:
            respond: return_instructions
        - if_not:
            respond: contact_support
            
    product_questions:
      trigger: "3" OR "product" OR "question"
      steps:
        - ai_response:
            model: gpt-4
            context: product_faq_knowledge_base
            
    agent_handoff:
      trigger: "4" OR "agent" OR "human"
      steps:
        - check: agent_availability
        - if_available:
            transfer: to_live_agent
            notify: "#support-queue"
        - if_unavailable:
            respond: "我们的团队目前不在线。请留言,我们会在 24 小时内回复您。"
            create: support_ticket

AI 驱动回复

ai_chatbot:
  model: gpt-4
  
  system_prompt: |
    您是 {Company} 的 WhatsApp 客户支持代理。
    
    指南:
    - 乐于助人且友好
    - 回复简洁(WhatsApp 偏好短消息)
    - 适当使用表情符号
    - 如果无法帮助,提供转接人工客服
    - 切勿编造关于订单或产品的信息
    
    您可以访问:
    - 订单查询
    - 产品目录
    - 常见问题知识库
    
  tools:
    - lookup_order: 按订单号查询
    - search_products: 按关键词搜索
    - check_inventory: 按产品 ID 检查库存
    - create_ticket: 处理复杂问题
    
  escalation_triggers:
    - sentiment: very_negative
    - keywords: ["投诉", "退款", "生气", "起诉"]
    - loop_detected: 同一问题重复 3 次

通知工作流

订单通知

order_notifications:
  order_placed:
    trigger: shopify_order_created
    template: order_confirmation
    variables:
      - customer_name
      - order_number
      - items_summary
      - total_amount
      
  payment_received:
    trigger: payment_captured
    message: |
      ✅ 订单 #{order_number} 的付款已收到!
      
      金额:{amount}
      
      我们正在为您准备订单。
      
  shipped:
    trigger: fulfillment_created
    template: shipping_update
    variables:
      - tracking_number
      - carrier
      - estimated_delivery
      
  out_for_delivery:
    trigger: tracking_status_change
    condition: status == "out_for_delivery"
    message: |
      🚚 您的订单正在派送中!
      
      预计今天 {eta} 前送达。
      
      实时追踪:{tracking_url}
      
  delivered:
    trigger: tracking_status_change
    condition: status == "delivered"
    message: |
      📦 您的订单已送达!
      
      希望您喜欢!
      
      [留下评价]({review_url})
      [需要帮助?]({support_url})

预约提醒

appointment_reminders:
  schedule:
    - 24_hours_before
    - 1_hour_before
    
  template: appointment_reminder
  
  24h_message: |
    📅 *预约提醒*
    
    您好 {name},
    
    您明天有一个预约:
    
    📍 {location}
    🕐 {time}
    👤 {provider}
    
    回复:
    ✅ CONFIRM 确认
    ❌ CANCEL 取消
    📅 RESCHEDULE 改期
    
  1h_message: |
    ⏰ 您的预约还有 1 小时!
    
    {provider} 在 {location}
    
    不见不散!

广播消息

活动管理

broadcast_campaigns:
  setup:
    - import_contacts: from_crm
    - segment_audience: by_criteria
    - create_template: get_approval
    - schedule_send
    
  targeting_options:
    - all_contacts
    - by_tag: [vip, new_customer, inactive]
    - by_purchase_history
    - by_location
    - custom_segment
    
  compliance:
    - opt_in_required: true
    - opt_out_easy: reply_STOP
    - frequency_limits: per_contact_per_day
    - quiet_hours: respect_timezone
    
  tracking:
    - delivered
    - read
    - replied
    - clicked_link
    - opted_out

活动模板

campaign_templates:
  promotional:
    template: |
      🎉 *为您准备的特别优惠!*
      
      您好 {name},
      
      {offer_description}
      
      使用优惠码:{promo_code}
      有效期至:{expiry}
      
      [立即购买]({url})
      
      回复 STOP 取消订阅
      
  product_launch:
    template: |
      🚀 *新品到货提醒*
      
      {name},来看看我们的最新产品:
      
      {product_name}
      {product_description}
      
      {price}
      
      [查看产品]({url})
      
  reengagement:
    template: |
      👋 *我们想念您,{name}!*
      
      距离您上次访问已经有一段时间了。
      
      这是为您准备的 15% 折扣,欢迎回来:
      
      优惠码:COMEBACK15
      
      [立即购买]({url})

n8n 集成

工作流示例

workflow: "WhatsApp 订单机器人"

nodes:
  - name: "WhatsApp 触发器"
    type: "n8n-nodes-base.whatsAppTrigger"
    parameters:
      events: ["messages"]
      
  - name: "解析消息"
    type: "n8n-nodes-base.code"
    parameters:
      code: |
        const message = $input.first().json;
        return {
          from: message.from,
          text: message.text.body,
          type: message.type
        };
        
  - name: "AI 回复"
    type: "n8n-nodes-base.openAi"
    parameters:
      model: "gpt-4"
      messages: [
        { role: "system", content: "..." },
        { role: "user", content: "{{ $json.text }}" }
      ]
      
  - name: "发送回复"
    type: "n8n-nodes-base.whatsApp"
    parameters:
      operation: "sendMessage"
      phoneNumberId: "{{ $env.WHATSAPP_PHONE_ID }}"
      recipientPhoneNumber: "{{ $json.from }}"
      message: "{{ $json.response }}"

输出示例

请求:"创建 WhatsApp 订单通知流程"

输出

# WhatsApp 订单通知

## 消息模板(需 Meta 审批)

### 1. 订单确认

您好 {{1}}!🎉

您的订单 #{{2}} 已确认!

商品:{{3}}
总计:{{4}}

我们会在发货时通知您。

追踪订单


### 2. 发货更新

📦 您的订单正在路上!

订单: #{{1}}
承运商:{{2}}
追踪号:{{3}}

预计送达:{{4}}

追踪包裹


### 3. 已送达

✅ 已送达!

您的订单 #{{1}} 已到达。

喜欢吗?留下评价!
需要帮助?回复此消息。

评价


## n8n 工作流

```yaml
trigger: Shopify 订单创建
steps:
  1. 获取客户电话
  2. 格式化订单详情
  3. 发送 WhatsApp 模板
  4. 记录到 CRM

自动化规则

  • 下单 → 确认(立即)
  • 已发货 → 追踪信息(立即)
  • 派送中 → 提醒(立即)
  • 已送达 → 评价请求(1 天后)

---

*WhatsApp 自动化技能 - Claude Office Skills 的一部分*