LINE Routing
Bottender offers a bunch of helpers to route within your LINE or multi-platform application. For example, you may use LINE particular routes within your router
:
const { router, line } = require('bottender/router');
function App() {
return router([
line.message(HandleMessage),
line.follow(HandleFollow),
line.unfollow(HandleUnfollow),
line.join(HandleJoin),
line.leave(HandleLeave),
line.memberJoined(HandleMemberJoined),
line.memberLeft(HandleMemberLeft),
line.postback(HandlePostback),
line.beacon.enter(HandleBeaconEnter),
line.beacon.banner(HandleBeaconBanner),
line.beacon.stay(HandleBeaconStay),
line.beacon(HandleBeacon),
line.accountLink(HandleAccountLink),
line.things.link(HandleThingsLink),
line.things.unlink(HandleThingsUnlink),
line.things.scenarioResult(HandleThingsScenarioResult),
line.things(HandleThings),
line(HandleLine),
]);
}
async function HandleMessage(context) {
/* skip... */
}
async function HandleFollow(context) {
/* skip... */
}
async function HandleUnfollow(context) {
/* skip... */
}
async function HandleJoin(context) {
/* skip... */
}
async function HandleLeave(context) {
/* skip... */
}
async function HandleMemberJoined(context) {
/* skip... */
}
async function HandleMemberLeft(context) {
/* skip... */
}
async function HandlePostback(context) {
/* skip... */
}
async function HandleBeaconEnter(context) {
/* skip... */
}
async function HandleBeaconBanner(context) {
/* skip... */
}
async function HandleBeaconStay(context) {
/* skip... */
}
async function HandleBeacon(context) {
/* skip... */
}
async function HandleAccountLink(context) {
/* skip... */
}
async function HandleThingsLink(context) {
/* skip... */
}
async function HandleThingsUnlink(context) {
/* skip... */
}
async function HandleThingsScenarioResult(context) {
/* skip... */
}
async function HandleThings(context) {
/* skip... */
}
async function HandleLine(context) {
/* skip... */
}
All available routes in line
that recognize different kind of events:
line
- matches when receiving any line events.line.message
- matches when receiving linemessage
events.line.follow
- matches when receiving linefollow
events.line.unfollow
- matches when receiving lineunfollow
events.line.join
- matches when receiving linejoin
events.line.leave
- matches when receiving lineleave
events.line.memberJoined
- matches when receiving linememberJoined
events.line.memberLeft
- matches when receiving linememberLeft
events.line.postback
- matches when receiving linepostback
events.line.beacon.enter
- matches when receiving linebeacon
events with typeenter
.line.beacon.banner
- matches when receiving linebeacon
events with typebanner
.line.beacon.stay
- matches when receiving linebeacon
events with typestay
.line.beacon
- matches when receiving any linebeacon
events.line.accountLink
- matches when receiving lineaccountLink
events.line.things.link
- matches when receiving linethings
events with typelink
.line.things.unlink
- matches when receiving linethings
events with typeunlink
.line.things.scenarioResult
- matches when receiving linethings
events with typescenarioResult
.line.things
- matches when receiving any linethings
events.