digitalservicebund / troi-slack-bot

Slack bot to help you fill out Troi

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

🤖 ⏳ BleibTroy

Slack bot to help you fill out Troi. Uses the Bolt framework and the troi-library to talk with the Troi API.

👉 Also check out our other self-built clients for Troi: Achill and troi-cli.

Setup the Slack app at api.slack.com

The following steps for setting up the Slack app are adapted from this tutorial. You need admin rights in your Slack workspace.

  • Create New App on api.slack.com/apps --> From scratch
  • On the Basic Information page you land, the Signing Secret under App Credentials is the SIGNING_SECRET we need
  • OAuth & Permissions --> Bot Token Scopes --> click Add an OAuth Scope --> chat:write, im:history, users:read, users:read.email
  • Scroll up to OAuth Tokens for Your Workspace and click Install to Workspace
  • After that, a Bot User OAuth Token gets generated, that's the BOT_USER_OAUTH_TOKEN we need
  • Under Socket Mode (left sidebar) turn on Enable Socket Mode, here you create the SOCKET_MODE_TOKEN
  • Under Event Subscriptions (left sidebar) turn on Enable Events and add the Bot User Events message.im
  • Under App Home (left sidebar) show bot as always online if you want to and set the checkmark below the turned on Messages Tab to active
  • Under App Manifest (left sidebar) set messages_tab_enabled to true (as seen here) --> Save Changes
  • If you make changes to scopes/permissions etc., reinstall the your app to the Workspace (under Basic Information, Install your app)

Setup the code locally

npm i

Create ./config.json:

{
  "TROI_API_URL": "",
  "TROI_CLIENT_NAME": "",
  "TROI_USERNAME": "",
  "TROI_PASSWORD": "",
  "SLACK_BOT_USER_OAUTH_TOKEN": "",
  "SLACK_SIGNING_SECRET": "",
  "SLACK_SOCKET_MODE_TOKEN": "",
  "GOOGLE_SHEETS_API_KEY": "",
  "GOOGLE_SHEET_TROI_SAYINGS_ID": ""
}

Run

npm start

About

Slack bot to help you fill out Troi

License:MIT License


Languages

Language:JavaScript 100.0%