2

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
osk2
  • 329
  • 3
  • 9
  • You should use markdown to format your question so that it's easier to read. Alternatively you can use the editor on SO. Click on the `{}` icon after highlighting the code part and it'll get formatted better. – iamnat Dec 06 '16 at 11:23

1 Answers1

1

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

Community
  • 1
  • 1
osk2
  • 329
  • 3
  • 9