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
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
| Scope | Why it is requested |
|---|---|
https://www.googleapis.com/auth/userinfo.email | See which Google account you connected |
https://www.googleapis.com/auth/contacts | See, create and edit your Google contacts |
https://www.googleapis.com/auth/contacts.readonly | See 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
| Input | Type | Description | |
|---|---|---|---|
names | array of object | Required | e.g. [{"givenName":"Ada","familyName":"Lovelace"}] |
email_addresses | array of object | Optional | e.g. [{"value":"[email protected]"}] |
phone_numbers | array of object | Optional | e.g. [{"value":"+1 555 0100"}] |
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
| Input | Type | Description | |
|---|---|---|---|
person_id | string | Required | Contact ID: the part of the resource name after people/, e.g. c1234567890 |
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
| Input | Type | Description | |
|---|---|---|---|
page_size | integer | Optional | Contacts per page, 1 to 1000 (default 100) |
sort_order | string | Optional | Sort order |
page_token | string | Optional | nextPageToken from an earlier call |
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
| Input | Type | Description | |
|---|---|---|---|
query | string | Required | Text to match against the start of contact fields |
page_size | integer | Optional | Results, up to 30 (default 10) |
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
| Input | Type | Description | |
|---|---|---|---|
person_id | string | Required | Contact ID, e.g. c1234567890 |
etag | string | Required | Current etag from get_contact |
update_fields | string | Required | Comma-separated fields to replace, e.g. emailAddresses,phoneNumbers |
names | array of object | Optional | New names |
email_addresses | array of object | Optional | New email addresses |
phone_numbers | array of object | Optional | New phone numbers |
await setu.execute({
userId: "user_1",
action: "googlecontacts.update_contact",
input: {
"person_id": "<person_id>",
"etag": "<etag>",
"update_fields": "<update_fields>"
},
});