How to Create a Workflow that Responds to an Emoji Reaction on a Slack Message?

This topic was automatically generated from Slack. You can find the original thread here.

I am building a workflow wherein an action step is to send a Slack message in a channel. I want to add another step where when someone reacted the thumbs up emoji to the Message sent by the workflow action, the action will reply to the thread. Is there any step I need to do for this to happen or if there’s any JSCODE I can run.

To achieve your goal of replying to a Slack message thread when someone reacts with a thumbs up emoji, you can use the following steps in your Pipedream workflow: 1. Trigger: Use the “New Reaction Added (Instant)” trigger to detect when someone adds a reaction to a message. 2. Action: Use the “Reply to a Message Thread” action to send a reply to the thread. Here are the detailed steps: ### Step 1: Trigger - New Reaction Added (Instant) 1. Search for the Slack app from the trigger menu. 2. Select the “New Reaction Added (Instant)” trigger. 3. Connect your Slack account. 4. Follow the instructions on the trigger configuration screen. You may need to generate a test event from Slack to get real data to test your workflow. ### Step 2: Action - Reply to a Message Thread 1. Search for the Slack app from the step menu. 2. Select the “Reply to a Message Thread” action. 3. Connect your Slack account. 4. Select a Thread Timestamp or pass a string from a previous step. 5. Select a Channel or pass a string from a previous step. 6. Select a Text or pass a string from a previous step. 7. At the bottom of the step, click Test to run the action and test the configuration. ### Example Workflow Here’s an example of how you can set up the workflow using Pipedream components: #### Trigger: New Reaction Added (Instant) ```
import { axios } from “@pipedream/platform”; export default defineComponent({ props: { slack: { type: “app”, app: “slack”, }, }, async run({ steps, $ }) { const reaction = steps.trigger.event.reaction; const channel = steps.trigger.event.item.channel; const timestamp = steps.trigger.event.item.ts; if (reaction === “thumbsup”) { return await axios($, { url: https://slack.com/api/chat.postMessage, method: “POST”, headers: { Authorization: Bearer ${this.slack.$auth.oauth_access_token}, }, data: { channel: channel, thread_ts: timestamp, text: “Thank you for the thumbs up!”, }, }); } }, });

I am building a workflow wherein an action step is to send a Slack message in a channel. I want to add another step where when someone reacted the thumbs up emoji to the Message sent by the workflow action, the action will reply to the thread. Is there any step I need to do for this to happen or if there’s any JSCODE I can run. The trigger when someone added an emoji should be already part of an existing workflow that already has a trigger.

To build a workflow that sends a Slack message and then replies to the thread when someone reacts with a thumbs-up emoji, you can follow these steps: 1. Send a Slack Message: Use the pre-built action to send a message to a Slack channel. 2. Trigger on New Reaction Added: Use the pre-built trigger to detect when a reaction is added to a message. 3. Reply to the Message Thread: Use the pre-built action to reply to the message thread when the thumbs-up emoji is detected. Here’s a step-by-step guide to achieve this: ### Step 1: Send a Slack Message 1. Search for the Slack app from the step menu. 2. Select the Send Message to a Public Channel action. 3. Connect your Slack account. 4. Select the channel and write your message. 5. At the bottom of the step, click Test to run the action and test the configuration. ### Step 2: Trigger on New Reaction Added 1. Search for the Slack app from the trigger menu. 2. Select the New Reaction Added (Instant) trigger. 3. Connect your Slack account. 4. Follow the instructions on the trigger configuration screen. You may need to generate a test event from Slack to get real data to test your workflow. ### Step 3: Reply to the Message Thread 1. Search for the Slack app from the step menu. 2. Select the Reply to a Message Thread action. 3. Connect your Slack account. 4. Select the Thread Timestamp or pass a string from a previous step. 5. Select the Channel or pass a string from a previous step. 6. Select the Text or pass a string from a previous step. 7. At the bottom of the step, click Test to run the action and test the configuration. ### Example Workflow Here’s an example of how your workflow might look: 1. Trigger: Your existing workflow trigger. 2. Action: Send a message to a Slack channel. 3. Trigger: New Reaction Added (Instant). 4. Action: Reply to the message thread. ### Example Code for Custom Step If you prefer to use custom code to handle the reaction and reply, you can use the following Pipedream component code: ``` import { axios } from “@pipedream/platform”; export default defineComponent({ props: { slack: { type: "