Question

Respond only to last email using ChatGPT

  • 5 February 2024
  • 10 replies
  • 173 views

Hi there,

so i am trying to set up a Zap. What i got is a good start but there are a few details i can’t get rid off. So here is my little Zap: 

When i label an email in my gmail account it starts a conversation with chat gpt. The respond will be a draft so that i can review the answer. 

My first Problem is that i want to keep the original message in my draft, so that i now what the customer has written in his mail. I thought ok i will add the reply from chat gpt first and then after the answer i insert the original “Body Plain” Text. The Problem is, that it is just right after the answer of the chatbot. So when the customer sends the next mail you cannot see what was written by the bot and what was written by the customer. The Mail gets a little messy. 

The next big problem is, that the bot only should respond to the newest mail. At the moment the bot reads the whole mail including his last mail and starts philosophing about a lot of stuff. 

What can i do to keep the original message from the customer? And what can i do that ChatGpt only responds to the latest mail?

 

Thanks for your help


This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

10 replies

Userlevel 7
Badge +11

Hi there @GBVM, welcome to the Community! 🙂

Hmm, it seems like the issue might be being caused by the Create Draft action - it currently has a bug where it creates a standalone draft separate from the email thread. Would you agree with that or am I misunderstanding the situation here? Let me know if you are running into that issue and I’ll get you added to the bug report right away! 

In the meantime, can you share a screenshot showing what fields and settings have been selected in the Action section of that ChatGPT action? I’d like to take a closer look at the current set up to see if anything might need tweaking to get it to reference only the latest part of the reply. It would also help if you could also share a screenshot showing an example message thread as it appears in the Gmail trigger so we can see whether there’s any part of the text that could be used by ChatGPT to differentiate between the latest and previous replies. I’m hoping to be able to see something like “On Tue, 5 Feb 2024 at 11:47, XXXXX replied” etc. Remember to remove/hide any private information (like names, emails, addresses etc.) from any screenshots before sharing.

Thanks, looking forward to hearing from you! 


Hey @SamB thank you for your reply.

About the drafts: It seems like i always get 2 drafts. I cannot tell a difference between them. They both have an receipient and both have the answermail and the old text attached. I dont know if i am not patient enough? I always think that nothing is happening. So i mark the mails with the label again and after a few moments i get 2 drafts in my gmail account. 

About the Action itself:

I tried to tell the bot to generate an answer but ignore everything that comes after a certain text. But it seems that the bot ignores that information. The text is in german and is like this: “Am Mo., 5. Feb. 2024 um 18:11 Uhr schrieb Kundenservice”. I tried to tell the bot to ignore everything that comes after “schrieb Kundenservice”. Here is a screenshot as you wished. I hope this is enough: 

 

Just an quick update to the 2 drafts:

I was going now very patient on it. So when i receive the first mail and i label it in my gmail account i get only one draft. When i got an answer and i label the second mail from that customer i get two drafts in my gmail account. In the Zap History i can see that it was triggered twice although i just labeled the new mail in my gmail account. So there seems to be a bug. Here are 2 Screens to that. In my history you can see 2 fired zaps and the one fired zap 4 minutes earlier. 

 

 

 

i also saw now that the first draft is an email that is going to my gmail account. So as i send it i got it immediately in my gmail account. The second draft was a draft for the email receipient. So yes it seems that there is an bug where one draft is going without mail information and the other one with the right receipient. 

@SamB sorry to bother you but can you give me an update?

Thanks

Userlevel 7
Badge +11

I am very sorry for missing your replies here previously @GBVM

That doesn’t sound like the expected behaviour here at all, let’s take a look at what might be causing two drafts to be created first. 🤔

i also saw now that the first draft is an email that is going to my gmail account. So as i send it i got it immediately in my gmail account. The second draft was a draft for the email recipient.


In the screenshot you shared of the two draft emails that were created at 16:24 it looks as though they were triggered by two emails. Am I correct in thinking that one triggered from the first draft 16:20 draft the Zap created, but only after you sent the drafted reply to them? And the other run of the Zap triggered from the recipient’s reply that you then labeled? 

