跳转到主要内容
POST
使用此参考信息检查 YCloud 发送到您应用程序的 Webhook 载荷。在请求构建器中选择指定命名示例以查看其字段。 对于电话号码质量和账户移除事件,请选择以下示例: 对于质量更新,请在存在时检查 qualityRating 和 qualityUpdateEvent。请将电话号码的 messagingLimit 与描述所属业务资产组合共享额度的 whatsappBusinessManagerMessagingLimit 分开。示例值不是您账户的默认值。 对于账户删除事件,使用 whatsappBusinessAccount.id 识别账户。移除字段为可选项。保留未知的 removedReason 和 removedInitiatedBy 值。removedTime 记录的是接收到删除事件的时间,而不是账户被删除的确切时间。 本参考使用 https://example.com 作为保留占位符。针对您自己的测试,请在生成的请求中将其替换为您应用程序的 Webhook URL。您的应用程序托管此端点;YCloud 不托管 /webhooks/ycloud。
发送示例载荷可测试您的接收方。它不会触发来自 YCloud 的 Webhook 发送。示例 YCloud-Signature 是一个样例值;它 不是已编辑载荷或您端点密钥的有效签名。
在处理事件前请验证 YCloud-Signature 标头。有关设置和投递指南,请参阅 配置 Webhook。

接收方响应

在通过身份验证并持久接收事件后,返回任意 2xx 状态。异步处理耗时工作,以防 YCloud 重试您的应用程序已经接收的投递。

配置 Webhook

创建端点、验证签名并处理重试。

浏览带注解的示例

了解事件触发机制和特定场景的处理。

请求头

YCloud-Signature
string
示例:

"t=1654084800,s=8eb70f2acb056c2119acbee8fdd98a889021d9c268bc9ad248a4182c40e31119"

请求体

application/json

Represents a webhook event payload. Every event contains certain common properties: id, type, apiVersion, createTime. Each event may also contain some properties unique to the event. For example, sms is returned when type is sms.message.updated.

type
enum<string>
必填

Type of event.

可用选项:
whatsapp.echo_message.created,
whatsapp.echo_message.updated
whatsappMessage
object
必填

Included when type is whatsapp.message.updated, whatsapp.smb.message.created, or when type is whatsapp.smb.history for an outbound history message. Also included for whatsapp.echo_message.created and whatsapp.echo_message.updated, where the Agent echo subset applies. It is omitted for a metadata-only history chunk.

id
string
必填

Unique ID for the event.

Required string length: 6 - 128
apiVersion
string
必填

The API version used to render this event.

示例:

"v2"

createTime
string<date-time>
必填

The time at which this event was created, formatted in RFC 3339. e.g., 2022-06-01T12:00:00.000Z.

示例:

"2022-06-01T12:00:00.000Z"

phase
integer<int32>

Included when type is whatsapp.smb.history and the event was generated from a Meta history chunk. Identifies the chunk's synchronization phase.

示例:

1

progress
integer<int32>

Included when type is whatsapp.smb.history and the event was generated from a Meta history chunk. Reports the chunk's synchronization progress.

示例:

73

contactAttributesChanged
object

Included when type is contact.attributes_changed.

contactCreated
object

Included when type is contact.created.

contactDeleted
object

Included when type is contact.deleted.

contactNote
object

Included when type is contact.note.created, contact.note.updated, or contact.note.deleted.

contactUnsubscribeCreated
object

Included when type is contact.unsubscribe.created.

contactUnsubscribeDeleted
object

Included when type is contact.unsubscribe.deleted.

emailDelivery
object

Included when type is email.delivery.updated.

sms
object

Included when type is sms.message.updated.

smsInbound
object

Included when type is sms.inbound.received.

voice
object

Included when type is voice.message.updated.

whatsappBusinessAccount
object

Included when type is whatsapp.business_account.deleted, whatsapp.business_account.reviewed, or whatsapp.business_account.updated.

whatsappInboundMessage
object

Included when type is whatsapp.inbound_message.received, or when type is whatsapp.smb.history for an inbound history message. It is omitted for a metadata-only history chunk.

whatsappMetaBusinessAgent
object

Included for whatsapp.meta_business_agent.handover.updated. Currently limited to Public REST API Agents.

whatsappGroup
object

Included when type is whatsapp.group.lifecycle_update, whatsapp.group.participants_update, whatsapp.group.settings_update, whatsapp.group.status_update, or when type is whatsapp.message.updated for group message status updates.

whatsappPhoneNumber
object

Included when type is whatsapp.phone_number.deleted, whatsapp.phone_number.name_updated, whatsapp.phone_number.quality_updated, or whatsapp.phone_number.business_username_updated.

whatsappPayment
object

Included when type is whatsapp.payment.updated.

whatsappTemplate
object

Included when type is whatsapp.template.reviewed, whatsapp.template.quality_updated, whatsapp.template.category_updated, or whatsapp.template.correct_category_detection.

callingConnect
object

Included when type is whatsapp.call.connect.

callingTerminate
object

Included when type is whatsapp.call.terminate.

callingStatusUpdated
object

Included when type is whatsapp.call.status.updated.

callingRecording
object

Included when type is whatsapp.call.recording.updated.

callingTranscription
object

Included when type is whatsapp.call.transcription.updated.

flowChanges
object

Included when type is whatsapp.flow.status_change.

whatsappUserPreference
object

Included when type is whatsapp.user.preferences.

messengerInboundMessage
object

Included when type is messenger.inbound_message.received or messenger.inbound_message.updated. Editing keeps the same message IDs and original times; event createTime is the edit time for updated events.

messengerMessage
object

Included when type is messenger.message.updated.

messengerMessageReaction
object

Included when type is messenger.message_reaction.updated. Event createTime is the source interaction time.

响应

200

The request is successfully accepted.