title | date |
---|---|
LineEvent |
2018-03-20 |
Underlying raw event from LINE.
Example:
event.rawEvent;
// {
// replyToken: 'nHuyWiB7yP5Zw52FIkcQobQuGDXCTA',
// type: 'message',
// timestamp: 1462629479859,
// source: {
// type: 'user',
// userId: 'U206d25c2ea6bd87c17655609a1c37cb8',
// },
// message: {
// id: '325708',
// type: 'text',
// text: 'Hello, world',
// },
// }
The reply token from LINE raw event. Only present on message, follow, join, postback, beacon events.
Example:
event.replyToken; // 'nHuyWiB7yP5Zw52FIkcQobQuGDXCTA'
The source object from LINE raw event.
Example:
event.source;
// {
// type: 'user',
// userId: 'U206d25c2ea6bd87c17655609a1c37cb8',
// }
Determine if the event is a message event.
Example:
event.isMessage; // true
The message object from LINE raw event.
Example:
event.message;
// {
// id: '325708',
// type: 'text',
// text: 'Hello, world',
// }
Determine if the event is a message event which includes text.
Example:
event.isText; // true
The text string from LINE raw event.
Example:
event.text; // 'Hello, world'
Determine if the event is a message event which includes image.
Example:
event.isImage; // true
The image object from LINE raw event.
Example:
event.image;
// {
// id: '325708',
// type: 'image',
// }
Determine if the event is a message event which includes video.
Example:
event.isVideo; // true
The video object from LINE raw event.
Example:
event.video;
// {
// id: '325708',
// type: 'video',
// }
Determine if the event is a message event which includes audio.
Example:
event.isAudio; // true
The audio object from LINE raw event.
Example:
event.audio;
// {
// id: '325708',
// type: 'audio',
// }
Determine if the event is a message event which includes location.
Example:
event.isLocation; // true
The location object from LINE raw event.
Example:
event.location;
// {
// address: 'Golden Gate Bridge, San Francisco, CA, United States',
// id: '325708',
// latitude: 37.819722,
// longitude: -122.478611,
// title: 'my location',
// type: 'location',
// }
Determine if the event is a message event which includes sticker.
Example:
event.isSticker; // true
The sticker object from LINE raw event.
Example:
event.sticker;
// {
// id: '325708',
// packageId: '1',
// stickerId: '1',
// type: 'sticker',
// }
Determine if the event is a follow event.
Example:
event.isFollow; // true
The source object from LINE raw event.
Example:
event.follow;
// {
// type: 'user',
// userId: 'U206d25c2ea6bd87c17655609a1c37cb8',
// }
Determine if the event is an unfollow event.
Example:
event.isUnfollow; // true
The source object from LINE raw event.
Example:
event.unfollow;
// {
// type: 'user',
// userId: 'U206d25c2ea6bd87c17655609a1c37cb8',
// }
Determine if the event is a join event.
Example:
event.isJoin; // true
The source object from LINE raw event.
Example:
event.join;
// {
// type: 'group',
// groupId: 'cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
// }
Determine if the event is a leave event.
Example:
event.isLeave; // true
The source object from LINE raw event.
Example:
event.leave;
// {
// type: 'group',
// groupId: 'cxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx',
// }
Determine if the event is a postback event.
Example:
event.isPostback; // true
The postback object from LINE raw event.
Example:
event.postback;
// {
// data: 'action=buyItem&itemId=123123&color=red',
// }
Determine if the event is a postback event.
Example:
event.isPayload; // true
The payload string from LINE raw event.
Example:
event.payload; // 'action=buyItem&itemId=123123&color=red'
The date string from LINE postback event.
Example:
event.date; // '2017-09-06'
The time string from LINE postback event.
Example:
event.time; // '12:30'
The datetime string from LINE postback event.
Example:
event.datetime; // '2017-09-06T12:30'
Determine if the event is a beacon event.
Example:
event.isBeacon; // true
The beacon object from LINE raw event.
Example:
event.beacon;
// {
// hwid: 'd41d8cd98f',
// type: 'enter',
// }
Determine if the event is an accountLink event.
Example:
event.isAccountLink; // true
The link object from LINE raw event.
Example:
event.accountLink;
// {
// result: 'ok',
// nonce: 'xxxxxxxxxxxxxxx',
// }