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 linemessageevents.line.follow- matches when receiving linefollowevents.line.unfollow- matches when receiving lineunfollowevents.line.join- matches when receiving linejoinevents.line.leave- matches when receiving lineleaveevents.line.memberJoined- matches when receiving linememberJoinedevents.line.memberLeft- matches when receiving linememberLeftevents.line.postback- matches when receiving linepostbackevents.line.beacon.enter- matches when receiving linebeaconevents with typeenter.line.beacon.banner- matches when receiving linebeaconevents with typebanner.line.beacon.stay- matches when receiving linebeaconevents with typestay.line.beacon- matches when receiving any linebeaconevents.line.accountLink- matches when receiving lineaccountLinkevents.line.things.link- matches when receiving linethingsevents with typelink.line.things.unlink- matches when receiving linethingsevents with typeunlink.line.things.scenarioResult- matches when receiving linethingsevents with typescenarioResult.line.things- matches when receiving any linethingsevents.