我尝试使用包含动态 URL 按钮的模板,但我不断收到以下错误:
{"error":{"message":"(#131008) 必需参数为 缺少”,“类型”:“OAuthException”,“代码”:131008,“error_data”:{“messaging_product”:“whatsapp”,“详细信息”:“按钮: Url 类型索引 0 处的按钮需要 参数"},"fbtrace_id":"A5zKyCl8YbQvpCIT7mgmgtC"}}
我错过了什么? 我正在使用 PHP curl 发送消息。 发送不带参数的 hello_world 默认模板效果很好。
这是我使用的查询:
{
"messaging_product": "whatsapp",
"to": "001555444555",
"type": "template",
"template": {
"name": "invitation",
"language": {
"code": "he"
}
},
"components": [
{
"type": "body"
},
{
"type":"button",
"sub_type":"url",
"index":0,
"parameters":[
{
"type":"text",
"text":"1234567"
}
]
}
]
}
看来您没有正确阅读文档,我可以看到您没有准备正确的请求对象,
https://developers.facebook.com/docs/whatsapp/cloud-api/guides/send-message-templates https://developers.facebook.com/docs/whatsapp/cloud-api/reference/messages#template-object
我不知道您的模板部分,但这只是根据您的请求预测的请求,
components
属性应该位于模板属性内部{
"messaging_product": "whatsapp",
"to": "001555444555",
"type": "template",
"template": {
"name": "invitation",
"language": {
"code": "he"
},
"components": [
{
"type": "button",
"sub_type": "url",
"index": 0,
"parameters": [
{
"type": "text",
"text": "1234567"
}
]
}
]
}
}