You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

求WhatsApp互动模板消息示例代码及Postman调用报错2012解决方案

错误原因

你提交的请求体JSON存在结构错误:components 数组内的同一个对象中重复定义了 type 字段,后续声明的 type: "button" 会覆盖前面的 type: "header",导致平台无法识别到header配置,误判你没有传入符合要求的视频header参数。

修正后的请求示例

需要将header组件和button组件拆分为两个独立对象放入components数组,参考代码如下:

{
    "to": "91NUMBER",
    "type": "template",
    "template": {
        "namespace": "NAMESPACE_ID",
        "language": {
            "policy": "deterministic",
            "code": "en"
        },
        "name": "TEMPLATE_NAME",
        "components": [
            {
                "type": "header",
                "parameters": [
                    {
                        "type": "video",
                        "video": {
                            "link": "https://res.cloudinary.com/MY_VIDEO_LINK"
                        }
                    }
                ]
            },
            {
                "type": "button",
                "sub_type": "url",
                "index": "0",
                "parameters": [
                    {
                        "type": "text",
                        "text": "9rwnB8RbYmPF5t2Mn09x4h"
                    }
                ]
            }
        ]
    }
}

额外校验点

  • 确认Meta后台创建的WhatsApp模板header类型确实为视频,和传入参数类型一致
  • 视频链接需要为公网可直接访问的资源,无跳转、鉴权限制,格式为WhatsApp兼容的MP4等格式
  • 按钮参数数量、位置需要和模板定义的动态占位符完全匹配

内容的提问来源于stack exchange,提问作者user17252621

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.09.28 18:54:03