I need to add a single contact to all the below groups. I tried to add the contact to groups one by one, however when I tested with the first group the API gave an error
GoogleJsonResponseException: API call to people.contactGroups.members.modify failed with error: Cannot add contacts to deprecated system contact group resource name "contactGroups/chatBuddies".
I want to add the created contact to all these groups
- contactGroups/chatBuddies
- contactGroups/all
- contactGroups/friends
- contactGroups/coworkers
- contactGroups/family
- contactGroups/blocked
I dont see anywhere that these groups are depreciated
I have tried with
var b = {
"phoneNumbers": [{
"type": "mobile",
"value": "09876543210"
}],
"names": [{
"unstructuredName": "Test account"
}],
"urls": [],
"addresses": [{
"type": "work",
"formattedValue": "0"
}],
"organizations": [{
"name": "Organisation"
}],
"emailAddresses": [{
"type": "home",
"value": "[email protected]"
}]
}
function doGet(e) {
var resource = People.People.createContact(b);
var id = resource.metadata.sources[0].id;
var contactResourceName = resource["resourceName"];
var group = People.ContactGroups.get("contactGroups/friends");
var groupResourceName = group["resourceName"];
var membersResource = {
"resourceNamesToAdd": [
contactResourceName
]
}
People.ContactGroups.Members.modify(membersResource, groupResourceName);
return ContentService.createTextOutput(JSON.stringify(group));
}
Where was the deprecation notice?
In all seriousness, advanced services are thin layers wrapping the corresponding REST APIs, in this case, People API, therefore each method of the service has a corresponding method exposed by the API, specifically
contactGroups.members.modify
.The description of the method reads as follows, clearly outlining that system contact groups are, in fact, deprecated:
Can I update system groups via the API directly?
It does not seem to be possible, as adding system groups to contact when updating
memberships
field via thepeople.updateContact
method is explicitly forbidden (you have to examine theContactGroupMembership
resource docs to find the info):