Slackcat but strongly typed
The*Graphs.kt
classes are a very simple global singleton dependency graph.
For a real app, you would use something like Dagger instead.# slackcat-kt
Slackcat but strongly typed
You can run commands locally without using SlackRTM webscoket by adding your command to the program arguments in the run config
For instance if you add ?ping
to program arguments you should get
Cli is connected
Starting slackcat using Cli engine
Incoming message: ?ping
Outgoing message: OutgoingChatMessage(channelId=123456789, text=pong)
- Edit run configuration
- Open environmental variables
- add
- SLACK_APP_TOKEN
- SLACK_BOT_TOKEN
- Profit.
- Go to your Slack app's dashboard.
- Navigate to Features > Event Subscriptions.
- Toggle Enable Events to On.
- In the Event Subscriptions page, scroll down to Subscribe to bot events.
- Click on Add Bot User Event.
- Add the following events based on your needs:
message.channels
(for messages in public channels)message.im
(for direct messages)message.groups
(for private channels)message.mpim
(for group direct messages)
- Navigate to OAuth & Permissions in your app's dashboard.
- In the Scopes section, under Bot Token Scopes, add the following scopes:
channels:history
(to read messages in channels)groups:history
(for private channels)im:history
(for direct messages)mpim:history
(for group direct messages)channels:join
(if your bot needs to join channels automatically)chat:write
(to send messages)
- After making changes to scopes and event subscriptions, you need to reinstall the app to your workspace for the changes to take effect.
- Go to OAuth & Permissions and click Install App to Workspace.
- Ensure that your bot is a member of the channels where it needs to listen to messages.
- You can invite the bot to a channel by typing
/invite @YourBotName
in Slack.
docker-compose --env-file path/to/your/.env up --build
Testing
docker-compose up --build -d && docker exec -it slack-bot /bin/sh