Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/digitalservicebund/troi-slack-bot
Slack bot to help you fill out Troi
https://github.com/digitalservicebund/troi-slack-bot
bot slack timesheets
Last synced: about 1 month ago
JSON representation
Slack bot to help you fill out Troi
- Host: GitHub
- URL: https://github.com/digitalservicebund/troi-slack-bot
- Owner: digitalservicebund
- License: mit
- Created: 2022-05-09T14:30:42.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2022-09-12T09:01:21.000Z (over 2 years ago)
- Last Synced: 2023-08-04T13:56:32.920Z (over 1 year ago)
- Topics: bot, slack, timesheets
- Language: JavaScript
- Homepage:
- Size: 216 KB
- Stars: 0
- Watchers: 14
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# 🤖 ⏳ BleibTroy
Slack bot to help you fill out Troi. Uses the [Bolt](https://github.com/SlackAPI/bolt-js) framework and the [troi-library](https://github.com/digitalservice4germany/troi-library) to talk with the [Troi API](https://v2.troi.dev/).#### 👉 Also check out our other self-built clients for Troi: [Achill](https://github.com/digitalservice4germany/achill) and [troi-cli](https://github.com/digitalservice4germany/troi-cli).
## Setup the Slack app at api.slack.com
The following steps for setting up the Slack app are adapted from [this](https://slack.dev/bolt-js/tutorial/getting-started) tutorial. You need admin rights in your Slack workspace.
- *Create New App* on [api.slack.com/apps](https://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](https://stackoverflow.com/a/69937581)) --> *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
```js
npm i
```Create `./config.json`:
```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
```bash
npm start
```