直接发送消息

直接发送出站WhatsApp消息。

消息同步提交到WhatsApp Business API。通常用于发送OTP和即时消息。

如果我们尝试请求WhatsApp Business API并收到错误响应,响应体字段error.whatsappApiError将被包含。

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

WhatsApp Business API 默认支持每个商务电话号码最多 80 MPS(每秒消息数)。吞吐量包括入站和出站消息以及所有消息类型。

👍

For more specific request examples, seeWhatsApp Messaging Examples.

🚧

See WhatsApp Errors for error handling.

Body Params

请提供 torecipient 中的一个;如果两者都提供,则以 to 为准并忽略 recipient

string
required

发送者的电话号码,格式为E.164

string

接收者的电话号码,格式为E.164。未提供 recipient 时必需。

string

接收方 WhatsApp Business-scoped user ID(BSUID)或 parent BSUID。未提供 to 时必需。

customerProfile
object

接收方资料信息。username-only 或 BSUID 发送场景会用于持久化 WhatsApp username。

string
enum
required

WhatsApp出站消息类型。
另请参阅WhatsApp消息

template
object

typetemplate时必需。

text
object

typetext时必需。

image
object

typeimage时必需。

video
object

typevideo时必需。

audio
object

typeaudio时必需。

document
object

typedocument时必需。

sticker
object

type为sticker时必需。

location
object

typelocation时必需。

interactive
object

typeinteractive时必需。

contacts
array of objects

typecontacts时必需。

contacts
reaction
object

typereaction时必需。

context
object

用于提及您正在回复的特定消息。回复可以是任何消息类型。

string

用于引用对象的唯一字符串(推荐)。这可以是订单号或类似标识符,可用于将对象与您的内部系统进行对账。

string
enum

可选。
表示通过 Direct Send 发送的消息类别。支持的值为 utilityauthentication

使用 utility 发送业务发起的 utility 消息。utility 消息按 utility 费率计费。

使用 authentication 发送业务发起的 authentication 消息。authentication 消息按 authentication 费率计费。Authentication Direct Send 仅支持 text 消息。

Allowed:
integer
30 to 43200

可选。
Direct Send utilityauthentication 消息的有效期,单位为秒。

支持范围为 30 秒到 43200 秒(12 小时)。未传时使用默认 Direct Send TTL。

boolean
Defaults to false

可选。
是否通过 Direct Send 下发消息。默认值为 false

设置为 true 后,如果发送方 WABA 已开通 Direct Send,会通过 Direct Send 下发消息。

对于模板消息,模板必须能转换为 Direct Send 支持的消息类型。支持转换的 Direct Send 消息类型包括:

  • Text messages(文本消息)
  • Interactive Call-to-Action URL button messages(交互式 Call-to-Action URL 按钮消息)
  • Interactive reply button messages(交互式回复按钮消息)
boolean

可选。
如果设置为true,消息将不会发送给已取消订阅您账户的用户。默认为false

仅用于POST /v2/whatsapp/messages。如果用户已取消订阅,我们将推送webhook通知,whatsappMessage.errorCode设置为RECIPIENT_UNSUBSCRIBED

不适用于POST /v2/whatsapp/messages/sendDirectly

boolean

可选。
如果设置为true,消息将不会发送给您阻止列表中的用户。默认为false

仅用于POST /v2/whatsapp/messages。如果用户在您的阻止列表中,我们将推送webhook通知,whatsappMessage.errorCode设置为RECIPIENT_IN_BLOCK_LIST

不适用于POST /v2/whatsapp/messages/sendDirectly

Response

Language
Credentials
Header
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json