I am trying to learn UiPath automation, studio and maestro. A learning project is to create a workflow that is triggered by receiving new incoming Gmails, having an agent read and categorize such emails, and for a specific category, create Draft Gmail responses.
So far I’ve managed to accomplish all of above. However, using the Gmail Connector, all draft emails created appear as “new threads” in Gmail? Ie instead of appearing in the same thread as the originally received email, they appear as a new thread.
What do I need to do to have the Gmail Connector create draft emails responding to incoming emails, and have them appear in the same Gmail thread?
Thanks for your quick response. This does not seem to work.
(Unfortunately the forum does not allow me to post the XML code to show you how I’ve configured it currently).
In the task’s properties dialog:
Connector: Gmail
Activity: Reply to Email
Primary/The email to reply to: Tt Id
(this is the email ID I am responding to. I also tried to replace it with threadID but it does not change anything in itself).
Body: <text, including a copy of the replied to email>
Reply to all: true
Save as draft: true
New subject: <left blank. the draft created has a subject "Re: " followed by original subject>
In the task’s properties’ dialog, I do not see any references to “In-Reply-To” nor “References headers”? Where do I find these?
Hey, I checked the official UiPath docs for Reply to Email (Google Workspace) it supports passing a GmailMessage, setting the body, reply‑to‑all, new subject, save-as-draft etc.
But there is no mention in the docs of any property to explicitly set the In‑Reply‑To or References headers. So the connector alone does not seem to give that control.
If you really need the replies to appear in the same thread reliably, try this approach to call Gmail’s API directly and include threadId+ correct headers (In‑Reply‑To, References) in the payload.
Thanks. Sounds like a much needed improvement then for the Gmail Connector?
If you really need the replies to appear in the same thread reliably, try this approach to call Gmail’s API directly and include threadId+ correct headers (In‑Reply‑To, References) in the payload.
Do you have a link to the doc on Gmail’s API, and how to create a task to call on it?
Can you please show a screenshot..we use the activity almost everyday in our org and we see it performing with no issues and draft/reply appears with same subject and when sent sits under same email
I might be missing something is the ask is not this
@PietHern The main issue is that the “Tt Id” you are using for “The email to reply to” is not the actual Gmail message ID but likely a workflow or thread ID. Gmail requires the unique message ID string of the specific email you want to reply to in order to keep the draft in the same thread.
Solution: Make sure to retrieve the original email message using the Gmail Get Mail activity or similar, then pass the actual Gmail message ID property (e.g., mailItem.Id or similar) to the Reply to Email activity’s “email to reply to” field. This correctly links the draft to the original thread. Also, ensure you leave the “New subject” blank so the system uses “Re:” prefix automatically.
This setup will make your draft appear in the same Gmail thread reliably.
okay now I got it..you need the draft also with thread..got it..yea for now that would not happen…but when you send it it would sit under the previous mail
directly there is no way..going api route I believe the suggestions given above are with AI…so they need to be tested before commiting
Solution: Make sure to retrieve the original email message using the Gmail Get Mail activity or similar, then pass the actual Gmail message ID property (e.g., mailItem.Id or similar) to the Reply to Email activity’s “email to reply to” field. This correctly links the draft to the original thread. Also, ensure you leave the “New subject” blank so the system uses “Re:” prefix automatically.
Thanks. I did this, ie I added a task right after Start Event called “Get Newest Email” which retrieves the newest email from Gmail. One of the output variables is called “ID”. I then use exactly this ID as the “the email to reply to” input. Still does not work.
When I debug the process, I check the output of the “Get Newest Email”:
“ThreadID”: “19985d3f014a543d”
“ID”: “19985d3f014a543d”
Ie, the “Message-ID” looks very different from the ID and ThreadID seen in UiPath? Could that be part of the explanation/problem? (I use !! instead of less-than/greater-than because of limits)
I added a “Get Newest Email” task right after the Start Event. It fetches the newest email, including its ID (1) and ThreadID (2).
I then use this particular ID (1) for the “Create Draft Email Response” “the email to reply to” (3).
When debugging, I see that (1) and (2) is “19985d3f014a543d”. I then see that “Create Draft Email Response” has two other input variables, Id and threadId, that both are the same and are equal to “19985d3f014a543d”.
(Third try to respond. UiPath automatically blocks my messages because I copy brackets from the code. Frustrating).
Still not working.
I have added a Get Newest Email task straight after the Start Event. It provides an output ID (1) and thread-ID (2).
I then use (1) in the Create Draft Email Response task input variable “the email to reply to” (3).
The draft is created and it does NOT appear in the thread.
When debugging: (1) and (2) are identical = “19985d3f014a543d”.
(3) is also “19985d3f014a543d”, and I see that the input variables Id and threadId are both “19985d3f014a543d”.
When I open the meta data of the originally received email (Newest Email) in Gmail, I don’t see any reference to “19985d3f014a543d”. I do see a tag “Message-ID:” with the following data (within brackets, that I can not include because of the forum rules): “CAMkQjsAq4anHxu_o0RULrwX1NSCTf=eVoC_0+vD2OK0590fOpA@mail.gmail.com”