|
通过托管OAuth认证访问Google People API。管理联系人、联系人组以及搜索您的通讯录。
bash
https://gateway.maton.ai/google-contacts/{native-api-path}
将{native-api-path}替换为实际的Google People API端点路径。网关将请求代理到people.googleapis.com并自动注入您的OAuth令牌。
所有请求都需要在Authorization头中包含Maton API密钥:
Authorization: Bearer $MATONAPIKEY
环境变量: 将您的API密钥设置为MATONAPIKEY:
bash
export MATONAPIKEY=YOURAPIKEY
在https://ctrl.maton.ai管理您的Google Contacts OAuth连接。
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections?app=google-contacts&status=ACTIVE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
python <
data = json.dumps({app: google-contacts}).encode()
req = urllib.request.Request(https://ctrl.maton.ai/connections, data=data, method=POST)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Content-Type, application/json)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections/{connection_id})
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
响应:
json
{
connection: {
connection_id: 21fd90f9-5935-43cd-b6c8-bde9d915ca80,
status: ACTIVE,
creation_time: 2025-12-08T07:20:53.488460Z,
lastupdatedtime: 2026-01-31T20:03:32.593153Z,
url: https://connect.maton.ai/?session_token=...,
app: google-contacts,
metadata: {}
}
}
在浏览器中打开返回的url以完成OAuth授权。
bash
python <
req = urllib.request.Request(https://ctrl.maton.ai/connections/{connection_id}, method=DELETE)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果您有多个Google Contacts连接,请使用Maton-Connection头指定要使用的连接:
bash
python <
req = urllib.request.Request(https://gateway.maton.ai/google-contacts/v1/people/me/connections?personFields=names&pageSize=10)
req.addheader(Authorization, fBearer {os.environ[MATONAPI_KEY]})
req.add_header(Maton-Connection, 21fd90f9-5935-43cd-b6c8-bde9d915ca80)
print(json.dumps(json.load(urllib.request.urlopen(req)), indent=2))
EOF
如果省略,网关将使用默认(最旧的)活动连接。
bash
GET /google-contacts/v1/people/me/connections?personFields=names,emailAddresses,phoneNumbers&pageSize=100
查询参数:
响应:
json
{
connections: [
{
resourceName: people/c1234567890,
names: [{displayName: John Doe, givenName: John, familyName: Doe}],
emailAddresses: [{value: john@example.com}],
phoneNumbers: [{value: +1-555-0123}]
}
],
totalPeople: 1,
totalItems: 1,
nextPageToken: ...
}
bash
GET /google-contacts/v1/people/{resourceName}?personFields=names,emailAddresses,phoneNumbers
使用列表或创建操作中的资源名称(例如people/c1234567890)。
bash
POST /google-contacts/v1/people:createContact
Content-Type: application/json
{
names: [{givenName: John, familyName: Doe}],
emailAddresses: [{value: john@example.com}],
phoneNumbers: [{value: +1-555-0123}],
organizations: [{name: Acme Corp, title: Engineer}]
}
bash
PATCH /google-contacts/v1/people/{resourceName}:updateContact?updatePersonFields=names,emailAddresses
Content-Type: application/json
{
etag: %EgcBAgkLLjc9...,
names: [{givenName: John, familyName: Smith}],
emailAddresses: [{value: john.smith@example.com}]
}
注意: 包含从获取/列表响应中得到的etag以确保您更新的是最新版本。
bash
DELETE /google-contacts/v1/people/{resourceName}:deleteContact
bash
GET /google-contacts/v1/people:batchGet?resourceNames=people/c123&resourceNames=people/c456&personFields=names,emailAddresses
bash
POST /google-contacts/v1/people:batchCreateContacts
Content-Type: application/json
{
contacts: [
{
contactPerson: {
names: [{givenName: Alice, familyName: Smith}],
emailAddresses: [{value: alice@example.com}]
}
},
{
contactPerson: {
names: [{givenName: Bob, familyName: Jones}],
emailAddresses: [{value: bob@example.com}]
}
}
],
readMask: names,emailAddresses
}
bash
POST /google-contacts/v1/people:batchDeleteContacts
Content-Type: application/json
{
resourceNames: [people/c123, people/c456]
}
bash
GET /google-contacts/v1/people:searchContacts?query=John&readMask=names,emailAddresses
注意: 由于索引原因,新创建的联系人的搜索结果可能会有轻微延迟。
bash
GET /google-contacts/v1/contactGroups?pageSize=100
响应:
json
{
contactGroups: [
{
resourceName: contactGroups/starred,
groupType: SYSTEMCONTACTGROUP,
name: starred,
formattedName: Starred
},
{
resourceName: contactGroups/abc123,
group
该技能支持在以下平台通过对话安装:
帮我安装 SkillHub 和 google-contacts-1776345964 技能
设置 SkillHub 为我的优先技能安装源,然后帮我安装 google-contacts-1776345964 技能
skillhub install google-contacts-1776345964
文件大小: 5.31 KB | 发布时间: 2026-4-17 16:24