Use Emoji React on a Slack message, and send a mail

My goal is, once an email comes in from one of my customers, it will be answered by ChatGPT.

To make sure I like the answer, I want it to be approved in Slack first. Once there is an thumbs up on the reply, this reply is emailed to that customer.

If there is a thumbs down, chatgpt creates a new answer, just until the answer is good and the email can be sent.

I know how to create all the triggers. Except the Slack trigger.

Hi @Joost.7AM!

As you might know, scenario’s run linear from begin to end. Based on your message, you would need multiple scenario’s that run parallel.

  • Scenario 1: listens for incoming mails and forwards them to ChatGPT, the response from ChatGPT is then forwarded to Slack for approval.
  • Scenario 2: listens for responses on Slack messages:
    — If a response is a thumbs down, follow a path where ChatGPT must create a new response.
    — If a response is a thumbs up, use the response from ChatGPT to send a mail.

Now the question is how to keep both scenario’s in sync. Do you need to store the response from ChatGPT somewhere before you send it, or can you pass it to Slack and use the body of the Slack message as content for the mail? And how do you set up the trail to match a Slack message to a response from ChatGPT and the e-mail address of the receiver?

It’s an interesting use-case. What have you come up with so far?

Henk
Certified Make Expert and Partner
Book a consult with me

1 Like

Hi @Henk-Operative, the body of the Slack message can be used. The e-mail is one part, when this is possible anything else can be used (Whatsapp, Teams, whatever).

The trail to match the Slack message and the e-mailadress is the problem, no idea how to fix this because the mail and messages are always variable.

So far so good.

What i come up with so far, is that it works but without the “approve” in Slack section.

Hi @Joost.7AM,

Two things you can consider;

  1. Create a Data Store to keep data of each part in the flow. (sender, message ID’s, message content, etc) When you approve a message in Slack, you can do a lookup in the Data Store for the recipient.
  2. Also pass the e-mail address of the recipient in the Slack message. After you approve the message, you can set up the second scenario to extract and remove the e-mail address from the message. (maybe a plus; you can see the recipient in Slack, too)

Then you can use the e-mail address + message to send your response. This setup will send a new email to the recipient. Do you have the logic in place to make it a response to the original mail by chance?

Cheers,
Henk

1 Like

Hi @Henk-Operative,

When we will send a new mail, i think here will be another problem; The incoming mail is coming from Bol.com, Amazon or any other marketplace, so it’s in there ticketsystem and no idea if it will automaticly respond to the right ticket.

Update

I tried opening a ticket on the Bol platform and sent a new email with the information provided by the ticket system. The ticket was responded correctly.

Original mail title: Klantvraag over artikel met EAN 9509555455781
Case id: 206002079
EAN: 9509555455781

Okay, I see.

If I were to build such a setup, I would do it like this:

  1. scenario that watches incoming mails, stores the email data in a Data Store and prompts ChatGPT for a response + sends the response to Slack.
  2. scenario that watches reactions in Slack:
    If thumbs down, request a new response from ChatGPT, send it to Slack again.
    If thumbs up, queries the Data Store for the corresponding received email, takes the message from Slack and uses it as a response.

For step two: the built-in Email App has a ‘reply-to’ field in the advanced settings. Reply-To: Enter the details of the email for which you are sending this email as a reply.

Cheers,
Henk

1 Like

@Henk-Operative, thanks for the feedback! I will give it a try and let you know how it goes.

Hey @Henk-Operative, probably you can help:

I successfully placed the email data in the Data Store. However, when I open the AI module and attempt to import any data items, I can only select the key data. Do you have any idea what I might be doing wrong?



Schermafbeelding 2024-05-30 205026

Hi @Joost.7AM,

The key of a record in the Data Store is the unique identifier through which you can find, update and delete the record. If you add or edit a record, this key is returned in the output. You can use this key to find and retrieve the information about the email.

Otherwise you can use the ‘Search Record’ module first in order to query the database, this also returns a key for the found record(s), which you can use to manipulate the record as you please.

Cheers,
Henk

2 Likes