Using Defog's Slack Integration
You can easily integrate Defog with your Slack workspace. This allows you to ask questions and get answers from your database without leaving Slack.
Start your docker image, and ensure that it is publicly accessible via an HTTPS API
This step is crucial, as Slack does not allow connections to HTTP endpoints or to private IPs. You can use a VPN or a service like ngrok (opens in a new tab) to expose your local server to the internet.
Go to api.slack.com, and create a new Slack bot by clicking on “Create New App”
Go to Slack's API page at https://api.slack.com (opens in a new tab), and create a new Slack bot by clicking on “Create New App”.
Select the “From Manifest" option, and select the workspace you want to install it in
Select the YAML
option, and paste the following string.
Remember to change the YOUR-DEFOG-DOMAIN
bit below to the HTTPS domain where your docker image is running.
display_information:
name: Defog AI
features:
bot_user:
display_name: Defog AI
always_online: true
oauth_config:
scopes:
user:
- users:read
bot:
- chat:write
- files:write
- im:history
- im:read
- mpim:history
- mpim:read
- users:read
- users:read.email
- chat:write.public
settings:
event_subscriptions:
request_url: YOUR-DEFOG-DOMAIN/slack/events
bot_events:
- message.im
- message.mpim
interactivity:
is_enabled: true
request_url: YOUR-DEFOG-DOMAIN/slack/interactions
org_deploy_enabled: false
socket_mode_enabled: false
token_rotation_enabled: false
Install the app in your workspace
Next, go to the OAuth & Permissions page, and install the app to your Workspace. Then, copy the Bot User OAuth Token
and use its value for the SLACK_BOT_TOKEN
variable inside the .env
file of your defog-docker
project.
Restart your docker image
Restart your docker image with this new env variable added in (in production), using docker compose up --detach
Start chatting with Defog in Slack
Note that only users whose email ids have been added to Defog will be able to ask questions.
After this, you should be able to simply as a question straight from Slack by going to the app and messaging with it. You will have to ensure that the email id you are using to ask questions is added to Defog, using the Manage Users option.