If so, was the draft email that you sent also given the same label as the one that is set to trigger the Zap? If so that might explain why the Zap created two drafts. Do you think that could be the case? 

Now, with the issue of ChatGPT not ignoring the previous part of the message I wonder if it might work better to give it a prompt that’s more like this:
39481c5b2611ad8252c08b02485a3e7e.png

Can you give that a try and let me know if that gets it ignoring the correct part of the email?

@SamB 

when i look in my history of the Zaps i can see that there were 2 Zaps triggered. One was 16:24:30 and the other one was 1 second later on 16:24:31.

The first one on 16:24:30 was the mail wich was already labeled. It was the mail from 16:21. The Zap says, that it found a “new” labeled mail. But this mail was labeled before. 

The second mail on 16:24:31 was the last mail from the customer that was labeled by me. 

I think you are correct. It seems as if the draft is labeled too. So therefore i get 2 drafts in my account. 

So what i tried now: i deleted all the drafts in the account. And i just labeled the newest mail of the customer. But i always get 2 drafts in my gmail account. The send mail which was before in my drafts is not labeled. I double checked it just now. 

The one draft only replies to the latest mail of the customer. The other draft seems to be because of the “sent” mail before. It seems that the sent mail gets the label and therefore i get a second draft. Coudl you check that please?

 

Userlevel 7
Badge +11

Thanks for getting back to me on this @GBVM. 🙂

I’ve been doing some digging on this end and discovered that you’re running into a bug where the Zap is sometimes running twice when an email is labeled. I think that might be what is sometimes causing two drafts to be created. So I’ve gone ahead and added you to the list of folks being affected by this. I can’t make any promises as to when this will be resolved but you’re definitely get an email notification from us the moment it is.

In the meantime, perhaps you could store a record of the email that triggered the Zap in something like Zapier Tables so that the Zap can check to see if an email was already drafted for it. You’d need to use a Find or Create Record (Zapier Tables) action to look for an existing record and create one if it doesn’t find it. Then you could use a filter to check that the record was not found. Meaning that the Zap would only continue to run for the first time it sees the labeled email. 

Do you think that approach could work? 

Hey @SamB 

thanks for responding. I tried to look up gmail. The thing is that we have way to much mails. So i tried to automate in gmail. My idea was: When a mail, is sent and has a special label, set a new label “no-bot” in the sent folder.

But in gmail i cannot set that specific filter for mails that are in the sent folder. I just can set all mails in sent with a second label. But for gmail a sent mail has the label:sent. 

So my idea would be to check if the mail is labeled with “sent”? So when there is the label “sent” dont generate a respond. But how do i set it up? I tried to set the “find or create” zap between the Trigger and the Conversation as second step. I chose the labels and a sample mail. It got the labels Test-Bot and SENT. Now i want to filter them out. But when i test my zapp it says:

Failed to find a record in Zapier Tables

Error code 400: Error found at request.path.table_id: Cannot create ULID from string of length 13 (general:validation_error)

What am i doing wrong? I also tried “remove extra fields” but the result is the same ...

 

Greetings

Userlevel 7
Badge +11

Hi @GBVM! 👋

Ah, it looks like you’re getting that error as the label for the email has been selected rather than the Zapier Table that you’d want to find a record in:
74358486c5bcd75b50befb35a0cac10d.png

That said, if you’ve wanting to limit the Zap to only run for emails where certain labels aren’t present then you could just use a filter by Zapier action that only allows the Zap to continue if it isn’t in the SENT folder or the DRAFT folder. For example:

98ec0501714aa1ae784bbc48648f27a7.png

Note: You’d use the + And button to add the second filter condition to ensure that both conditions are met in order for the Zap to continue. You can learn more about filter rule conditions here: Filter and path rules in Zaps

That way, if your Zap is set up to trigger when an email has a specific label (Test-Bot) added it will only continue to the subsequent ChatGPT and Gmail actions if it’s not in the Sent and not in the Draft folder. 

Please give that a try and confirm whether that works as hoped.