How to add bookmarks to a Google contact via People API?

Asked

Viewed 21 times

0

I am adding contacts via People API with the following code:

SCOPES = ['https://www.googleapis.com/auth/contacts']
def start_service():
    creds = None
    if os.path.exists('token.pickle'):
        with open('token.pickle', 'rb') as token:
            creds = pickle.load(token)
    # Se as credenciais não estiverem válidas é feito um novo login.
    if not creds or not creds.valid:
        if creds and creds.expired and creds.refresh_token:
            creds.refresh(Request())
        else:
            flow = InstalledAppFlow.from_client_secrets_file(
                'credentials.json', SCOPES)
            creds = flow.run_local_server(port=0)
        # Salva as credênciais.
        with open('token.pickle', 'wb') as token:
            pickle.dump(creds, token)

return build('people', 'v1', credentials=creds)

Using the field userDefined to mark contacts:

service = start_service()
def criar_contato(service, name, phone, tag):
    return service.people().createContact(body={
        "names": [
            {
                "givenName": name[0], "middleName": name[1], "familyName": name[2] 
            }
        ],
        "phoneNumbers":[
            {
                "value": phone, "type": "main"
            }
        ],
        "userDefined": [
            {
                "key": "Tag", "value": tag
            }
        ]
    }).execute()

But I use the WEB interface to manage and use the Bookmarks field to group some contacts. https://contacts.google.com/

Marcadores em: https://contacts.google.com/

Is there any field where I can define these markers within the API?

No answers

Browser other questions tagged

You are not signed in. Login or sign up in order to post.