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

使用WhatsApp API发送带模板文档时遇参数格式错误求助

排查WhatsApp API模板文档发送的手机号格式错误

错误信息

{
    "error": {
        "message": "(#100) Invalid parameter",
        "type": "OAuthException",
        "code": 100,
        "error_data": {
            "messaging_product": "whatsapp",
            "details": "For component HEADER, parameter '' does not have a valid phone_number format. Length Limit is 20 characters and detailed format requirements can be found in official documentation."
        },
        "fbtrace_id": "AMpCyBYnc9ch7Ivdzk6sJ6S"
    }
}

请求体配置

{
   "messaging_product":"whatsapp",
   "to":"{{Recipient-Number}}",
   "type":"template",
   "template":{
      "name":"docs",
      "language":{
         "code":"fr"
      },
      "components":[
         {
            "type":"header",
            "parameters":[
               {
                  "type":"document",
                  "document":{
                     "link":"https://pdfobject.com/pdf/sample.pdf"
                  }
               }
            ]
         },
         {
            "type":"body",
            "parameters":[
               {
                  "type":"text",
                  "text":"credit CS"
               },
               {
                  "type":"text",
                  "text":"Mutual"
               },
               {
                  "type":"text",
                  "text":"reçu"
               }
            ]
         }
      ]
   }
}

错误原因

你在Meta后台创建的docs模板,其HEADER组件的参数类型与请求体中传递的类型不匹配。错误提示指向“空参数不符合手机号格式”,说明模板的HEADER参数被定义为手机号类型,但你请求中传递的是document类型,导致API校验时无法正确解析参数,进而抛出格式错误。

解决方法

  • 登录Meta Business Manager,进入对应WhatsApp账号的模板管理页面,找到docs模板
  • 检查HEADER组件的参数配置:如果模板HEADER设置了手机号参数,将其修改为文档类型;如果不需要该参数,直接删除,确保模板HEADER的参数类型与请求体中传递的document完全一致
  • 若修改了模板,需重新提交并等待Meta审核通过
  • 再次发送请求,确认参数类型与模板定义匹配

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

相关产品推荐
方舟 Agent Plan

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

最近更新时间:2026.06.15 07:15:55