Skip to content

SAAS WhatsApp API webhook

zjc1750514326 edited this page Apr 4, 2023 · 24 revisions

webhook

对提供的webhook地址,进行WhatsApp业务相关的推送信息(目前webhook支持推送状态回复

  • URL:webhook_url
  • Method:POST
  • Content-Type:application/json

状态回复

对调用WhatsApp-API发送消息的场景,提供消息的回执情况

响应参数

body参数:

参数名 类型 说明
statuses array[status JsonObject] 结果编码
business_phone String 商户电话
messaging_product String 消息类型,固定值”whatsapp“
  • status object参数:
参数名 类型 说明
conversation JsonObject 会话信息
errors array[error JsonObject] 错误信息
recipient_id String 收件人WhatsApp_id
timestamp String 回调时间戳
status String 消息的状态,sent(已发送)delivered(已送达)read(已读)failed(发送失败)deleted(已删除)
id String 消息ID
  • conversation object参数:
参数名 类型 说明
id String 会话ID
expiration_timestamp String 会话过期时间戳
origin JsonObject 会话类型信息
  • origin object参数:
参数名 类型 说明
type String 会话类型
  • error object参数:
参数名 类型 说明
code Integer 错误码
title String 错误信息

响应示例

消息已发送

{
  "statuses": [
    {
      "id": "wamid.HBgNODYxNzYwNjA1MDgxORUCABEYEjI4RTcyNzFGRDVGQTQwQkQ1RAA=",
      "status": "sent",
      "timestamp": "1660019986",
      "recipient_id": "86176xxxx0819",
      "conversation": {
        "id": "72569257438b471cae074da84bed1b83",
        "expiration_timestamp": "1660106400",
        "origin": {
          "type": "business_initiated"
        }
      }
    }
  ]
}

消息已送达

{
  "statuses": [
    {
      "id": "wamid.HBgNODYxNzYwNjA1MDgxORUCABEYEjI4RTcyNzFGRDVGQTQwQkQ1RAA=",
      "status": "delivered",
      "timestamp": "1660019987",
      "recipient_id": "86176xxxx0819",
      "conversation": {
        "id": "72569257438b471cae074da84bed1b83",
        "origin": {
          "type": "business_initiated"
        }
      }
    }
  ]
}

消息已读

{
  "statuses": [
    {
      "id": "wamid.HBgNODYxNzYwNjA1MDgxORUCABEYEjI4RTcyNzFGRDVGQTQwQkQ1RAA=",
      "status": "read",
      "timestamp": "1660019990",
      "recipient_id": "86176xxxx0819"
    }
  ]
}

消息发送失败

{
  "statuses": [
    {
      "errors": [
        {
          "code": 470,
          "title": "Failed to send message because you are outside the support window for freeform messages to this user. Please use a valid HSM notification or reconsider."
        }
      ],
      "id": "ID",
      "recipient_id": "WHATSAPP_ID",
      "status": "failed",
      "timestamp": "TIMESTAMP"
    }
  ]
}

消息已删除

{
  "statuses": [
    {
      "id": "ID",
      "recipient_id": "WHATSAPP_ID",
      "status": "deleted",
      "timestamp": "TIMESTAMP",
      "type": "message",
      "message": {
        "recipient_id": "WHATSAPP_ID"
      }
    }
  ]
}

简介

短信

语音

云呼叫中心(NXLink)

云呼叫中心(AI自动外呼)

Flash Call

短链

邮件验证码

DID号码

通用

号码检测

WhatsApp

Viber

Zalo ZNS

Super Message API

隐私号(旧)

PNS

坐席(旧版)

AI Agent

Clone this wiki locally