Skip to content
This repository has been archived by the owner on Jan 22, 2022. It is now read-only.
/ honyaku-flag Public archive

🚩 A Slack app that translates a message when an emoji reaction added to the message.

License

Notifications You must be signed in to change notification settings

kentaro-m/honyaku-flag

Repository files navigation

🚩 Honyaku Flag

A Slack app that translates a message when an emoji reaction added to the message. Inspired by reacjilator.

LGTM

📺 Demo

Demo

🤖 Set up the app

  1. Create the new app.

Slack API: Applications | Slack

  1. Subscribe to workspace events (Add reaction_added event and subscribe url to be notified of events).
  2. Add permission scopes by reference to the following list.
  • channels:history Access user’s public channels
  • channels:read Access information about user’s public channels
  • reactions:read Access the workspace’s emoji reaction history
  1. Install the app to the workspace and note OAuth Access Token, Bot User OAuth Access Token and Signing Secret.

  2. Create the Google Cloud Translation API by reference to the following page.

Using API Keys  |  Authentication  |  Google Cloud

  1. 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).

auth.test method | Slack

👷 Develop

Subscribe locally events from Slack

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

Run the app

$ npm install
$ npm run dev

🚀 Deploy

WIP

📝 LICENSE

MIT

About

🚩 A Slack app that translates a message when an emoji reaction added to the message.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published