Skip to content

1.2.0 / 2020-01-22

Compare
Choose a tag to compare
@chentsulin chentsulin released this 22 Jan 06:33
· 490 commits to master since this release
context.intent; // null

context.setIntent('greeting');

context.intent; // 'greeting'
  • [new] Added context.setAsHandled() and context.setAsNotHandled() for tracking handling status (#624):
context.setAsHandled();

context.isHandled; // true

context.setAsNotHandled();

context.isHandled; // false
  • [new] Added getSessionStore helper function to get the session store that configured by bottender.config.js (#633):
const { getSessionStore } = require('bottender');

const sessionStore = getSessionStore();
  • [new] Added getClient helper function to access underlying messaging client configured by bottender.config.js (#634):
const { getClient } = require('bottender');

const messenger = getClient('messenger');

messenger.sendText(USER_ID, 'Hello!', { tag: 'CONFIRMED_EVENT_UPDATE' });

const line = getClient('line');

line.pushText(USER_ID, 'Hello!');

slack

  • [new] add includeBotMessages option for interacting with bot_message (#635):
// bottender.config.js

module.exports = {
  // ...
  slack: {
    enabled: true,
    path: '/webhooks/slack',
    accessToken: process.env.SLACK_ACCESS_TOKEN,
    verificationToken: process.env.SLACK_VERIFICATION_TOKEN,
    includeBotMessages: true, // add this line
  },
};

Then you can use context.event.isBotMessage to determine if the event is a bot message event:

module.exports = function App(context) {
  if (context.event.isBotMessage) {
    console.log(context.event.rawEvent.botId);
  }
};