A Slack app that translates a message when an emoji reaction added to the message. Inspired by reacjilator.
- Create the new app.
Slack API: Applications | Slack
- Subscribe to workspace events (Add
reaction_added
event and subscribe url to be notified of events). - Add permission scopes by reference to the following list.
channels:history
Access user’s public channelschannels:read
Access information about user’s public channelsreactions:read
Access the workspace’s emoji reaction history
-
Install the app to the workspace and note
OAuth Access Token
,Bot User OAuth Access Token
andSigning Secret
. -
Create the Google Cloud Translation API by reference to the following page.
Using API Keys | Authentication | Google Cloud
- Rename the
.env.example
to.env
and add credentials.
SLACK_BOT_TOKEN=<Bot User OAuth Access Token>
SLACK_OAUTH_TOKEN=<OAuth Access Token>
SLACK_SIGNING_SECRET=<Signing Secret>
TRANSLATION_API_TOKEN=<Google Cloud Translation API Token>
If you want to run the app only on the channel which the app was invited, you need to add SLACK_USER_ID
to .env
.
Add a permission scope:
users:read
Access your workspace’s profile information
Get the SLACK_USER_ID
by reference to the following page (Select the workspace which the app was installed and input SLACK_BOT_TOKEN
as a token).
Set up to subscribe locally events by reference to the following page.
Using ngrok to develop locally for Slack | Slack
Add the URL of Forwarding
to Request URL
with Event Subscriptions page in Slack (Concatenate the URL of Forwarding
to the path /slack/events
. e.g. https://foobar.ngrok.io/slack/events
).
$ ngrok http 8080
ngrok by @inconshreveable (Ctrl+C to quit)
Session Status online
Session Expires 7 hours, 47 minutes
Update update available (version 2.3.34, Ctrl-U to update
Version 2.2.8
Region United States (us)
Web Interface http://127.0.0.1:4040
Forwarding http://foobar.ngrok.io -> localhost:3000
Forwarding https://foobar.ngrok.io -> localhost:3000
$ npm install
$ npm run dev
WIP
MIT