Skip to content

Commit

Permalink
added more docs
Browse files Browse the repository at this point in the history
  • Loading branch information
dominikwilkowski committed Jun 3, 2021
1 parent 793c43a commit ece88d6
Show file tree
Hide file tree
Showing 2 changed files with 46 additions and 5 deletions.
38 changes: 36 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,44 @@
<img src="assets/beacon.svg" alt="A lighthouse with a person shininy a light on a red background.">
</p>

Screenshot:
## Content

- [Installation](#installation)
- [Customization](#customization)
- [Development](#development)
- [Version History](#version-history)

## Installation

To install this app yourself you have to host it online and install a new app in slack via https://api.slack.com/apps.
It will need bot token scope:

- `chat:write`
- `chat:write.customize`
- `im:read`
- `im:write`
- `users:read`

And you'll need to copy the `User OAuth Token` and the `Bot User OAuth Token` into your `.env` file which you can get from the `OAuth & Permissions` page of your app.

Lastly you have to add the url to Slack in both the `Event Subscriptions` and `Interactivity & Shortcuts` sections. Note that the app is listening on the path `slack/events`.

## Customization

This app comes with a home screen that allows you to send messages to people in the slack workspace.

<p align="center">
<img height="400" src="assets/screenshot.png" alt="The interface of Beacon.">
</p>

More text
You can make changes to the home screen by editing the `src/home.js` file.
Use the https://app.slack.com/block-kit-builder to help you edit this file.

## Development

To run this repo please install dependencies via `yarn` and run the app via `yarn start`.
After changes please run `yarn format` to run `prettier`.

## Version History

- v1.0.0 - First release
13 changes: 10 additions & 3 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,16 @@ const home = require('./home');
require('dotenv').config({ path: path.normalize(`${__dirname}/../.env`) });
const TOKEN = process.env.TOKEN;
const SLACK_SIGNING_SECRET = process.env.SLACK_SIGNING_SECRET;
const DEFAULT_USER = JSON.parse(process.env.DEFAULT_USER);
const DEFAULT_USER = JSON.parse(process.env.DEFAULT_USER || '{}');
const PORT = process.env.PORT || 3000;

if (!TOKEN || !SLACK_SIGNING_SECRET) {
throw new Error(
'You need to provide the TOKEN and SLACK_SIGNING_SECRET in your environment'
);
process.exit(1);
}

const app = new App({
token: TOKEN,
signingSecret: SLACK_SIGNING_SECRET,
Expand Down Expand Up @@ -76,12 +83,12 @@ app.action('submit_form', async ({ body, ack, client }) => {
users.map((user) =>
client.chat.postMessage({
text:
`${sender.name} (${sender.username}) has just used *The Beacon* :rotating_light: to alert you of their troubles.\n\n` +
`${sender.name} (@${sender.username}) has just used *The Beacon* :rotating_light: to alert you of their troubles.\n\n` +
`Please follow up with:\n` +
`- Their line manager\n` +
`- Their Squad Leader\n` +
`- Their project/client\n\n` +
`_(Please don't reach out to them right now and give them space for now)_\n\n` +
`_(Also please don't reach out to them right now. Give them space for now and maybe check in tomorrow.)_\n\n` +
(text ? `They added the below message:\n\n>>> ${text}` : ''),
mrkdwn: true,
channel: user,
Expand Down

0 comments on commit ece88d6

Please sign in to comment.