User Invites API
Introduction
The user invite API is used directly by the UI components (e.g. The <UserInvitesTable/>). However, you can also use it
programmatically.
Mutations
sendUserInvites()
The sendUserInvites API is used to invite users and automatically also create a user invite. You can find the full API doc of this mutation here (opens in a new tab).
const status = await roqClient.asUser('530c9a92-71c5-4dce-a6e3-c638c2d0b1bc').sendUserInvites({
	userInvites: {
		tenantId: 'ee764883-f2c3-4486-9de6-070345e350af',
		userInvites: [{
			createdByUserId: '530c9a92-71c5-4dce-a6e3-c638c2d0b1bc',
			email: "wick.john@gmail.com",
			locale: "en-US",
			roles: ["content-creator"]
		}]
	}
})| Parameter | Type | Description | 
|---|---|---|
userInvites | object | User invites data | 
userInvites:tenantId | uuid | ID of the tenant (organization) | 
userInvites:userInvites | array | Array of invitees | 
userInvites:userInvites:email | string | Email of the invitee | 
userInvites:userInvites:firstName | string | First name of the invitee | 
userInvites:userInvites:lastName | string | Last name of the invitee | 
userInvites:userInvites:locale | string | Language of the invitee (used for the email) | 
userInvites:userInvites:data | array | Additional custom data | 
userInvites:userInvites:createdByUserId | uuid | ID of the inviting user | 
userInvites:userInvites:roles | array | Array of IDs of roles for the invitee | 
resendUserInvite()
The resendUserInvite API will resend the invitation to the invitee. The full API documentation for this method is here (opens in a new tab).
const userInviteModel = await roqClient.asUser("530c9a92-71c5-4dce-a6e3-c638c2d0b1bc").resendUserInvite("d1459a92-71c5-4edc-a6a1-c638c2d0d34c")| Parameter | Type | Description | 
|---|---|---|
id | uuid | The invitee ID | 
cancelUserInvite()
The cancelUserInvite API will cancel a user invitation. The documentation for this API is here (opens in a new tab).
const userInviteModel = await roqClient.asUser("530c9a92-71c5-4dce-a6e3-c638c2d0b1bc").cancelUserInvite("d1459a92-71c5-4edc-a6a1-c638c2d0d34c")| Parameter | Type | Description | 
|---|---|---|
id | uuid | The invitee ID | 
acceptUserInvite()
The acceptUserInvite API is the ROQ's validation if the invitee accepts the invitation. For the full API documentation, please look into this link (opens in a new tab).
const acceptInviteData = await roqClient.asSuperAdmin().acceptUserInvite({
	acceptUserInvite: {
		token: "oneTimeToken"
	}
})| Parameter | Type | Description | 
|---|---|---|
token | string | The invitee accept token | 
updateUserInvite()
The updateUserInvite() (opens in a new tab) method API will update the data for the specific invitee ID.
const updateUserInvite = await roqClient.asSuperAdmin().updateUserInvite({
  id: "3f6f6373-f05e-45be-b0bf-e03dea172881",
  userInvite: {
     acceptedByUserId: null,
     firstName: "Fast",
     lastName: "Ninja",
     locale: "id-ID",
     data: { address: "Brosot ST." }
  }
})| Parameter | Type | Description | 
|---|---|---|
id | uuid | The invitee ID | 
userInvite | object | The user invitee data. Please look into this (opens in a new tab) API documentation for input fields detail. | 
Queries
You can fetch invites using the userInvites and userInvite queries.
userInvites()
You can get all the user invites list using this userInvites() (opens in a new tab) method API. You can limit the results and search the invitee by email, name, or keywords, etc.
const userInvitesData = await roqClient.asSuperAdmin().userInvites({
  limit: 10
})| Parameter | Type | Description | 
|---|---|---|
limit | integer | Limit the results | 
search | object | Search parameter. Look into this here (opens in a new tab) | 
filter | object | Filter parameter. Look into this here (opens in a new tab) | 
userInvite()
Get the data of the invitee. The documentation for the userInvite API is in the GraphQL API reference (opens in a new tab).
const userInvite = await roqClient.asSuperAdmin().userInvite({
	id: "78f665fb-61ab-4931-a565-3136e6d01553"
})| Parameter | Type | Description | 
|---|---|---|
id | uuid | The invitee ID |