Google Profile
Overview
Each user in Rechat could have Google account. With this API section they can send access-request, verify-grant, revoke-access and get their Google account’s profile data.
Google Credential
A google_credential is a simple and small object that contains:
Column | Type | Nullable |
---|---|---|
id | uuid | not null |
user | uuid | not null |
brand | uuid | not null |
text | not null | |
resource_name | text | not null |
display_name | text | not null |
first_name | text | |
last_name | text | |
photo | text | |
scope | jsonb | |
scope_summary | jsonb | |
revoked | boolean | not null |
created_at | timestamp with time zone | not null |
updated_at | timestamp with time zone | not null |
deleted_at | timestamp with time zone |
Resource Group ¶
Request to add google account ¶
Request to add google accountPOST/users/self/google
-
Valid scopes: [‘contacts’, ‘gmail.readonly’, ‘gmail.send’]
-
To redirect back user to an specific address, use
redirect
key to set your custom address.
Example URI
POST /users/self/google
Request
Body
{
"redirect": "http://localhost:3078/dashboard/contacts/",
"body": [
"contacts.readonly"
]
}
Response
200
Body
{
"code": "OK",
"data": {
"url": "https://accounts.google.com/o/oauth2/v2/auth?client_id=&access_type=offline&scope=profile%20email%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcontacts%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcontacts.other.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.readonly%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.send%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fgmail.modify%20https%3A%2F%2Fwww.googleapis.com%2Fauth%2Fcalendar&state=80a227b2-29a0-11e7-b636-e4a7a08e15d4%3A%3A85e3064f-206e-4593-a5cb-2240f23d221c%3A%3Ahttp%3A%2F%2Flocalhost%3A3078%2Fdashboard%2Fcontacts%2F&prompt=consent%20select_account&include_granted_scopes=true&response_type=code&redirect_uri=",
"redirect": "http://localhost:3078/dashboard/contacts/",
"type": "google_auth_link"
}
}
Request to get an specific google credential ¶
Request to get an specific google credentialGET/users/self/google/:id
Example URI
GET /users/self/google/:id
URI Parameters
- id
string
(required) Example: 92094756-2080-4057-bdfe-5eaaec7faa51- associations
string
(required) Example: google_credential.histories
Response
200
Body
{
"code": "OK",
"data": {
"type": "google_credential",
"id": "92094756-2080-4057-bdfe-5eaaec7faa51",
"user": "80a227b2-29a0-11e7-b636-e4a7a08e15d4",
"brand": "85e3064f-206e-4593-a5cb-2240f23d221c",
"email": "emailAddress",
"resource_name": "resourceName",
"display_name": "displayName",
"first_name": "firstName",
"last_name": "lastName",
"photo": "photo",
"messages_total": 100,
"threads_total": 101,
"history_id": 103,
"scope": [
"profile",
"email",
"https://www.googleapis.com/auth/contacts.readonly",
"https://www.googleapis.com/auth/gmail.readonly",
"https://www.googleapis.com/auth/gmail.send",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/calendar"
],
"revoked": false,
"created_at": "2025-10-14T19:27:28.351Z",
"updated_at": "2025-10-14T19:27:28.351Z",
"deleted_at": null,
"scope_summary": [
"profile",
"contacts.read",
"mail.read",
"mail.send",
"mail.modify",
"calendar"
],
"google_calendar": null,
"last_daily_sync": null,
"cgroups_sync_token": null,
"other_contacts_sync_token": null,
"people_apis_enabled": false,
"jobs": null,
"profile_image_url": "photo"
}
}
Request to get user's all google credentials ¶
Request to get user's all google credentialsGET/users/self/google
Example URI
GET /users/self/google
URI Parameters
- associations
string
(required) Example: google_credential.histories
Response
200
Body
{
"code": "OK",
"data": [
{
"type": "google_credential",
"id": "92094756-2080-4057-bdfe-5eaaec7faa51",
"user": "80a227b2-29a0-11e7-b636-e4a7a08e15d4",
"brand": "85e3064f-206e-4593-a5cb-2240f23d221c",
"email": "emailAddress",
"resource_name": "resourceName",
"display_name": "displayName",
"first_name": "firstName",
"last_name": "lastName",
"photo": "photo",
"messages_total": 100,
"threads_total": 101,
"history_id": 103,
"scope": [
"profile",
"email",
"https://www.googleapis.com/auth/contacts.readonly",
"https://www.googleapis.com/auth/gmail.readonly",
"https://www.googleapis.com/auth/gmail.send",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/calendar"
],
"revoked": false,
"created_at": "2025-10-14T19:27:28.351Z",
"updated_at": "2025-10-14T19:27:28.351Z",
"deleted_at": null,
"scope_summary": [
"profile",
"contacts.read",
"mail.read",
"mail.send",
"mail.modify",
"calendar"
],
"google_calendar": null,
"last_daily_sync": null,
"cgroups_sync_token": null,
"other_contacts_sync_token": null,
"people_apis_enabled": false,
"jobs": null,
"profile_image_url": "photo"
}
],
"info": {
"count": 1,
"total": 0
}
}
Request to sync a google credential ¶
Request to sync a google credentialPOST/users/self/google/:id/sync
Example URI
POST /users/self/google/:id/sync
URI Parameters
- id
string
(required) Example: 92094756-2080-4057-bdfe-5eaaec7faa51
Response
200
Body
{
"code": "OK",
"data": {
"type": "google_credential",
"id": "92094756-2080-4057-bdfe-5eaaec7faa51",
"user": "80a227b2-29a0-11e7-b636-e4a7a08e15d4",
"brand": "85e3064f-206e-4593-a5cb-2240f23d221c",
"email": "emailAddress",
"resource_name": "resourceName",
"display_name": "displayName",
"first_name": "firstName",
"last_name": "lastName",
"photo": "photo",
"messages_total": 100,
"threads_total": 101,
"history_id": 103,
"scope": [
"profile",
"email",
"https://www.googleapis.com/auth/contacts.readonly",
"https://www.googleapis.com/auth/gmail.readonly",
"https://www.googleapis.com/auth/gmail.send",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/calendar"
],
"revoked": false,
"created_at": "2025-10-14T19:27:28.351Z",
"updated_at": "2025-10-14T19:27:28.351Z",
"deleted_at": null,
"scope_summary": [
"profile",
"contacts.read",
"mail.read",
"mail.send",
"mail.modify",
"calendar"
],
"google_calendar": null,
"last_daily_sync": null,
"cgroups_sync_token": null,
"other_contacts_sync_token": null,
"people_apis_enabled": false,
"jobs": null,
"profile_image_url": "photo"
}
}
Request to delete a google credential ¶
Request to delete a google credentialDELETE/users/self/google/:id
Example URI
DELETE /users/self/google/:id
URI Parameters
- id
string
(required) Example: 92094756-2080-4057-bdfe-5eaaec7faa51
Response
200
Body
{
"code": "OK",
"data": {
"type": "google_credential",
"id": "92094756-2080-4057-bdfe-5eaaec7faa51",
"user": "80a227b2-29a0-11e7-b636-e4a7a08e15d4",
"brand": "85e3064f-206e-4593-a5cb-2240f23d221c",
"email": "emailAddress",
"resource_name": "resourceName",
"display_name": "displayName",
"first_name": "firstName",
"last_name": "lastName",
"photo": "photo",
"messages_total": 100,
"threads_total": 101,
"history_id": 103,
"scope": [
"profile",
"email",
"https://www.googleapis.com/auth/contacts.readonly",
"https://www.googleapis.com/auth/gmail.readonly",
"https://www.googleapis.com/auth/gmail.send",
"https://www.googleapis.com/auth/gmail.modify",
"https://www.googleapis.com/auth/calendar"
],
"revoked": false,
"created_at": "2025-10-14T19:27:28.351Z",
"updated_at": "2025-10-14T19:27:28.351Z",
"deleted_at": "2025-10-14T19:27:28.498Z",
"scope_summary": [
"profile",
"contacts.read",
"mail.read",
"mail.send",
"mail.modify",
"calendar"
],
"google_calendar": null,
"last_daily_sync": null,
"cgroups_sync_token": null,
"other_contacts_sync_token": null,
"people_apis_enabled": false,
"jobs": null,
"profile_image_url": "photo"
}
}
Request to get list of remote google calendars ¶
Request to get list of remote google calendarsGET/users/google/:gcid/calendars
Example URI
GET /users/google/:gcid/calendars
URI Parameters
- gcid
string
(required) Example: 92094756-2080-4057-bdfe-5eaaec7faa51
Response
200
Body
{
"code": "OK",
"data": {
"calendars": [
{
"id": "[email protected]",
"name": "[email protected]",
"description": null,
"timeZone": "Asia/Tehran",
"permission": "read.write",
"alreadySynced": true
},
{
"id": "[email protected]",
"name": "[email protected]",
"description": null,
"timeZone": "America/New_York",
"permission": "read.write",
"alreadySynced": false
}
],
"primaryCalendar": {
"id": "[email protected]",
"name": "Rechat",
"description": "rechat-cal-description",
"timeZone": "America/Chicago",
"permission": "read.write",
"alreadySynced": true
},
"isConfigured": true
}
}
Request to config google calendars ¶
Request to config google calendarsPOST/users/google/:gcid/conf
Example URI
POST /users/google/:gcid/conf
URI Parameters
- gcid
string
(required) Example: 92094756-2080-4057-bdfe-5eaaec7faa51
Request
Body
{
"toSync": [
"[email protected]"
]
}
Response
204
Request to reconfig google calendars ¶
Request to reconfig google calendarsPOST/users/google/:gcid/conf
Example URI
POST /users/google/:gcid/conf
URI Parameters
- gcid
string
(required) Example: 92094756-2080-4057-bdfe-5eaaec7faa51
Request
Body
{
"toSync": [
"en.usa#[email protected]"
],
"toStopSync": [
"[email protected]"
]
}
Response
204