How to execute Gmail node only once

Hello,

First, congratulations for your work.
I’ve discovered n8n a few weeks ago and it amazes me every day I am using it!
I am using it to replace some of my NodeJS / Python scripts and it surprising how fast we can build something.

I am writing a workflow which sends a daily report by email.
First, it gathers data from different sources (using HTTP node), compute/format the data and finally send a report by email using the “Gmail” node.

The last steps are:

Each function node produces a summary and the Gmail generates a message using the output of both nodes.

{{$node["Generate new licenses text"].json["text"]}}

----------

{{$node["Generate cancelled licenses text"].json["text"]}}

The problem is that the Gmail node is executed twice:

  1. first with only the output of the first node
  2. and then with the output of the 2 function nodes

What’s wrong with my configuration?

Cheers,
Christophe

Welcome to the community @chprome and thanks! Great to hear that you enjoy n8n!

In this case you either would have to use two different Gmail nodes or you would have to merge the data with a Merge-Node first.

If a node has multiple connections on one input, it gets executed once for every input.

Hope that helps!

2 Likes

Hi Jan,

Thanks for the quick response!

I’ve adapted a bit your solution: I’ve used the “Wait” function of the “Merge” node, works like a charm.

Cheers :slight_smile:
Christophe

1 Like

That is great to hear! Have fun!

@chprome Could you share how do you use “Wait” function of the “Merge” node, I don’t see this function in Merge node

It is an option under “Mode”.