Setu Recipes: reusable workflows across every app.Browse templates

Integrations / Google Contacts

Google Contacts

Search, read, create and update contacts in Google Contacts.

5 actions OAuth 2 3 read2 write Calls people.googleapis.com

Connect

TypeScript
const conn = await setu.connections.initiate({ userId: "user_1", toolkit: "googlecontacts" });
console.log(conn.connectUrl); // show this to your user
await conn.waitUntilActive();

Permissions requested

ScopeWhy it is requested
https://www.googleapis.com/auth/userinfo.emailSee which Google account you connected
https://www.googleapis.com/auth/contactsSee, create and edit your Google contacts
https://www.googleapis.com/auth/contacts.readonlySee your Google contacts

Actions

Create contactwritegooglecontacts.create_contactCreate a new contact with names, emails and phone numbers.

Needs scope: https://www.googleapis.com/auth/contacts

InputTypeDescription
namesarray of objectRequirede.g. [{"givenName":"Ada","familyName":"Lovelace"}]
email_addressesarray of objectOptionale.g. [{"value":"[email protected]"}]
phone_numbersarray of objectOptionale.g. [{"value":"+1 555 0100"}]
TypeScript
await setu.execute({
  userId: "user_1",
  action: "googlecontacts.create_contact",
  input: {
    "names": []
  },
});
Get contactreadgooglecontacts.get_contactGet one contact's names, emails, phone numbers and etag (needed before updating it).

Needs scope: https://www.googleapis.com/auth/contacts.readonly

InputTypeDescription
person_idstringRequiredContact ID: the part of the resource name after people/, e.g. c1234567890
TypeScript
await setu.execute({
  userId: "user_1",
  action: "googlecontacts.get_contact",
  input: {
    "person_id": "<person_id>"
  },
});
List contactsreadgooglecontacts.list_contactsList the signed-in user's contacts (names, emails, phone numbers), sorted as requested.

Needs scope: https://www.googleapis.com/auth/contacts.readonly

InputTypeDescription
page_sizeintegerOptionalContacts per page, 1 to 1000 (default 100)
sort_orderstringOptionalSort order
page_tokenstringOptionalnextPageToken from an earlier call
TypeScript
await setu.execute({
  userId: "user_1",
  action: "googlecontacts.list_contacts",
  input: {},
});
Search contactsreadgooglecontacts.search_contactsSearch the user's contacts by name, email, phone or organization prefix.

Needs scope: https://www.googleapis.com/auth/contacts.readonly

InputTypeDescription
querystringRequiredText to match against the start of contact fields
page_sizeintegerOptionalResults, up to 30 (default 10)
TypeScript
await setu.execute({
  userId: "user_1",
  action: "googlecontacts.search_contacts",
  input: {
    "query": "<query>"
  },
});
Update contactwritegooglecontacts.update_contactReplace chosen fields of a contact. Needs the contact's current etag from get_contact; fields named in update_fields are fully replaced.

Needs scope: https://www.googleapis.com/auth/contacts

InputTypeDescription
person_idstringRequiredContact ID, e.g. c1234567890
etagstringRequiredCurrent etag from get_contact
update_fieldsstringRequiredComma-separated fields to replace, e.g. emailAddresses,phoneNumbers
namesarray of objectOptionalNew names
email_addressesarray of objectOptionalNew email addresses
phone_numbersarray of objectOptionalNew phone numbers
TypeScript
await setu.execute({
  userId: "user_1",
  action: "googlecontacts.update_contact",
  input: {
    "person_id": "<person_id>",
    "etag": "<etag>",
    "update_fields": "<update_fields>"
  },
});