Hi. I have a workflow built to automatically send messages to leads on Whatsapp.
All the leads who send a message on the form on my website are registered in Google Sheets.
That’s where my workflow starts. Every 5 minutes n8n checks if there is a new contact in the spreadsheet and sends a sequence of messages.
What’s the problem?
Even when there isn’t a new contact, the flow runs to the end. I get the following message: “This is an item, but it’s empty.”
Is there any way to make the flow stop when there is no new contact?
In theory, the If node that I call “Não recebeu” (it’s “Didn’t receive” in portuguese) should stop the flow from continuing because I’ve set some locks.
Version: 1.25.1
Running n8n via Docker
Operating system: Ubuntu 20.04.6
Why don’t you have the form hooked up right into n8n and have that trigger it? Then you can have the same workflow add them to the sheet if you want to keep track of it?
If that doesn’t work you should follow @ihortom’s suggestion and replace the cron trigger with the built in sheet trigger. That will simplify a lot in the workflow.
If it can only work at certain hours, then have a separate workflow that you trigger based on time (with an If node) that has a delay until it’s within your desired time range.
It’s not a problem that there are a lot of contacts in a short time, it will all be getting processed regardless.
If you need to keep your schedule trigger the way it is then try to set up an if statement node somewhere to check if the data is there, and if it’s not quick out.
Let me know if that’s not helpful and you need more help
The proposed solutions make sense, but I wanted to avoid changing the workflow structure too much because it meets my needs.
I found the solution. My node that checks for new contacts that have not yet been answered had the Always Output Data setting enabled.
All I had to do was deactivate Always Output Data and my lock to stop the workflow from continuing if there are no new contacts stopped proceeding with empty fields.