Email filter based on keywords

I’m building a scenario that:

  • watches emails
  • checks against a google sheet if the email body contains a specific keyword
  • creates a draft that forwards the email to the email address corresponding to that keyword.

This is my idea

The scenario creates an array with all the keyword-email pairs, than runs a contains() formula on the email body.

Unfortunately, sometimes I need just a partial match.
For example, I have the keyword Agadir-Al Massira Airport, but the email can contain just Agadir airport.

I can’t build a regex for each keyword. An idea is to use AI.
Other ideas?

For a regular expression,

Will you be satisfied with a partial match of any word in the keywords?

E.g.: the email contains "… Al Jazeera… ", matching the “Al” from “Agadir-Al Massira Airport”.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

I don’t think so. I wouldn’t know which part of the keyword should match.
And the keyword list will evolve in the future.

It’s used by a client that has to forward emails based on their content. He manages car rentals all over the world. So, you never know when a new location’s name could be too similar to an existing one.

I’ve just helped you rule out regular expressions.

Regex runs on having a known pattern and on how the patterns match the input.

If you don’t know how you want to match it, well then you can’t use regex for this.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.

Ok.
Is there a better tool than AI to handle this kind of comparison?

Instead of going for a full AI solution, what you could possibly do is just use AI for the location extraction part (not the filtering part).

To do this, you can try using the Groq “Create a JSON Chat Completion” module —

Creates a model response for a given chat conversation with JSON response type.

Groq is currently free, so it won’t cost a cent.

Then, once you have a normalised location text string, you can filter by exact match.


Another alternative, is to simply get users to fill in a form instead of emailing it to you. In that form, provide a list of known locations to select from.

Hope this helps! Let me know if there are any further questions or issues.

@samliew

P.S.: Investing some effort into the Make Academy will save you lots of time and frustration using Make.