Yoctol / bottender

⚡️ A framework for building conversational user interfaces.
https://bottender.js.org
MIT License
4.22k stars 335 forks source link

feat(LineConnector): add getSessionKeyPrefix to avoid conflict between channels in the same provider #775

Closed chentsulin closed 4 years ago

chentsulin commented 4 years ago
module.exports = {
  channels: {
    line: {
      enabled: true,
      path: '/webhooks/line/:channelId',

      // [Optional] If you want to avoid user id conflict between LINE channels in the same provider,
      // you must add prefix to the session keys using the parameters from the URL
      getSessionKeyPrefix(event, { params }) {
        return `${params.channelId}:`;
        // or you can use the destination to avoid the conflict
        // return `${event.destination}:`;
      },

      async getConfig({ params }) {
        // ...
      },
    },
  },
};
codecov-commenter commented 4 years ago

Codecov Report

Merging #775 into release/1.5 will increase coverage by 0.00%. The diff coverage is 90.00%.

Impacted file tree graph

@@             Coverage Diff              @@
##           release/1.5     #775   +/-   ##
============================================
  Coverage        81.07%   81.08%           
============================================
  Files              108      108           
  Lines             4741     4747    +6     
  Branches          1195     1197    +2     
============================================
+ Hits              3844     3849    +5     
  Misses             862      862           
- Partials            35       36    +1     
Impacted Files Coverage Δ
packages/bottender/src/line/LineConnector.ts 95.31% <90.00%> (-0.59%) :arrow_down:

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 117d40d...61d6234. Read the comment docs.