Microsoft Profile
Overview
Each user in Rechat could have Microsoft account. With this API section they can send access-request, verify-grant, revoke-access and get their Microsoft account’s profile data.
Microsoft Credential
A microsoft_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 microsoft account ¶
Request to add microsoft accountPOST/users/self/microsoft
-
Valid scopes: [‘Contacts.Read’, ‘Mail.Read’, ‘Mail.Send’]
-
To redirect back user to an specific address, use
redirect
key to set your custom address.
Example URI
POST /users/self/microsoft
Request
Body
{
"redirect": "http://localhost:3078/dashboard/contacts/",
"body": [
"Contacts.Read",
"Mail.Read",
"Mail.Send"
]
}
Response
200
Body
{
"code": "OK",
"data": {
"url": "https://login.microsoftonline.com/common/oauth2/v2.0/authorize?client_id=undefined&redirect_uri=undefined&response_type=code&response_mode=query&scope=openid%20offline_access%20profile%20email%20User.Read%20Contacts.ReadWrite%20Mail.Read%20Mail.Send%20Mail.ReadWrite%20Calendars.ReadWrite&state=80a227b2-29a0-11e7-b636-e4a7a08e15d4::ed2429b5-1006-4426-a443-1f1583359060::http://localhost:3078/dashboard/contacts/&prompt=login",
"redirect": "http://localhost:3078/dashboard/contacts/",
"type": "microsoft_auth_link"
}
}
Request to get an specific microsoft credential ¶
Request to get an specific microsoft credentialGET/users/self/microsoft/:id
Example URI
GET /users/self/microsoft/:id
URI Parameters
- id
string
(required) Example: 1edae926-8f32-48bd-9584-1692b316281c- associations
string
(required) Example: google_credential.histories
Response
200
Body
{
"code": "OK",
"data": {
"type": "microsoft_credential",
"id": "1edae926-8f32-48bd-9584-1692b316281c",
"user": "80a227b2-29a0-11e7-b636-e4a7a08e15d4",
"brand": "ed2429b5-1006-4426-a443-1f1583359060",
"email": "email",
"remote_id": "remote_id",
"display_name": "displayName",
"first_name": "firstName",
"last_name": "lastName",
"photo": "photo",
"scope": [
"Contacts.Read",
"Mail.Read",
"Mail.Send",
"Mail.ReadWrite",
"Calendar"
],
"revoked": false,
"created_at": "2025-10-14T19:27:56.688Z",
"updated_at": "2025-10-14T19:27:56.688Z",
"deleted_at": null,
"scope_summary": [
"profile",
"contacts.read",
"mail.read",
"mail.send",
"mail.modify",
"calendar"
],
"microsoft_calendar": null,
"send_email_after": null,
"cfolders_sync_token": null,
"people_apis_enabled": false,
"contacts_sync_token": null,
"jobs": null,
"profile_image_url": "photo"
}
}
Request to get user's all microsoft credentials ¶
Request to get user's all microsoft credentialsGET/users/self/microsoft
Example URI
GET /users/self/microsoft
URI Parameters
- associations
string
(required) Example: google_credential.histories
Response
200
Body
{
"code": "OK",
"data": [
{
"type": "microsoft_credential",
"id": "1edae926-8f32-48bd-9584-1692b316281c",
"user": "80a227b2-29a0-11e7-b636-e4a7a08e15d4",
"brand": "ed2429b5-1006-4426-a443-1f1583359060",
"email": "email",
"remote_id": "remote_id",
"display_name": "displayName",
"first_name": "firstName",
"last_name": "lastName",
"photo": "photo",
"scope": [
"Contacts.Read",
"Mail.Read",
"Mail.Send",
"Mail.ReadWrite",
"Calendar"
],
"revoked": false,
"created_at": "2025-10-14T19:27:56.688Z",
"updated_at": "2025-10-14T19:27:56.688Z",
"deleted_at": null,
"scope_summary": [
"profile",
"contacts.read",
"mail.read",
"mail.send",
"mail.modify",
"calendar"
],
"microsoft_calendar": null,
"send_email_after": null,
"cfolders_sync_token": null,
"people_apis_enabled": false,
"contacts_sync_token": null,
"jobs": null,
"profile_image_url": "photo"
}
],
"info": {
"count": 1,
"total": 0
}
}
Request to sync a microsoft credential ¶
Request to sync a microsoft credentialPOST/users/self/microsoft/:id/sync
Example URI
POST /users/self/microsoft/:id/sync
URI Parameters
- id
string
(required) Example: 1edae926-8f32-48bd-9584-1692b316281c
Response
200
Body
{
"code": "OK",
"data": {
"type": "microsoft_credential",
"id": "1edae926-8f32-48bd-9584-1692b316281c",
"user": "80a227b2-29a0-11e7-b636-e4a7a08e15d4",
"brand": "ed2429b5-1006-4426-a443-1f1583359060",
"email": "email",
"remote_id": "remote_id",
"display_name": "displayName",
"first_name": "firstName",
"last_name": "lastName",
"photo": "photo",
"scope": [
"Contacts.Read",
"Mail.Read",
"Mail.Send",
"Mail.ReadWrite",
"Calendar"
],
"revoked": false,
"created_at": "2025-10-14T19:27:56.688Z",
"updated_at": "2025-10-14T19:27:56.688Z",
"deleted_at": null,
"scope_summary": [
"profile",
"contacts.read",
"mail.read",
"mail.send",
"mail.modify",
"calendar"
],
"microsoft_calendar": null,
"send_email_after": null,
"cfolders_sync_token": null,
"people_apis_enabled": false,
"contacts_sync_token": null,
"jobs": null,
"profile_image_url": "photo"
}
}
Request to delete a microsoft credential ¶
Request to delete a microsoft credentialDELETE/users/self/microsoft/:id
Example URI
DELETE /users/self/microsoft/:id
URI Parameters
- id
string
(required) Example: 1edae926-8f32-48bd-9584-1692b316281c
Response
200
Body
{
"code": "OK",
"data": {
"type": "microsoft_credential",
"id": "1edae926-8f32-48bd-9584-1692b316281c",
"user": "80a227b2-29a0-11e7-b636-e4a7a08e15d4",
"brand": "ed2429b5-1006-4426-a443-1f1583359060",
"email": "email",
"remote_id": "remote_id",
"display_name": "displayName",
"first_name": "firstName",
"last_name": "lastName",
"photo": "photo",
"scope": [
"Contacts.Read",
"Mail.Read",
"Mail.Send",
"Mail.ReadWrite",
"Calendar"
],
"revoked": false,
"created_at": "2025-10-14T19:27:56.688Z",
"updated_at": "2025-10-14T19:27:56.688Z",
"deleted_at": "2025-10-14T19:27:56.830Z",
"scope_summary": [
"profile",
"contacts.read",
"mail.read",
"mail.send",
"mail.modify",
"calendar"
],
"microsoft_calendar": null,
"send_email_after": null,
"cfolders_sync_token": null,
"people_apis_enabled": false,
"contacts_sync_token": null,
"jobs": null,
"profile_image_url": "photo"
}
}