{"id":26289958,"url":"https://github.com/slack-samples/deno-message-translator","last_synced_at":"2025-05-07T22:43:50.402Z","repository":{"id":114488832,"uuid":"575938131","full_name":"slack-samples/deno-message-translator","owner":"slack-samples","description":"Translate message text to different languages using reactions","archived":false,"fork":false,"pushed_at":"2025-02-20T00:04:10.000Z","size":431,"stargazers_count":43,"open_issues_count":0,"forks_count":11,"subscribers_count":9,"default_branch":"main","last_synced_at":"2025-03-31T15:00:03.111Z","etag":null,"topics":["deepl","deno","i18n","internationalization","next-gen","slack-api","slack-apis","slack-bot","slackapi","slackbot","translation"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/slack-samples.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-12-08T16:29:44.000Z","updated_at":"2025-03-26T20:33:06.000Z","dependencies_parsed_at":null,"dependency_job_id":"489e77af-a838-4e49-aba5-da217a07e403","html_url":"https://github.com/slack-samples/deno-message-translator","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":"slack-samples/deno-starter-template","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-samples%2Fdeno-message-translator","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-samples%2Fdeno-message-translator/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-samples%2Fdeno-message-translator/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/slack-samples%2Fdeno-message-translator/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/slack-samples","download_url":"https://codeload.github.com/slack-samples/deno-message-translator/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252967973,"owners_count":21833245,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["deepl","deno","i18n","internationalization","next-gen","slack-api","slack-apis","slack-bot","slackapi","slackbot","translation"],"created_at":"2025-03-14T23:17:28.761Z","updated_at":"2025-05-07T22:43:50.380Z","avatar_url":"https://github.com/slack-samples.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Message Translator (powered by DeepL API)\n\nThe sample features a message translation automation. The app is added to\ndesignated channels by running a configurator workflow. Once added to specific\nchannels, the app will translate any message there when a user adds a reaction\nto the message (ex: 🇺🇸, 🇪🇸, 🇫🇷, 🇯🇵, and more)!\n\nTo learn the full list of the supported languages, head to\n[the DeepL API's document site](https://www.deepl.com/en/docs-api).\n\n**Guide Outline**:\n\n- [Included Workflows](#included-workflows)\n- [Setup](#setup)\n  - [Install the Slack CLI](#install-the-slack-cli)\n  - [Clone the Template](#clone-the-template)\n  - [Create DeepL API Account](#create-deepl-api-account)\n- [Creating Triggers](#creating-triggers)\n- [Datastores](#datastores)\n- [Testing](#testing)\n- [Deploying Your App](#deploying-your-app)\n- [Viewing Activity Logs](#viewing-activity-logs)\n- [Project Structure](#project-structure)\n- [Resources](#resources)\n\n---\n\n## Included Workflows\n\n- **Reacjilator:** Runs when a user reacts to a message in a channel where the\n  app is added. If the reaction is a supported flag emoji (ex: 🇺🇸, 🇪🇸, 🇫🇷, 🇯🇵),\n  then the app will respond in the message thread with a translated message in a\n  language corresponding to the flag a user reacted with.\n\n## Setup\n\nBefore getting started, first make sure you have a development workspace where\nyou have permission to install apps. **Please note that the features in this\nproject require that the workspace be part of\n[a Slack paid plan](https://slack.com/pricing).**\n\n### Install the Slack CLI\n\nTo use this sample, you need to install and configure the Slack CLI.\nStep-by-step instructions can be found in our\n[Quickstart Guide](https://api.slack.com/automation/quickstart).\n\n### Clone the Sample\n\nStart by cloning this repository:\n\n```zsh\n# Clone this project onto your machine\n$ slack create my-app -t slack-samples/deno-message-translator\n\n# Change into the project directory\n$ cd my-app\n```\n\n### Create DeepL API Account\n\nThis sample requires a valid DeepL API access token for text translation. Head\nto [the DeepL API site](https://www.deepl.com/en/docs-api) and create\n[your own API account](https://www.deepl.com/account/summary).\n\n**Please note that API accounts are different from DeepL's regular accounts**.\nEven when you already have an account for using the text translation on the\nwebsite, a separate account for API access needs to be created.\n\nOnce you create your API account, copy the API token string on\n[the account summary page](https://www.deepl.com/account/summary), which is used\nfor the next section.\n\n#### Development Environment Variables\n\nWhen [developing locally](https://api.slack.com/automation/run), environment\nvariables found in the `.env` file at the root of your project are used. For\nlocal development, rename `.env.sample` to `.env` and add your access token to\nthe file contents (replacing `ACCESS_TOKEN` with your token):\n\n```bash\n# .env\nDEEPL_AUTH_KEY=ACCESS_TOKEN\n```\n\n#### Production Environment Variables\n\n[Deployed apps](https://api.slack.com/automation/deploy) use environment\nvariables that are added using `slack env`. To add your access token to a\nWorkspace where your deployed app is installed, use the following command (once\nagain, replacing `ACCESS_TOKEN` with your token):\n\n```zsh\n$ slack env add DEEPL_AUTH_KEY YOUR_ACCESS_TOKEN\n```\n\n## Running Your Project Locally\n\nWhile building your app, you can see your changes appear in your workspace in\nreal-time with `slack run`. You'll know an app is the development version if the\nname has the string `(local)` appended.\n\n```zsh\n# Run app locally\n$ slack run\n\nConnected, awaiting events\n```\n\nTo stop running locally, press `\u003cCTRL\u003e + C` to end the process.\n\n## Creating Triggers\n\n[Triggers](https://api.slack.com/automation/triggers) are what cause workflows\nto run. These triggers can be invoked by a user, or automatically as a response\nto an event within Slack.\n\nWhen you `run` or `deploy` your project for the first time, the CLI will prompt\nyou to create a trigger if one is found in the `triggers/` directory. For any\nsubsequent triggers added to the application, each must be\n[manually added using the `trigger create` command](#manual-trigger-creation).\n\nWhen creating triggers, you must select the workspace and environment that you'd\nlike to create the trigger in. Each workspace can have a local development\nversion (denoted by `(local)`), as well as a deployed version. _Triggers created\nin a local environment will only be available to use when running the\napplication locally._\n\n### Event Triggers\n\nThis app requires a reaction_added event trigger. You can enable it by running\nthe following command:\n\n```bash\nslack trigger create --trigger-def triggers/reaction_added_trigger.ts\n```\n\nTriggers are _unique to each installed version of your app_. This means that\nShortcut URLs will be different across each workspace, as well as between\n[locally run](#running-your-project-locally) and\n[deployed apps](#deploying-your-app).\n\n**Note: triggers won't run the workflow unless the app is either running locally\nor deployed!**\n\n### Usage\n\nOnce this app's bot user is added to a channel, adding reactions such as `:jp:`\nand `:fr:` results in posting translation results of the target message as\nreplies in its thread.\n\n\u003cimg width=\"600\" src=\"https://user-images.githubusercontent.com/19658/206638194-6eff88fa-05c1-4308-a180-0a547890aab6.png\"\u003e\n\n## Datastores\n\nFor storing data related to your app, datastores offer secure storage on Slack\ninfrastructure. The use of a datastore requires the\n`datastore:write`/`datastore:read` scopes to be present in your manifest.\n\n## Testing\n\nFor an example of how to test a function, see `functions/translate_test.ts`.\nTest filenames should be suffixed with `_test`.\n\nRun all tests with `deno test`:\n\n```zsh\n$ deno test\n```\n\n## Deploying Your App\n\nOnce development is complete, deploy the app to Slack infrastructure using\n`slack deploy`:\n\n```zsh\n$ slack deploy\n```\n\nWhen deploying for the first time, you'll be prompted to\n[create a new event trigger](#creating-triggers) for the deployed version of\nyour app. Please note that you need to add the production app's bot user to all\nthe channels you'd like to enable the app.\n\n## Viewing Activity Logs\n\nActivity logs of your application can be viewed live and as they occur with the\nfollowing command:\n\n```zsh\n$ slack activity --tail\n```\n\n## Project Structure\n\n### `.slack/`\n\nContains `apps.dev.json` and `apps.json`, which include installation details for\ndevelopment and deployed apps.\n\n### `datastores/`\n\n[Datastores](https://api.slack.com/automation/datastores) securely store data\nfor your application on Slack infrastructure. Required scopes to use datastores\ninclude `datastore:write` and `datastore:read`.\n\n### `functions/`\n\n[Functions](https://api.slack.com/automation/functions) are reusable building\nblocks of automation that accept inputs, perform calculations, and provide\noutputs. Functions can be used independently or as steps in workflows.\n\n### `triggers/`\n\n[Triggers](https://api.slack.com/automation/triggers) determine when workflows\nare run. A trigger file describes the scenario in which a workflow should be\nrun, such as a user pressing a button or when a specific event occurs.\n\n### `workflows/`\n\nA [workflow](https://api.slack.com/automation/workflows) is a set of steps\n(functions) that are executed in order.\n\nWorkflows can be configured to run without user input or they can collect input\nby beginning with a [form](https://api.slack.com/automation/forms) before\ncontinuing to the next step.\n\n### `manifest.ts`\n\nThe [app manifest](https://api.slack.com/automation/manifest) contains the app's\nconfiguration. This file defines attributes like app name and description.\n\n### `slack.json`\n\nUsed by the CLI to interact with the project's SDK dependencies. It contains\nscript hooks that are executed by the CLI and implemented by the SDK.\n\n## Resources\n\nTo learn more about developing automations on Slack, visit the following:\n\n- [Automation Overview](https://api.slack.com/automation)\n- [CLI Quick Reference](https://api.slack.com/automation/cli/quick-reference)\n- [Samples and Templates](https://api.slack.com/automation/samples)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslack-samples%2Fdeno-message-translator","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fslack-samples%2Fdeno-message-translator","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fslack-samples%2Fdeno-message-translator/lists"}