Skip to content

A Slack Bot with Data Querying Capabilities, Easy to Install in Any Workspace.

Notifications You must be signed in to change notification settings

rohit1kumar/slack-bot

Repository files navigation

Databot

A Slack bot with data querying capabilities

  • 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.

Try asking question in this manner:

how many users from Lucknow use Samsung phones?

How to Install & Use the bot in your workspace

  1. 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.

  2. Invite the bot to the channel you want to use it in.

  3. 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?

  4. Watch the video below to see how to use the bot. Watch this video


Installation for local development

  1. Clone the repository
    git clone https://github.com/rohit1kumar/slack-bot.git
  1. Create the .env, by running the following command:
    cp .env.example .env
  1. Download and install ngrok and run the following command:
    ngrok http 3000
  1. 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
  1. 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
  1. 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
  1. You can seed the SQLite database with the following command:
    npm run seed
  1. 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.

About

A Slack Bot with Data Querying Capabilities, Easy to Install in Any Workspace.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published