https://github.com/fsmaia/slack-app-example
Slack app service example for demonstration purposes
https://github.com/fsmaia/slack-app-example
slack slack-app slack-bot slack-webhooks
Last synced: about 1 month ago
JSON representation
Slack app service example for demonstration purposes
- Host: GitHub
- URL: https://github.com/fsmaia/slack-app-example
- Owner: fsmaia
- License: mit
- Created: 2020-06-12T01:21:32.000Z (about 6 years ago)
- Default Branch: master
- Last Pushed: 2023-07-18T22:29:54.000Z (almost 3 years ago)
- Last Synced: 2024-04-14T06:00:23.146Z (about 2 years ago)
- Topics: slack, slack-app, slack-bot, slack-webhooks
- Language: TypeScript
- Size: 320 KB
- Stars: 0
- Watchers: 2
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# slack-app-example
This repository is a Node.js (Express) server that powers a full-featured example Slack application for demonstration purposes.
## Getting started
- Install the dependencies
```bash
npm install
```
- Start the service
```bash
npm start
```
## Setting up the environment
The following environment variables must be provided:
| Variable | Description |
| --------------------- | --------------------------------------- |
| `BOT_ACCESS_TOKEN` | Application bot user OAuth access token |
| `CHANNEL_WEBHOOK_URL` | Application main channel webhook URL |
| `CLIENT_ID` | Application client id |
| `CLIENT_SECRET` | Application client secret |
| `SIGNING_SECRET` | Application signing secret |
Reference: https://api.slack.com/docs/oauth
## Features
### Event subscriptions
This server holds an event subscription listener in `/event-listener`, which allows the application to listen to Slack configured events.
In this example it will be mentions to the application bot.
Reference: https://api.slack.com/events
### Slash commands
This server holds a command listener in `/commands`, which allows the application to listen to slash commands (e.g. `/start`).
In this example the following commands will be handled:
| Command | Description | Server endpoint |
| --------------------- | ----------------------- | -------------------------- |
| `/announce ` | Creates an announcement | /commands/announce |
| `/poll ` | Starts a poll | /commands/poll |
| `/start_discussion` | Starts a discussion | /commands/start_discussion |
Reference: https://api.slack.com/interactivity/slash-commands
### Interactivity
This server holds an interactive endpoint in `/interactivity`, which allows the application to have interactions with shortcuts, modals, or interactive components.
In this example the `Starts a discussion` shortcut will be handled.
Reference: https://api.slack.com/messaging/interactivity
#### Useful links
- Block kit builder: https://api.slack.com/tools/block-kit-builder
#### Registered shortcuts
| Name | Description | Callback ID |
| ------------------ | ------------------- | ---------------- |
| Start a discussion | Starts a discussion | start_discussion |