I have a mailhook coming from my gmail.com email address. my goal is to change the Label after this happens but from what I can see the values I get back from the mail hook don’t contain the correct Gmail message ID.
I am looking to understand how to obtain the “Gmail Message ID” for use in the “Gmail - Modify Email Labels” module. The challenge is, I need to do this without using the “Gmail - Watch Emails” module.
Why the Need?
My goal is to utilise the “Gmail - Modify Email Labels” module in different scenarios, without having the “Gmail - Watch Emails” as the initial module. Unfortunately, I cannot achieve this because it seems impossible to get the “Gmail Message ID” without using the “Gmail - Watch Emails” module.
Unsuccessful Attempts
Upon reviewing both the “Gmail” and “Email” modules, I was unable to find a way to derive the “Gmail Message ID”.
Error in Make.com’s Guide
In the Make.com online guide located at Gmail Modify Email Labels (https://www.make.com/en/help/app/gmail#modify-email-labels), there seems to be an error. The guide suggests that the “Email ID (UID)” can replace the “Gmail Message ID” in its respective field. However, in practice, this proves to be incorrect and causes an error.
In Conclusion
In essence, I am seeking guidance on how to get the “Gmail Message ID” for use in the “Gmail - Modify Email Labels” module, without resorting to the “Watch Emails” module.
I aim to use the module in scenarios that do not involve the “Gmail - Watch Emails” as the opening module.
@Hugh_Peters Wow, you did an amazing job explaining the problem and what you are trying to accomplish I am 100% in the same place and sadly I have not come up with a workaround yet but I will follow up as soon as I do.
Though that message ID is unique to the individual message, it’s also unique to Google API and lives outside the message body and headers so it makes sense that once it gets to the Mailhook you no longer have access to that ID.
I would say the most straightforward fix to this is to have GMail Module watch your emails rather than forward them to the mailhook.
In your forwarding rule in GMail, instead of forwarding emails to the Mailhook, send them to a folder instead, then have your GMail trigger monitor just that folder.
Is this an option for you?
If not, I think your other option is to use the Google Mail API directly with HTTP modules, but it’s rather complicated.
In your Mailhook module output bundle, you will find an “in-reply-to” field.
This should be the message ID of the original message that was forwarded in Gmail.
Then, using HTTP Module and the Google Mail API, query your messages, looking specifically for that value from in-reply-to.
Use a query that looks like this: rfc822msgid:in-reply-to-id -to:makemailhookaddress@hook.us1.make.com
You can test this search query in GMail GUI as well.
Once you find the message, get the GMail-specific message ID from it, which you can use in the module that labels the message.
I haven’t actually set it up, so no screenshots to share.
What if you use Watch Emails, but instead of polling every x minutes, change to on-demand.
Create a second Scenario with a Mailhook trigger, followed by an HTTP module to kick off the first Scenario.
That should give you the ease of finding the gmail ID and labeling your email, but also the instant trigger.
I trust you’re doing well. I appreciate your response, but I believe there’s some confusion regarding the “Message ID” values.
Three Types of “Message ID” Values
The “Gmail - Watch Emails” module generates three different types of “Message ID” values:
Message ID
Email ID (UID)
Gmail Message ID
Our target here is to acquire the third one, the “Gmail Message ID”.
Issue with Acquiring “Gmail Message ID”
While we can conveniently get both the “Message ID” and the “Email ID (UID)”, we’re facing an issue with obtaining the “Gmail Message ID”. This problem obstructs your “Webhook - Custom Mailhook” to “HTTP - Make a Request” solution.
Misconception About “Email ID (UID)”
You might be under the impression that “Webhook - Custom Mailhook” to “HTTP - Make a Request” will function because the Make.com training on “Gmail Modify Email Labels” suggests that we only need the “Email ID (UID)”. However, there is a misunderstanding here.
Correction to Make.com Training Make.com’s training incorrectly states that we need the “Email ID (UID)”. Contrarily, we are supposed to use the “Gmail Message ID”. I have validated this by testing both the “Gmail Message ID” and the “Email ID (UID)”. Only the “Gmail Message ID” succeeds, while the “Email ID (UID)” leads to an error.
You’ll note that the field’s name is “Gmail Message ID”, which should align with the value “Gmail Message ID”.
Yes, there’s definitely some confusion surrounding the various message IDs.
You should use the #3 Gmail Message ID when you want to modify labels, not #2 Email ID (UID) as indicated in the Make documentation.
We can all agree on the fact that Make’s documentation is incorrect.
I had time today to make this work, so here are some screenshots:
In Gmail, I have a filter set up to label and forward specific pieces of mail.
In this case the Label is “Test”.
Mail is forwarded to the Mailhook.
Scenario #1: Mailhook trigger → Make Run a Scenario
Scenario #2: Gmail Watch Emails (filter those Unread with a “Test” Label, then mark it as Read) → Gmail Modify Email Labels (Label it as “Read-Processed”)
Scenario #1 executes Scenario #2.
Since Scenario #1 is triggered by a Mailhook it’s as near instant as a Webhook.
Since Scenario #2 is triggered by a Gmail module, I have access to the GMail Message ID needed to modify its labels.
I believe this would be a good work-around for Jared.