Skip to content

A translation bot that translates a message when a user reacted with an emoji ๐Ÿ‡จ๐Ÿ‡ณ ๐Ÿ‡ฎ๐Ÿ‡น ๐Ÿ‡น๐Ÿ‡ญ ๐Ÿ‡ซ๐Ÿ‡ท ๐Ÿ‡ฏ๐Ÿ‡ต ๐Ÿ‡ฎ๐Ÿ‡ณ ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ง๐Ÿ‡ฌ ๐Ÿ‡น๐Ÿ‡ผ ๐Ÿ‡ฆ๐Ÿ‡ช ๐Ÿ‡ฐ๐Ÿ‡ท

License

Notifications You must be signed in to change notification settings

sardine-ai/slack-emoji-translate

ย 
ย 

Folders and files

NameName
Last commit message
Last commit date

Latest commit

ย 

History

32 Commits
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 
ย 

Repository files navigation

emoji-translator for Slack

This slackbot translates a message when a user reacts with an emoji. For example, when a message gets a :flag-de: reacji, this bot translates the original message to German and posts it in the message thread.

This is baed on https://github.com/slackapi/reacjilator, modified to run on GCP cloud function.

Reacjilator demo

Set Up Your Slack App (one time setup)

  1. Create an app at your Slack App Settings page at api.slack.com/apps
  2. Choose "From an app manifest", select the workspace you want to use, then paste the contents of manifest.yml into the dialog marked "Enter app manifest below".
  3. On the OAuth & Permissions page, install the app and get a Bot User OAuth Token - it begins with xoxb-.
  4. On the Basic Information page, find your Signing Secret and copy it to your .env file as SLACK_SIGNING_SECRET.
  5. Under Event Subscriptions, enable events and set the Request URL to your deployed app URL (e.g., your Google Cloud Function URL).
  6. Subscribe to the reaction_added bot event.

Get your bot token at OAuth & Permissions and your Signing Secret at Basic Information.

Credentials

Rename the .env.sample to .env and fill the env vars with your credentials. You also need Google credentials to use the Google translation API:

SLACK_BOT_TOKEN=
SLACK_SIGNING_SECRET=
GOOGLE_PROJECT_ID=
GOOGLE_APPLICATION_CREDENTIALS=
PORT=3000

Deployment

Local Development

To run the app locally:

npm start

You'll need to expose your local server to the internet using a tool like ngrok to receive events from Slack.

Google Cloud Functions

To deploy to Google Cloud Functions:

npm run deploy

After deployment, set the function URL as your Request URL in the Slack app's Event Subscriptions page.

Difference from reacjilator

This is fork of awesome project https://github.com/slackapi/reacjilator

Main differences are:

  • reacjilator Socket Mode whereas this repo uses HTTP mode, which is easier to deploy and lower cost when usage is small
  • This can be easily deployed to GCP Cloud Run Function

About

A translation bot that translates a message when a user reacted with an emoji ๐Ÿ‡จ๐Ÿ‡ณ ๐Ÿ‡ฎ๐Ÿ‡น ๐Ÿ‡น๐Ÿ‡ญ ๐Ÿ‡ซ๐Ÿ‡ท ๐Ÿ‡ฏ๐Ÿ‡ต ๐Ÿ‡ฎ๐Ÿ‡ณ ๐Ÿ‡บ๐Ÿ‡ธ ๐Ÿ‡ง๐Ÿ‡ฌ ๐Ÿ‡น๐Ÿ‡ผ ๐Ÿ‡ฆ๐Ÿ‡ช ๐Ÿ‡ฐ๐Ÿ‡ท

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • JavaScript 100.0%