我试图使用发送一个WhatsApp模板消息。
我收到了一个错误:
意料之外的键"0“在param”模板“上。类型
这是我通过Curl Post发送的请求:
"messaging_product"=> "whatsapp",
"recipient_type" => "individual",
"to" => "$to_number",
"type" => "template",
'template' => array("name"=> "templateName",'language'=>array("code"=>"en"),
'components'=>
array(
array(
"type" => "header",
"parameters" => array(
array(
"type" => "image",
"image" => array(
"link" => $imageLink
)
)
)
)
),
array(
array(
"type" => "body",
"parameters" => array(
array("type"=> "text","text"=> $Productid),
)
)
)
)发布于 2022-09-21 12:44:57
看起来您在body属性中传递了错误的属性数组(包含components类型),
应该是,
array(
'messaging_product' => "whatsapp",
'recipient_type' => "individual",
'to' => "$to_number",
'type' => "template",
'template' => array(
'name' => "templateName",
'language' => array(
'code' => "en"
),
'components' => array(
array(
'type' => "header",
'parameters' => array(
array(
'type' => "image",
'image' => array(
'link' => $imageLink
)
)
)
),
array(
'type' => "body",
'parameters' => array(
array(
'type' => "text",
'text' => $Productid
)
)
)
)
)
)https://stackoverflow.com/questions/73800669
复制相似问题