I made a simple Function - would like your feedback :)

I just made a new Function and it seems to work.
It’s simple, take an email address and extract the domain name.

I did some Googling and used what I know from other n8n Functions I made in the past,
Just wanted to make sure I am going in the right direction, can I really take almost any Java Script function I find on the web and adapt it to work in n8n?
Is the function made going to work? lol
Is this something I should be adding to the shared Workflow’s on N8N ? (I find the examples to be very helpful and would like to also add more examples for others to take inspiration from.)


Hey @David_Go,

Love the idea! I immediately thought of creating an API service that returns the domain name from an email.

I tested out the function with various email addresses and it works well. I would have taken a different approach, but yours works perfectly well!

Looking forward to seeing these workflows on the workflows page!

1 Like

That looks good to me, personally if I don’t use one of the nodes that does it for me I would use the JavaScript split option and split on the @ then you have 2 indexes you can return.

The good thing with JavaScript is there is often more than one way to do it, one think you may find useful is you can use the string operators on $json[‘email’] directly which is handy if you wanted to do the same thing when using an expression.

1 Like


  1. Thanks for testing out my node :slight_smile: - I bet there is more than one way to get this done, this was just the simplest script I could find that seemed to do the job (it took about 20 min on google and some time in n8n’s community reading about how other people solved similar data challenges)

  2. there are so many cool API’s one can make with n8n, it feels endless.

  3. I have probably watched ALL of your vides about n8n (more than once) so so so helpful! - even some of the basic videos like this one Data Structures in n8n by Harshil Agrawal - YouTube have done wonders for me in opening up my mind on how I can use n8n and to improve all things I do online. I can’t wait to watch the next videos and I hope in a few months I can make some as well : )

@Jon - Yeah I find I can do about %92 of what I want to get done using the nodes. and it is amazing what one can do with the power of n8n - I know I am just scratching the surface right now and it’s already saving me days of work. Now I am trying to see how I can take my automation skills up one or 2 levels with simple JavaScript when needed to get things running smoothly.