SAAS Line API webhook - nxtele/nxcloud-doc-en GitHub Wiki

Line Webhook

Message Callback Service

Push Line business events to the configured webhook URL (currently supports inbound messages).

Inbound Messages

After Line messages are sent, inbound messages are pushed to the webhook.

  • URL: dr_webhook
  • Method: POST
  • Content-Type: application/json

Callback Parameters

Body Parameters

Parameter Type Description
destination String Business channelId
events array[event JsonObject] Event list

event object

Parameter Type Description
type String Message type
webhookEventId String Webhook event ID
timestamp Number Timestamp
replyToken String Reply token
mode String Channel mode: active (channel active), standby (waiting)
message JsonObject Message details
source JsonObject Source
deliveryContext JsonObject Redelivery info

message object

Parameter Type Description
type String Message type (text, image, video, audio, file, location)
id String Message ID
quoteToken String Conversation token
text String Text content (when type=text)
duration Long Audio duration in ms (when type=audio)
title String Location name (when type=location)
address String Location address (when type=location)
latitude String Latitude (when type=location)
longitude String Longitude (when type=location)
contentProvider JsonObject Image provider

contentProvider object

Parameter Type Description
type String Value: line (image sent by LINE user)

source object

Parameter Type Description
type String Source (user, multi-person chat, group chat)
userId String User ID

deliveryContext object

Parameter Type Description
isRedelivery boolean true: redelivered event; false: first delivery

Callback Examples

text

{
    "destination": "U44d64355f3d939f4db74649d82dxxxx",
    "events": [
        {
            "type": "message",
            "message": {
                "type": "text",
                "id": "509243235328065891",
                "quoteToken": "d0fu6utH1aziqG3BKtINCjcfF7I5ZFYBYK65sYQnKLrrUvFlP_A_sIU8kfiDFWT7e4PJtevdnaoOchJyX7S1QaHGpHcB51u-Gb7YBP8O-ekuzcyHsIMdG8W-gbbIownHWhEL5OS51peQi-4cdmZ8pQ",
                "text": "test"
            },
            "webhookEventId": "01HYFM66MC7K0N6QAX1ZVDXD13",
            "deliveryContext": {
                "isRedelivery": false
            },
            "timestamp": 1716363925648,
            "source": {
                "type": "user",
                "userId": "Ua56c6dca206ce700a3f1b0e49dxxxxx"
            },
            "replyToken": "c384d55299124bf4b504e3004fd6bcf0",
            "mode": "active"
        }
    ]
}

image

{
    "destination": "U44d64355f3d939f4dbxxxxx",
    "events": [
        {
            "type": "message",
            "message": {
                "type": "image",
                "id": "509379024964550871",
                "quoteToken": "OGU3EwklDuRXKXD8iZtgGHRAvQH24v6JNlJbUaIBlZkejT_Echq9q8n2nGPtajVXvi-z4OFbcCsjJF7cq0CivFvoEJmND1LthUOK-UVYJacQMnpiNBzhuKmk8S7C5BPOtI7A8tOvJHogWfYF1Avl-Q",
                "contentProvider": {
                    "type": "line"
                }
            },
            "webhookEventId": "01HYJ1C80FKV2297RK0JZHG497",
            "deliveryContext": {
                "isRedelivery": false
            },
            "timestamp": 1716444864021,
            "source": {
                "type": "user",
                "userId": "Ua56c6dca206ce700a3f1bxxxx"
            },
            "replyToken": "ebf2fd90eb1d44b0aa228c09f2e2a9ae",
            "mode": "active"
        }
    ]
}

video

{
    "destination": "U44d64355f3d939f4db746xxxx",
    "events": [
        {
            "type": "message",
            "message": {
                "type": "video",
                "id": "509379284860141587",
                "quoteToken": "yzG4cpaZqwNDuyDsjHkss8ZYx1ES0RPFZFWdpMGPi3e4g0M6V_ttAk5mSueDIkqq5VtL0j_wIaJVR9QJr230nmkzE-7HP4FR224Uz5gnvkUqdk_bieN5WQiP0DX8_pMcnac-txXZmD6XODt7jcVl-A",
                "duration": "10735",
                "contentProvider": {
                    "type": "line"
                }
            },
            "webhookEventId": "01HYJ1H5444AHFT914RBA6F5N2",
            "deliveryContext": {
                "isRedelivery": false
            },
            "timestamp": 1716445024988,
            "source": {
                "type": "user",
                "userId": "Ua56c6dca206ce700a3f1b0xxxx"
            },
            "replyToken": "d636a28b24fb41709301bed06a78641e",
            "mode": "active"
        }
    ]
}

audio

{
    "destination": "U44d64355f3d939f4db74649d82dxxxx",
    "events": [
        {
            "type": "message",
            "message": {
                "type": "audio",
                "id": "507219478615425234",
                "duration": 60476,
                "contentProvider": {
                    "type": "line"
                }
            },
            "webhookEventId": "01HXBNT9593S29CQ8AEFZ4AFQH",
            "deliveryContext": {
                "isRedelivery": false
            },
            "timestamp": 1715157672843,
            "source": {
                "type": "user",
                "userId": "U727e5ee2977bc7c75dad300cxxxxx"
            },
            "replyToken": "3fbcb0d115334482a45174b48dd1174d",
            "mode": "active"
        }
    ]
}

file

{
    "destination": "U44d64355f3d939f4db746xxxx",
    "events": [
        {
            "type": "message",
            "message": {
                "type": "file",
                "id": "509379284860141587",
                "quoteToken": "yzG4cpaZqwNDuyDsjHkss8ZYx1ES0RPFZFWdpMGPi3e4g0M6V_ttAk5mSueDIkqq5VtL0j_wIaJVR9QJr230nmkzE-7HP4FR224Uz5gnvkUqdk_bieN5WQiP0DX8_pMcnac-txXZmD6XODt7jcVl-A",
                "contentProvider": {
                    "type": "line"
                }
            },
            "webhookEventId": "01HYJ1H5444AHFT914RBA6F5N2",
            "deliveryContext": {
                "isRedelivery": false
            },
            "timestamp": 1716445024988,
            "source": {
                "type": "user",
                "userId": "Ua56c6dca206ce700a3f1b0e4xxxx"
            },
            "replyToken": "d636a28b24fb41709301bed06a78641e",
            "mode": "active"
        }
    ]
}

location

{
    "destination": "U44d64355f3d939f4db74649d8xxxxx",
    "events": [
        {
            "type": "message",
            "message": {
                "type": "location",
                "id": "509378006452535330",
                "title": "xxx",
                "address": "xxxxxxxx",
                "latitude": 22.581143,
                "longitude": 113.954891
            },
            "webhookEventId": "01HYJ0SNFXS2SB98NYVT028S1Z",
            "deliveryContext": {
                "isRedelivery": false
            },
            "timestamp": 1716444255360,
            "source": {
                "type": "user",
                "userId": "Ua56c6dca206ce700a3f1b0xxxxx"
            },
            "replyToken": "098edadbd3dc41369bab4be7486debe5",
            "mode": "active"
        }
    ]
}