How to send an email and trigger when that email has been responded to back to correct contact

Greetings,

I have a webhook setup from GHL which sends an email to a contact everything’s great so far.

Now I would like to monitor for when that email has been responded to, so I can update correct contact back in GHL again.

I have a Gmail trigger setup to check every minute for all Messages received.

How do I filter or check somehow so that when an email has been responded to, the correct contact will be updated in GHL?

It looks like your topic is missing some important information. Could you provide the following if applicable.

  • n8n version:
  • Database (default: SQLite):
  • n8n EXECUTIONS_PROCESS setting (default: own, main):
  • Running n8n via (Docker, npm, n8n cloud, desktop app):
  • Operating system:

Hi @jakeThai
to check the emails that are answers to the ones you sent you could try these two ideas (one is simple one is more complex.

Simple way:

  • Check the email subject if contains the original subject you sent. This is the easiest way to go and it can be used if the emails that you send have the same title.

More complex way

  • Store somewhere the ID of the emails you send
  • Then you can check each mail you receive to see if it is a reply (it has the field headers['in-reply-to'])
  • Extract the message id from the in-reply-to field with an expression like $json.headers['in-reply-to'].match(/In-Reply-To: <([^>]+)>/)[1];
  • Search the Original email (the one was responded to) using the Gmail Get Many operation using a search term like rfc822msgid:{{ $json['in-reply-to'] }} where in-reply-to is the value you extracted in the previous step (details about search in Gmail here Refine searches in Gmail - Gmail Help)
  • Retrieve the ID of the original ID
  • Check if it matches one of the IDs you stored in the first step

:thinking: The second solution seems very complex, so I suggest using the first one
Hope this somehow helps :slight_smile:

2 Likes

As we are sending hundreds of emails I will go for the second option. Will try to use a google sheet as a crm and store ID or thread id. Thanks for your answer.

1 Like

I attach here a small workflow I used to test this. Will not probably solve your entire issue but worth looking at:

All the best

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.