Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(slack): add includeBotMessages option for interacting with bot_message #635

Merged
merged 1 commit into from
Jan 22, 2020

Conversation

chentsulin
Copy link
Collaborator

@chentsulin chentsulin commented Jan 22, 2020

#625

Implement the following API to interact with bot_message:

By setting includeBotMessages to true:

// 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);
  }
};

@chentsulin chentsulin changed the title feat: includesBotMessage feat(slack): add includeBotMessages option for interacting with bot_message Jan 22, 2020
@codecov-io
Copy link

codecov-io commented Jan 22, 2020

Codecov Report

Merging #635 into release/1.2 will increase coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@               Coverage Diff               @@
##           release/1.2     #635      +/-   ##
===============================================
+ Coverage        81.08%   81.11%   +0.03%     
===============================================
  Files              100      100              
  Lines             4293     4295       +2     
  Branches          1077     1067      -10     
===============================================
+ Hits              3481     3484       +3     
- Misses             764      767       +3     
+ Partials            48       44       -4
Impacted Files Coverage Δ
packages/bottender/src/slack/SlackBot.ts 100% <ø> (ø) ⬆️
packages/bottender/src/slack/SlackConnector.ts 93.45% <100%> (+1%) ⬆️
packages/bottender/src/slack/SlackEvent.ts 92.68% <100%> (+0.18%) ⬆️
packages/create-bottender-app/src/shared/log.ts 0% <0%> (ø) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 073eb85...178bae0. Read the comment docs.

@chentsulin chentsulin merged commit 5238e0d into release/1.2 Jan 22, 2020
@chentsulin chentsulin deleted the bot-message branch January 22, 2020 06:02
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants