Whatsapp API (#132000) 参数数量与预期参数数量不匹配

Kau*_*Roy 9 message payload whatsapp

我在 Whatsapp API 中创建了以下模板。我想在API调用中设置参数值。正确的有效负载是多少?我一直在关注元文档并尝试,但每次我都会出错。请帮忙。

模板:

您订购的 # {{1}} 已成功收到。

在此输入图像描述

我使用了这个有效负载:

{
"messaging_product": "whatsapp", 
"to": "918456712349", 
"type": "template", 
"template": { 
    "name": "order_notification",
    "language": { 
        "code": "en_US" 
    }
},
"components": [
    {
        "type": "body",
        "parameters": [
            {
                "type": "text",
                "text": "135345345"
            }
        ]
    }
]
}
Run Code Online (Sandbox Code Playgroud)

但我仍然收到此错误

{
"error": {
    "message": "(#132000) Number of parameters does not match the expected number of params",
    "type": "OAuthException",
    "code": 132000,
    "error_data": {
        "messaging_product": "whatsapp",
        "details": "body: number of localizable_params (0) does not match the expected number of params (1)"
    },
    "error_subcode": 2494002,
    "fbtrace_id": "AzPa-uWXctIcdNVu0Lf3Fic"
    }
}
Run Code Online (Sandbox Code Playgroud)

His*_*m A 28

该问题是由于关闭模板对象然后打开新的组件对象造成的。将组件对象放在模板对象中,它将被修复

{
"messaging_product": "whatsapp", 
"to": "918456712349", 
"type": "template", 
"template": { 
    "name": "order_notification",
    "language": { 
        "code": "en_US" 
    }

"components": [
    {
        "type": "body",
        "parameters": [
            {
                "type": "text",
                "text": "135345345"
            }
        ]
    }
]
}
}
Run Code Online (Sandbox Code Playgroud)


小智 -4

看起来模板需要 1 个参数,但未提供该参数。

您可以在此处查看文档和示例。

它包括一个工作示例。