首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >WhatsApp云应用程序头&正文模板消息

WhatsApp云应用程序头&正文模板消息
EN

Stack Overflow用户
提问于 2022-09-21 12:21:47
回答 1查看 234关注 0票数 1

我试图使用发送一个WhatsApp模板消息。

我收到了一个错误:

意料之外的键"0“在param”模板“上。类型

这是我通过Curl Post发送的请求:

代码语言:javascript
复制
    "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),
                )
            )
        )
   )
EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2022-09-21 12:44:57

看起来您在body属性中传递了错误的属性数组(包含components类型),

应该是,

代码语言:javascript
复制
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
                    )
                )
            )
        )
    )
)
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/73800669

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档