LINEのWebhookでは次のようなパラメータが使用できます。
欲しい時にWEBで検索してもヒットしないことがあるため。簡単にまとめています。
テキストメッセージ送信時のイベント
// グループトークでユーザーからメンションと絵文字を含むテキストメッセージが送られた場合
{
"destination": "xxxxxxxxxx",
"events": [
{
"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
"type": "message",
"mode": "active",
"timestamp": 1462629479859,
"source": {
"type": "group",
"groupId": "Ca56f94637c...",
"userId": "U4af4980629..."
},
"webhookEventId": "01FZ74A0TDDPYRVKNK77XKC3ZR",
"deliveryContext": {
"isRedelivery": false
},
"message": {
"id": "444573844083572737",
"type": "text",
"quoteToken": "q3Plxr4AgKd...",
"text": "@All @example Good Morning!! (love)",
"emojis": [
{
"index": 29,
"length": 6,
"productId": "5ac1bfd5040ab15980c9b435",
"emojiId": "001"
}
],
"mention": {
"mentionees": [
{
"index": 0,
"length": 4,
"type": "all"
},
{
"index": 5,
"length": 8,
"userId": "U49585cd0d5...",
"type": "user"
}
]
}
}
}
]
}
画像送信時のイベント
// 2つの画像を同時に送った場合(1番目の画像)
{
"destination": "xxxxxxxxxx",
"events": [
{
"type": "message",
"message": {
"type": "image",
"id": "354718705033693859",
"quoteToken": "q3Plxr4AgKd...",
"contentProvider": {
"type": "line"
},
"imageSet": {
"id": "E005D41A7288F41B65593ED38FF6E9834B046AB36A37921A56BC236F13A91855",
"index": 1,
"total": 2
}
},
"timestamp": 1627356924513,
"source": {
"type": "user",
"userId": "U4af4980629..."
},
"webhookEventId": "01FZ74A0TDDPYRVKNK77XKC3ZR",
"deliveryContext": {
"isRedelivery": false
},
"replyToken": "7840b71058e24a5d91f9b5726c7512c9",
"mode": "active"
}
]
}
// 2つの画像を同時に送った場合(2番目の画像)
{
"destination": "xxxxxxxxxx",
"events": [
{
"type": "message",
"message": {
"type": "image",
"id": "354718705033693861",
"quoteToken": "yHAz4Ua2wx7...",
"contentProvider": {
"type": "line"
},
"imageSet": {
"id": "E005D41A7288F41B65593ED38FF6E9834B046AB36A37921A56BC236F13A91855",
"index": 2,
"total": 2
}
},
"timestamp": 1627356924722,
"source": {
"type": "user",
"userId": "U4af4980629..."
},
"webhookEventId": "01FZ74A0TDDPYRVKNK77XKC3ZR",
"deliveryContext": {
"isRedelivery": false
},
"replyToken": "fbf94e269485410da6b7e3a5e33283e8",
"mode": "active"
}
]
}
ファイル送信時のイベント
{
"destination": "xxxxxxxxxx",
"events": [
{
"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
"type": "message",
"mode": "active",
"timestamp": 1462629479859,
"source": {
"type": "user",
"userId": "U4af4980629..."
},
"webhookEventId": "01FZ74A0TDDPYRVKNK77XKC3ZR",
"deliveryContext": {
"isRedelivery": false
},
"message": {
"id": "325708",
"type": "file",
"fileName": "file.txt",
"fileSize": 2138
}
}
]
}
動画送信時のイベント
{
"destination": "xxxxxxxxxx",
"events": [
{
"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
"type": "message",
"mode": "active",
"timestamp": 1462629479859,
"source": {
"type": "user",
"userId": "U4af4980629..."
},
"webhookEventId": "01FZ74A0TDDPYRVKNK77XKC3ZR",
"deliveryContext": {
"isRedelivery": false
},
"message": {
"id": "325708",
"type": "video",
"quoteToken": "q3Plxr4AgKd...",
"duration": 60000,
"contentProvider": {
"type": "external",
"originalContentUrl": "https://example.com/original.mp4",
"previewImageUrl": "https://example.com/preview.jpg"
}
}
}
]
}
フォロー/友だち追加時のイベント
// LINE公式アカウントを友だち追加した場合
{
"destination": "xxxxxxxxxx",
"events": [
{
"replyToken": "85cbe770fa8b4f45bbe077b1d4be4a36",
"type": "follow",
"mode": "active",
"timestamp": 1705891467176,
"source": {
"type": "user",
"userId": "U3d3edab4f36c6292e6d8a8131f141b8b"
},
"webhookEventId": "01HMQGW40RZJPJM3RAJP7BHC2Q",
"deliveryContext": {
"isRedelivery": false
},
"follow": {
"isUnblocked": false
}
}
]
}
// LINE公式アカウントをブロック解除した場合
{
"destination": "xxxxxxxxxx",
"events": [
{
"replyToken": "nHuyWiB7yP5Zw52FIkcQobQuGDXCTA",
"type": "follow",
"mode": "active",
"timestamp": 1462629479859,
"source": {
"type": "user",
"userId": "U4af4980629..."
},
"webhookEventId": "01FZ74A0TDDPYRVKNK77XKC3ZR",
"deliveryContext": {
"isRedelivery": false
},
"follow": {
"isUnblocked": true
}
}
]
}
ブロック/友だち解除時のイベント
{
"destination": "xxxxxxxxxx",
"events": [
{
"type": "unfollow",
"mode": "active",
"timestamp": 1462629479859,
"source": {
"type": "user",
"userId": "U4af4980629..."
},
"webhookEventId": "01FZ74A0TDDPYRVKNK77XKC3ZR",
"deliveryContext": {
"isRedelivery": false
}
}
]
}
イベント一覧
その他のイベントで送信されるパラメータについては下記をご参考ください。