快速开始
回复收到的消息
使用入站会话作为回复目标。普通回复省略 reply_to;引用回复原样复制入站 reply_token。
上手步骤
- 1
调用前准备
务必先做这一步:授权进度与实时入站消息通过 webhook 到达,漏掉的投递不保证重放。用 ["*"] 可订阅全部公开标准事件;WhatsApp HistorySync 只提供有限的近期连续性,不是持久历史归档。
Webhook 投递与签名校验 - 2
参数从哪里取得
回复消息时,将 message.received 中的 data.conversation.id 和 data.conversation.type 分别复制到 to.id、to.type。发送给新收件方时遵循对应渠道的标识规则。
message.received - 3
发送文本消息
使用入站会话作为回复目标。普通回复省略 reply_to;引用回复原样复制入站 reply_token。
发送文本消息curl -X POST "https://api.unifyport.ai/v1/messages" \ -H "X-Api-Key: <YOUR_API_KEY>" \ -H "Content-Type: application/json" \ -d '{ "account_id": "acc_example", "to": { "id": "user_example", "type": "user" }, "message": { "type": "text", "text": "Hello from UnifyPort" } }' - 4
引用回复消息
使用入站会话作为回复目标。普通回复省略 reply_to;引用回复原样复制入站 reply_token。
引用回复消息curl -X POST "https://api.unifyport.ai/v1/messages" \ -H "X-Api-Key: <YOUR_API_KEY>" \ -H "Content-Type: application/json" \ -d '{ "account_id": "acc_example", "to": { "id": "8600000000000@s.whatsapp.net", "type": "user" }, "message": { "type": "text", "text": "Sure - replying to your question above." }, "reply_to": { "reply_token": "<data.message.reply_token from the inbound event>" } }'