unificationengine

How to send a message to Line using unificationengine?


I have created a user using UE and added a connection for Line.

How can I send messages to Line using my connection.


Solution

  • For sending the message to Line you need a userId, ie ID of the target recipient. Use a userId value returned in a webhook event object. Do not use the LINE ID found on the LINE app.

    Replace the following parameters

    USER_ID: replace USER_ID

    MESSAGE_CONTENT: replace MESSAGE_CONTENT with actual message content.

    MESSAGE_CONTENT_SIZE: character length of the MESSAGE_CONTENT including space.

    UNIQUE_CONNECTION_IDENTIFIER: your connection name.

    Command

    curl -XPOST https://apiv2.unificationengine.com/v2/message/send --data "{ \"message\": { \"receivers\": [{\"name\": \"\", \"address\": \"USER_ID\" , \"Connector\": \"UNIQUE_CONNECTION_IDENTIFIER\" }],\"parts\": [{\"id\": \"1\",\"contentType\": \"text/plain\", \"data\":\"MESSAGE_CONTENT\" ,\"size\": MESSAGE_CONTENT_SIZE,\"type\": \"body\",\"sort\":0}]}}" -u USER_ACCESSKEY:USER_ACCESSSECRET -k