- Built using Slack's Bolt Framework, send hourly message to channel, (since the bot joined the channel) asking if user has any query.
- Mention the bot in the channel with the query and the bot will respond with the result.
- Welcomes the new user in the channel.
- Can be installed in any workspace using the OAuth flow.
- Uses OpenAI's API to translate natural language to SQL query.
how many users from Lucknow use Samsung phones?
-
Visit https://databot.onrender.com/slack/install and click on
Add to Slack
button, you will be redirected to Slack's OAuth page and accept the permissions. -
Invite the bot to the channel you want to use it in.
-
Mention the bot in the channel with the query and the bot will respond with the result.
eg:
@databot how many users from Lucknow use Samsung phones?
- Clone the repository
git clone https://github.com/rohit1kumar/slack-bot.git
- Create the
.env
, by running the following command:
cp .env.example .env
- Download and install ngrok and run the following command:
ngrok http 3000
- Create a Slack App, Copy the https url generated by ngrok and paste it in the event subscriptions page with the path
/slack/events
and subscribe to the following events:
app_mention
channel_left
member_joined_channel
- Add redirect url in Oauth & Permissions page with the path
/slack/oauth_redirect
and add these scopes:
chat:write
groups:read
channels:join
channels:read
app_mentions:read
- Install the app in your workspace and copy the following credentials from the app under
Basic Information
section and OpenAI keys from OpenAI's and paste it in the.env
file.
SLACK_SIGNING_SECRET
CLIENT_SECRET
CLIENT_ID
OPENAI_API_KEY
- You can seed the SQLite database with the following command:
npm run seed
- Run the docker and execute the following commands to start the bot:
chmod +x docker_run.sh
./docker_run.sh
Note: having some issue related to SQLITE while running the project in Docker, so run this locally for now.