https://graph.facebook.com/v17.0/{{电话号码-ID}}/messages
标头包含身份验证令牌
传递json主体:
{
"messaging_product": "whatsapp",
"recipient_type": "individual",
"to": "{{Recipient-Phone-Number}}",
"type": "template",
"template": {
"name": "ticket_confirmation",
"language": {
"code": "en"
},
"components": [
{
"type": "header",
"parameters": [
{
"type": "image",
"image": {
"link": "https://link.png"
}
}
]
},
{
"type": "body",
"parameters": [
{
"type": "text",
"text": "xyz"
},
{
"type": "text",
"text": "event name"
},
{
"type": "text",
"text": "2"
},
{
"type": "text",
"text": "ticketname"
},
{
"type": "date_time",
"date_time": {
"fallback_value": "May 10, 2023"
}
},
{
"type": "text",
"text": "18:30 - 23:30"
},
{
"type": "text",
"text": "location"
},
{
"type": "currency",
"currency": {
"fallback_value": "value",
"code": "INR",
"amount_1000": 2100630
}
}
]
}
]
}
}
我收到此回复
"messages": [
{
"id": "wamid.HBgMOTE3MDQyMjY2ODExFQIAERgSQkQ0MDMyRTYyNTdBNUJGM0M0AA=="
}
]
我正在使用此 API 将消息模板发送给在我的平台上购买门票的用户,但消息将在 30 分钟后发送(在我在几秒内收到消息之前)。
说实话,我认为 Meta 在可预见的未来不会解决这个问题。之所以需要这么长时间,是因为您正在向模板添加变量。如果您使用静态模板重新尝试此操作,消息将在几秒钟内发送。我认为 Meta 可能需要时间来检查您的变量是否与其 ToS 一致。虽然30分钟有点过分了哈哈。
我要做的是发送一个静态模板,表示感谢您购买门票,并且以下消息将提供购买证明。然后使用自定义消息功能发送购买证明。这将在几秒钟内发送一条消息。您必须先发送模板,否则您的自定义消息将无法通过。
否则顾客只能等30分钟。提供购买证明通常对时间不那么敏感。