Line Messaging Push API无法正常工作

时间:2016-12-06 10:42:31

标签: rest api line-api

通过行API发送消息时,我收到错误:

  

{&#34; message&#34;:&#34;请求正文中的&#39;到&#39;,无效(行: - ,列: - )&#34;} < / p>

我使用的命令:

curl -X POST \
-H 'Content-Type:application/json' \
-H 'Authorization: Bearer **********' \
-d '{
    "to": "******",
    "messages":[
        {
            "type":"text",
            "text":"Hello, world1"
        },
        {
            "type":"text",
            "text":"Hello, world2"
        }
    ]
}' https://api.line.me/v2/bot/message/push

1 个答案:

答案 0 :(得分:1)

似乎您忘记将属性to更改为收件人ID。

ID看起来像U206d25c2ea6bd87c17655609a1c37cb8

请注意,您必须确保自己的帐户具有PUSH_MESSAGE访问权限,否则在尝试访问API时会出现以下错误。

{"message":"Access to this API is not available for your account"}

您可以在帐户页面下的Bot设置中查看可用的API。

Bot settings page

相关问题