Add Slack and Microsoft Teams Bot Extensions #1656
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Summary
This PR adds comprehensive Slack and Microsoft Teams bot integrations following the existing Discord extension patterns.
Changes Made
New Files
Slack Integration
agixt/extensions/slack.py: Slack OAuth extensionSlackSSOclass for OAuth 2.0 token managementsso()function for authorization code exchangeget_slack_user_ids()for user ID to email mappingslackExtension class with 14 bot commands (send messages, list channels, etc.)agixt/SlackBotManager.py: Multi-company Slack bot managerCompanySlackBotclass for handling Slack events via Socket ModeSlackBotManagerclass for managing multiple bot instances per companyMicrosoft Teams Integration
agixt/extensions/teams.py: Microsoft Teams OAuth extensionTeamsSSOclass for Microsoft Identity Platform OAuthsso()function for authorization code exchangeget_teams_user_ids()for user ID to email mappingteamsExtension class with 14 bot commands (list teams, send messages, etc.)agixt/TeamsBotManager.py: Multi-company Teams bot managerCompanyTeamsBotclass using Microsoft Bot FrameworkTeamsBotManagerclass for managing multiple bot instancesModified Files
agixt/endpoints/Auth.py: Added bot invite endpointsGET /v1/slack/bot-invite- Returns Slack workspace installation URLGET /v1/teams/bot-invite- Returns Teams app installation informationDesign Patterns
This implementation follows the exact patterns established in the Discord extension:
extensions/discord.pyextensions/slack.pyextensions/teams.pyDiscordBotManager.pySlackBotManager.pyTeamsBotManager.pyDiscordSSOSlackSSOTeamsSSOget_discord_user_ids()get_slack_user_ids()get_teams_user_ids()/v1/discord/bot-invite/v1/slack/bot-invite/v1/teams/bot-inviteEnvironment Variables Required
Slack
SLACK_CLIENT_ID- Slack OAuth client IDSLACK_CLIENT_SECRET- Slack OAuth client secretSLACK_BOT_TOKEN- Bot User OAuth TokenSLACK_APP_TOKEN- App-level token for Socket ModeSLACK_SIGNING_SECRET- App signing secret (optional)Microsoft Teams
TEAMS_CLIENT_ID- Azure AD application client IDTEAMS_CLIENT_SECRET- Azure AD application client secretTEAMS_APP_ID- Bot Framework App IDTEAMS_APP_PASSWORD- Bot Framework App PasswordTEAMS_BOT_PORT- HTTP port for Bot Framework endpoint (default: 3978)How to Test
Slack
Microsoft Teams
Breaking Changes
None - this is a new feature addition.
Related
DiscordBotManager.py,extensions/discord.py