Skip to content
This repository has been archived by the owner on Sep 20, 2024. It is now read-only.

Add support for enterprise id #1962

Closed
reesesm2000 opened this issue Apr 29, 2020 · 1 comment
Closed

Add support for enterprise id #1962

reesesm2000 opened this issue Apr 29, 2020 · 1 comment
Labels

Comments

@reesesm2000
Copy link

If a bot is installed in an Enterprise Grid, it can be accessed from any of the teams in the grid. When the bot is installed, it only gets to know about the first team where the install is done therefore causing a team not found error when accessed from a separate team in the grid. Making the changes below allow for automatically adding the team id if it belongs to an already registered grid not needed the app to be reinstalled.

botworker.js
Add after line 112
// @ts-ignore this field is required for slack
enterprise: this.getConfig('activity').conversation.enterprise

Add after line 153 (new line 153)
// @ts-ignore this field is required for slack
enterprise: this.getConfig('activity').conversation.enterprise
Add after line 190
// @ts-ignore this field is required for slack
enterprise: this.getConfig('activity').conversation.enterprise

slack_adapter.js
Change line 193 to
const token = yield this.options.getTokenForTeam(activity.conversation.team, activity.conversation.enterprise);
Change line 221 to
const user_id = yield this.options.getBotUserByTeam(activity.conversation.team, activity.conversation.enterprise);
Add after line 526
enterprise: event.team.enterprise_id
Add after line 617
activity.channelData.enterprise = event.enterprise_id;
Add after line 621
activity.conversation.enterprise = activity.channelData.enterprise;
Add after line 670
activity.channelData.enterprise = event.enterprise_id;
Add after line 674
activity.conversation.enterprise = activity.channelData.enterprise;

@stale
Copy link

stale bot commented Jun 28, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Jun 28, 2020
@stale stale bot closed this as completed Jul 5, 2020
elisherer added a commit to elisherer/botkit that referenced this issue Jul 14, 2021
Inside activity and for fetching token and bot user by it, addresses howdyai#1962
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

1 participant