Jitendra Chouhan
Jitendra Chouhan

Reputation: 21

Line Messaging Push API not working

While sending message through line API I am getting the error:

{"message":"The property, 'to', in the request body is invalid (line: -, column: -)"}

The command I used:

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

Upvotes: 2

Views: 5925

Answers (1)

osk2
osk2

Reputation: 329

Seems you forgot to change property to to recipient ID.

ID looks like U206d25c2ea6bd87c17655609a1c37cb8.


Note that you have to make sure your account have PUSH_MESSAGE access, or you will get following error when you try to access the API.

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

You can check usable API in Bot settings under your account page.

Bot settings page

Upvotes: 1

Related Questions