Giter Club home page Giter Club logo

slack-bot's Introduction

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.

slack-bot's People

Contributors

rohit1kumar avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.