Dynamically Excluding Empty Attendees Field with $fromAI()
in Google Calendar Node
Hi everyone! I’m using n8n to automate event creation in Google Calendar, with $fromAI()
dynamically filling in the attendees based on user input. The issue I’m running into is that if the user doesn’t specify any attendees, attendees
still gets included in the JSON request as an empty array. Google Calendar then returns an error, saying the email is invalid.
I need to configure this workflow so that attendees
is only included in the JSON if the user actually specifies attendees. I’m already logged in through OAuth and have the credentials set up in n8n, so the connection with Google Calendar is working. I also don’t understand where or how an IF
function could be used here to make this conditional exclusion of attendees
possible.
Here is some additional information to help you understand the setup:
$fromAI()
automatically populates the value for attendees based on user input.- I’ve configured Google Calendar with OAuth credentials in n8n.
Could someone help me figure out how to conditionally remove attendees
from the request if it’s empty? Any advice or examples would be greatly appreciated!
Questions that might help troubleshoot:
- Is there a way to use
IF
or another function in n8n to check ifattendees
is empty and exclude it from the JSON if so? - Should I use a Function or HTTP node here to customize the JSON request directly?
- Are there any specific settings in Google Calendar’s n8n node that might allow this conditional handling?
Thanks in advance!
What is the error message (if any)?
“Invalid email address” — Google Calendar API rejects the request when the attendees
field is an empty array.
my workflow
Share the output returned by the last node
Information on your n8n setup
- n8n version: 1.66.0
- Database (default: SQLite)
- n8n EXECUTIONS_PROCESS setting: own
- Running n8n via Docker:
- Operating system: ubuntu