Remove duplicated email domains

:bullseye: What is your goal?

Remove duplicate email domains

:thinking: What is the problem?

Hi all,

Given an array such as: emails: [[email protected], [email protected], [email protected]], I want to remove any duplicate email domains. This example would return emails: [[email protected], [email protected]].

Can anyone tell me how this would be possible?

Thank you!

:test_tube: What have you tried so far?

Array group by which doesn’t seem to work

Hello Shauna,

Thanks for sharing your problem, I think for this case you can use make function to remove duplicates.

Let me know if this does not work for your case. Enjoy automating! :partying_face:

Thank you :slight_smile: But if I am mapping the array from another value, how would I say to have the key as anything after each @ in each email?

Hey there,

that’s not going to work. You are not removing duplicates, you are trying to do a partial match first.

Now do you want to do it with built in modules only or are you willing to use the code app? Cause the second one will eat much less operations for this.

I suggest changing your array from plain email variables to collections with emails and domains. Then you can use distinct to filter out the ones with the same domains. You can do this by iterating the array, setting a new variable with the domain, and aggregating back to a new array with the domain added. Or you can use the JSON modules if its easier for you.

Here is an example.

Hey Shauna,

I’ve come up with a solution but it’s requires couple steps, Dedupe emails by domain - Make.com Automation Scenario you can copy from here to your own scenario list.

And if you would like to handle through code there’s an example I’ve put together by using Make Code module