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

Line Webhook

Message Callback Service

Provides a webhook address for receiving Line-related push information (currently supports pushing inbound messages).

Inbound Messages

After sending a Viber message, the message status is pushed as a receipt.

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

Receipt Parameters

Body Parameters:

Parameter Type Description
destination String Merchant channelId
events array[event JsonObject] Event information

Event JsonObject:

Parameter Type Description
type String "message" (Message Type)
webhookEventId String Webhook event ID
timestamp Number Event timestamp
replyToken String Reply token for referencing the message
mode String Channel state (active: channel activated; standby: channel waiting)
message JsonObject Message details
source JsonObject Source of the message
deliveryContext JsonObject Indicates whether it's a redelivery event
  • Message Object Parameters:
Parameter Name Type Description
type String Message type (text, image, video, audio, file, location)
id String Message ID
quoteToken String Session information
text String Text message content (present when type is text)
duration Long Audio playback duration in milliseconds (present when type is audio)
title String Location name (present when type is location)
address String Location details (present when type is location)
latitude String Latitude (present when type is location)
longitude String Longitude (present when type is location)
contentProvider JsonObject Content provider for image files
  • Content Provider Object Parameters:
Parameter Name Type Description
type String (Value: "line" -> Image sent by LINE user)
  • Source Object Parameters:
Parameter Name Type Description
type String Source of the message (user, multi-person chat, group chat)
userId String User ID
  • Delivery Context Object Parameters:
Parameter Name Type Description
isRedelivery boolean (true: Redelivery of webhook event; false: First webhook event)

Example Receipts

Text Message

{
    "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 Message

{
    "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 Message

{
    "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 Message

{
    "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 Message

{
    "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": "

Ua56c6dca206ce700a3f1b0xxxx"
            },
            "replyToken": "d636a28b24fb41709301bed06a78641e",
            "mode": "active"
        }
    ]
}