Skip to content

How to find User Id, Group Id or replyToken for testing Messaging API

Jatuphum Tungsilsukchai edited this page Mar 29, 2022 · 2 revisions

Solutions

  1. By Default, after you created LINE Messaging API Channel, there is your LINE account's user ID to use this to send yourself test messages with the Messaging API.
  • Doing so requires you to add your channel as a friend on LINE Application by scanning the QR code on the Messaging API tab.

messaging-api-tab

qrcode

  • Found your LINE account's user ID at Basic Settings tab, then title 'Your user ID'.

basic-settings-tab

your-user-id

  1. There is an the other to find User Id, Group Id or Reply Token by using Node-RED + LINE Webhook Node with LINE Messaging API Channel in real situation. This solution has a little complicate, but this solution make you to understand, how to use LINE Webhook Node interact with LINE Mesaging API.
  • Step 1, follow LINE Webhook Node document.

  • Step 2, see got Messaging Events result from LINE Webhook Node, by debugging msg.payload value from LINE Webhook Node output.

{
    "destination":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
    "events":[
        {
            "type":"message",
            "message":{
                "type":"text",
                "id":"999999999",
                "text":"Test"
            },
            "timestamp":1648554439066,
            "source":{
                "type":"user",
                "userId":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
            },
            "replyToken":"xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
            "mode":"active"
        }
    ]
}

Now you can got userId value from response LINE Messaging Events. Also, if you test send message from LINE Group, you can got groupId.

Moreover, you can got replyToken value from response LINE Messaging Events too (for test reply message).

More details