Routing via filter on array values

I’m trying to filter on an array to control flow through a router

My inputs is HTML email from Gmail, and I have three different URL structures that I want to detect if they are present in the HTML.

I’m trying to match on the root URLs - omitting the ‘unique_payload’ part

These URLs will always be unique to any email - ie there will never be a match on more than one URL structure for any email

If any of these 3 URL structures exists, then I want to go to ‘Route A’ where the matched URL will be written to an Airtable field.

If no matching URL exists in the email HTML body, then I want the flow to take ‘Route B’ where other stuff happens

So far I’ve used the ‘Text Parser - Get elements from HTML’ module to identify all links in the email, followed by ‘Array Aggregator’ to create an array of all the links in the message. This seems to work so far.

Now I’m trying to implement a router with a filter on that array so that if a match is found with any of my 3 URL structures, it will take Route A, and the Fallback filter to take Route B.

I’ve tried using ‘Array operators - Contains… root URL’ in my ‘Route A’ filter, but cannot get this to match

How do I design my filter to match data in the array?

I will need to review what exactly your array after aggregator looks like,

But what you can do is, In the filter set the following,

But, with this, there comes a problem with finding the exact matched URL.

So, I suggest having this filter in between the Text Parser - Get elements from HTML and Aggregator, using this will allow getting the output from array aggregator as URL, so basically replace the join/map logic with the URL value that you get. After the array aggregator is done you can simply have a router with a filter to check if the Array length obtained from Aggregraor is empty or not. If length is greater than 0 then go to Route A or else go to Route B.

1 Like

Thanks @Runcorn !

I followed your suggestion to place the filter between the parser and the aggregator, then the router is based on a filter that looks for array length = 1 for route A, and Fallback for route B.

This is a very neat solution!

1 Like