Skip to main content
Best answer

How do I automatically add Google Contacts to a group based on the "prefix" value?

  • 11 February 2023
  • 6 replies
  • 342 views

Hello,
I want to add new or updated google contacts to a group depending on the "prefix" value.

Specifically, the example is as follows:
For example, the Google contact has the prefix "TKA". Thus, this contact should be added to the Google group "TKA group".

I am currently using "New or Updated Contact in Google Contacts" as a trigger --> as an action I use "Filter by Zapier" and then "Add Contact to Group in Google Contacts".

The problem is the following: In this step "Add Contact to Group in Google Contacts" a contact must also be selected in "Set up action". However, I don't want that. Only that contact should be added to the group, which was previously filtered out.

What do I have to do to make my project work?

Thanks

Greetings,
Peter

 

 

This post has been closed for comments. Please create a new post if you need help or have a question about this topic.

6 replies

Userlevel 7
Badge +14

Hi @vantage 

Good question.

You need to map the GContacts Contact ID from Step 1 so the Zap knows which Contact to add to the Group.

NOTE: You may create an infinite loop, where the action causes the trigger again, so make sure to set your filter conditions correctly.

 

Userlevel 2

Hi @Troy Tessalone

because of the Contact ID from Step 1. You mean i have to choose for example the following ID:

 

… and i have to map this ID in the field of Step 3 (Action) Add Contact to Group in Google Contacts like this:

 

If i do this, i receive the following error message:

 

I think, i do some wrong?

Thank you.

Userlevel 7
Badge +14

@vantage 

You need to use this variable.

 

Userlevel 2

OK, but i receive the error message above in my post.

I only can choose between Contact and Custom:
 

 

When I select "Contact" I can only select one specific contact and thus only add that one contact to a group.

If I select "Custom" then I can select "1. ID people/c242...." but then again I get an error message.

Am I mistaken here?

 

Thank you.

Userlevel 2

Hello,

maybe someone of you have allready solve this Zap-Problem?

I want to add new or updated google contacts to a group depending on the "prefix" value.

Thank you :-) .

 

 

 

 

Userlevel 7
Badge +11

Hey @vantage!

It sounds like you’d need multiple Zaps, one to check for each of the desired prefixes but as Troy mentioned, you’d need to be careful not to create a Zap loop!

To avoid a Zap loop I’d suggest getting the Zap to check whether the contact is already in the group. To do that you’d set the Filter step to check that none of the groups listed in the groups field for the contact are a match for the group the Zap would add them to. That way if it finds a match, it will halt and not attempt to add them again. 

Here’s an example of how that Filter could look if the group name was TKA:
2788c5d9b9716ccd155b36888732addb.png

Let’s say you’d have two prefixes you were wanted to add contacts to TKA and TKB. To handle that you’d create two Zaps that would have the same triggers and actions but check for different prefixes and add the contact to different groups accordingly:

Zap 1 - TKA prefix

  • Trigger: New or Updated Contact (Google Contacts) - triggers when any new contact is added or updated.
  • Action: Only Continue if (Filter by Zapier) - set to check that the groups field doesn’t contain the TKA group.
  • Action: Add Contact to Group (Google Contacts) - set to add the contact to the TKA group.


Zap 2 - TKB prefix

  • Trigger: New or Updated Contact (Google Contacts) - triggers when any new contact is added or updated.
  • Action: Only Continue if (Filter by Zapier) - set to check that the groups field doesn’t contain the TKB group.
  • Action: Add Contact to Group (Google Contacts) - set to add the contact to the TKB group.


Oh and to ensure the correct contact is added to the group, you’d need to select the Original Id field as Troy mentioned previously. Which would look like this:

a5b439e7bfa579fc5f6855f194724831.png

Hope that helps. Please do keep us in the loop on how you get on with this!