DEV Community

Rui Kowase
Rui Kowase

Posted on

Auto translation bot for Slack using Zapier

I created an auto translation bot for Slack using Zapier.

How to use

Add the reaction specified Zapier to the comment you want to translate.

How it works

The slack bot post a translated comment into thread when the reaction specified by Zapier is added.

How to create this Zap

Overview

1. Add TRIGGER - Slack (New Reaction Added)

Set which reaction will be triggered.

  • Reaction: 2en (Specify any Emoji)
  • Channel: (Not specified)
  • User: (Not specified)

2. Add FILTER - Filter by Zapier (Only continue if...)

Add this filter if you want to trigger the specific channels. (This task is optional)

3. Add ACTION - Formatter by Zapier (Text)

Extract the ID of the reacted comment from the permalink to prevent multiple posting.

  • Transform: Extract Pattern
  • Values (Input): The Message Permalink of Step 1
  • Pattern: .*/(.*)(\?.*)?

4. Add SEARCH - Slack (Find Message)

Search the ID of the reacted comment to prevent multiple posting.

  • Search Query: in:#<MESSAGE_CHANNEL_NAME> from:2en <OUTPUT_OF_STEP3>
  • Sort By: (Not specified)
  • Sort Direction: (Not specified)

5. Add FILTER - Filter by Zapier (Only continue if...)

Filter the Permalink of Step 4 to prevent multiple posting.

6. Add ACTION - Translate by Zapier (Translate Text)

Translate the original comment into English.

  • Source Language: (Not specified)
  • Text: The Message Text of Step 1
  • Target Language: English

7. Add ACTION - Slack (Send Channel Message)

Post the translated comment.

  • Channel: Use a Custom Value
  • Custom Value for Channel ID: The Message Channel Name of Step 1
  • Message Text: <TRANSLATION_OF_STEP6> <PERMALINK_OF_STEP1> original comment (<OUTPUT_OF_STEP3>) (<SOURCE_LANGUAGE_OF_STEP6>)

Post into thread.

  • Thread: Use a Custom Value
  • Custom Value for Thread Timestamp: The Message Ts of Step 1

Top comments (0)