Simple node
script listening for certain events on socket.io
and announce them in a Slack channel
Once a official match starts, a message will be posted showing the two players and a link to spectate the match
For each leg finishing, a message will be posted to the thread of the original message, showing who won the leg, with what checkout and after how many darts
Once the match finishes, the original messag will be updated with the final result, as well as a link to the match result
- Install all dependencies
npm install
- Verify your integration with the following command, it will post a test message to verify the integration
SLACK_CHANNEL=<channel_id> SLACK_KEY=<oauth_token> npm start verify
- Run with
ANNOUNCE=true SLACK_CHANNEL=<channel> SLACK_KEY=<key> DEBUG=kcapp* npm start
# ... or
SLACK_CHANNEL=<channel> SLACK_KEY=<key> npm run prod
# ... or for development (will not actually post anything)
npm run dev
To make the slack-announcer
work it must be linked to a Slack app, see below section for Slack setup
Configuration is done via the following environment variables
ANNOUNCE
: By default no messages are posted, so this must be set totrue
to post. If not messages will only be logged out for debuggingSLACK_CHANNEL
: ID of the Slack channel to post toSLACK_KEY
: Bot UserOAuth Access Token
DEBUG
: value is passed to debug module to specify which packages should be loggedGUI_URL
: This is used for all links posted on Slack, defaults tohttp://localhost:3000
If you are running on non-standard setup, you might also need to specify
API_URL
: By default it assumes the API is running onhttp://localhost:8001
KCAPP_HOST
: Host ofkcapp
socketio, default tolocalhost
KCAPP_PORT
: Port ofkcapp
socketio, default to3000
KCAPP_PROTO
: Protocol, default tohttp
To run this as a service see kcapp-announcer.service
- Create a new Slack App with the following
App Manifest
display_information:
name: kcapp
description: Dart Scoring Application
background_color: "#2c2d30"
features:
bot_user:
display_name: kcapp
always_online: true
oauth_config:
scopes:
bot:
- channels:read
- chat:write
- groups:read
- reactions:read
- reactions:write
settings:
org_deploy_enabled: false
socket_mode_enabled: false
token_rotation_enabled: false
- Install the app into your workspace