GitHub

Slack bot to get user details.

Inspiration: https://github.com/jainishshah17/slack-weather-bot

Prerequisites

Getting started

  • Checkout code:
git checkout https://github.com/budavariam/hackathon-slack-bot.git
  • Install Npm dependencies:
cd hackathon-slack-bot
npm install
  • Create Slack App

    1. Go to https://api.slack.com/apps
    2. Create New App: Name: Hackathon Development Slack Workspace: Choose your workspace
    3. Add preferred logo and description: "Get User info by searchstring."
    4. Copy Signing Secret and store it in .env file.
    5. Go to Basic Information -> Add Features and functionality -> add Slash commands
    6. Go to Features -> OAuth & Permissions -> OAuth Tokens & Redirect URLs. Then copy OAuth Access Token and store it in .env file.
  • Start app server

    npm start
  • Install and run Ngrok

npm install -g ngrok
ngrok http 3333
## You will see output like following
ngrok by @inconshreveable     (Ctrl+C to quit)
Session Status                online
Session Expires               7 hours, 59 minutes
Version                       2.3.40
Region                        Europe (eu)
Web Interface                 http://127.0.0.1:4040
Forwarding                    http://c1219f73.ngrok.io -> http://localhost:3333
Forwarding                    https://c1219f73.ngrok.io -> http://localhost:3333
Connections                   ttl     opn     rt1     rt5     p50     p90
                              0       0       0.00    0.00    0.00    0.00
  • Create Slash Command in Hackathon Slack App we created
    1. Go to Features -> Slash Commands -> Click on Create New Command

      • Provide following details for new slash command:
      • Command: /whois
      • Request URL: https://c1219f73.ngrok.io/ (Note:Use your ngrok generated HTTPS URL)
      • Short Description: Get User info by searchstring.
      • Usage Hint: [searchstring]
    2. Go to slack and type /whois sky to see the magic!

      Demo image

Read the original on github.com ↗