Group ID as Expression Not Working When Creating Google Contact

Describe the issue/error/question

Google Contacts node doesn’t appear to support the Group ID field as an expression when creating a contact.

What is the error message (if any)?

Please share the workflow

Share the output returned by the last node

TypeError: additionalFields.group.map is not a function
    at Object.execute (/usr/local/lib/node_modules/n8n/node_modules/n8n-nodes-base/dist/nodes/Google/Contacts/GoogleContacts.node.js:161:72)
    at Workflow.runNode (/usr/local/lib/node_modules/n8n/node_modules/n8n-workflow/dist/src/Workflow.js:598:51)
    at /usr/local/lib/node_modules/n8n/node_modules/n8n-core/dist/src/WorkflowExecute.js:557:68
    at processTicksAndRejections (node:internal/process/task_queues:96:5)

Information on your n8n setup

  • n8n version: 0.190.0
  • Database you’re using (default: SQLite): SQLite
  • Running n8n via [Docker, npm, n8n.cloud, desktop app]: Docker

Hi @MortgageRockstar, can you try using an expression such as {{ ["contactGroups/myContacts"] }} like shown below? It seems the node expects an array (and Google Contacts requires the contactGroups/ prefix).

n8n will complain about an unsupported value but the contact was still created as expected for me:

Thank you, @MutedJam .

I formatted an expression per your example and it worked. It does not appear to support the Group name as a string though, only the Group ID as a number.

Is that correct?

Hey @MortgageRockstar,

Looking at the screenshot provided by @MutedJam it appears to have worked with the name so that should be fine.

Looking at the API doc it looks like it should support the ID or the name with the contactGroups/ prefix.

Thanks @Jon.

It didn’t work for me when I used the Group name rather than the Group ID so that’s why I asked. Sorry I didn’t point that out in my previous response.

Hey @MortgageRockstar,

No worries, When you did the group name did you include the prefix as well?

Yes, I did use the contactGroups prefix with the Group Name, @Jon.

Here’s a screenshot of the error when I use a Group Name instead of a Group ID. I would prefer to use a Group Name if possible.

This might sound silly but are you sure it is that field causing the issue?

If you remove the expression from the other 2 fields and just type in a value to test and only have that one node does it still fail?

Yes, I am sure, @Jon.

The node works if a Group ID is entered, but it does not work if you use a Group name as an expression. It does work if you select a Group name from the list as a fixed value (not as an expression).

Also I removed the value entirely as a test as you suggested and it worked fine too.

It appears that the node only does not work when using a Group name as an expression for some reason. Maybe that is not supported?

Can you run the below on it’s own and let me know if that works? Looking at the earlier example it is using an expression so that should be fine, I think there is maybe something earlier in the workflow that is causing the issue which we can’t see.

Are you able to share the full workflow?

@Jon, I ran the Google Contacts node on its own with your example and my Group name Leads and it failed (see below).

This example executed successfully with the Group ID number for this same Group name (Leads). It just doesn’t like the Group name in the expression for some reason.

Well that is odd, Let me set up Google Contacts and I will take a look. If it is failing I am not sure how it was previously working unless myContacts is a special group.

Yeah that is it… So myContacts has an ID of myContacts so it looks like it is only the ID you can use rather than the group name.

Thanks for confirming, @Jon.

Is this an issue with the Google Contacts node or does Google’s People API not support Group name to add a contact to a group?

Looks like Google call the field a name but say contactGroupId in the example so it looks to be an API limitation.

2 Likes