Integrating with Slack
To enable EnhanceDocs Server with integration for Slack, follow these steps:
- Update the
config.jsonfile by adding the following key-value pair within theintegrationsobject:
{
...
"integrations": {
...
"slack": true
}
}
- Provide the
SLACK_BOT_TOKENandSLACK_SIGNING_SECRETas environment variables in thedocker runcommand. To do this, you need to create a bot for slack, subscribe to theapp_mentionevent, and enable the required scopes/permissions.
Creating a Bot for Slack
- Go to the Slack API portal and sign in with your Slack account.
- Click on the "Create New App" button.
- Select "From scratch" and enter a name for your app, then choose the desired workspace and click "Create App".
- In the "Add features and functionality" section, click on "Bots" and then "Add a bot user".
- Set a display name and default username for the bot, then click "Add Bot User" and "Save Changes".
Enabling Events and Subscribing to the App Mention Event
- In the app settings, navigate to the "Event Subscriptions" tab and toggle on "Enable Events".
- Enter the "Request URL" (which should be the URL of your EnhanceDocs server with the
/integrations/slack/eventsendpoint). - In the "Subscribe to bot events" section, click "Add Bot User Event" and choose the
app_mentionevent. - Click "Save Changes".
Adding Required Scopes/Permissions
- Go to the "OAuth & Permissions" tab in the app settings.
- Scroll to the "Scopes" section and add the following bot token scopes:
app_mentions:read,channels:history,chat:write,groups:history,im:history, andmpim:history. - Click "Save Changes".
Installing the App and Obtaining the Bot Token
- Scroll to the top of the "OAuth & Permissions" page and click "Install App to Workspace".
- Authorize the app.
- After installation, you will see the
SLACK_BOT_TOKENunder "OAuth Tokens for Your Workspace". Copy the token for later use.
Running EnhanceDocs Server with Integration for Slack
Once you have completed the steps above, update your docker run command to include the SLACK_BOT_TOKEN and SLACK_SIGNING_SECRET environment variables:
docker run -p 8080:8080 \
-v $(pwd)/.enhancedocs/data:/data/enhancedocs \
-v $(pwd)/.enhancedocs/config:/etc/enhancedocs \
--env OPENAI_API_KEY=sk-... \
--env SLACK_BOT_TOKEN=xoxb-your_slack_bot_token \
--env SLACK_SIGNING_SECRET=your_slack_signing_secret \
enhancedocs/enhancedocs
Replace xoxb-your_slack_bot_token with the bot token you obtained from the Slack API portal, and your_slack_signing_secret with the corresponding signing secret.
Summary
By following these steps, you can successfully enable EnhanceDocs Server integration for Slack, allowing you to access the AI-powered search engine within your Slack workspace.
