export {};
import { EventEmitter } from "events";
import { Invitation } from "../common/models/Invitation";
import { Logger } from "../common/Logger";
import { Core } from "../Core";
import { GenericService } from "./GenericService";
import { Contact } from "../common/models/Contact";
/**
* @module
* @name InvitationsService
* @version SDKVERSION
* @public
* @description
* This services manages the invitations received/ sent from/to server.
*
*/
declare class InvitationsService extends GenericService {
receivedInvitations: {};
sentInvitations: {};
acceptedInvitationsArray: any[];
sentInvitationsArray: any[];
receivedInvitationsArray: any[];
private _listeners;
private _portalURL;
private _contactConfigRef;
acceptedInvitations: {};
private _invitationEventHandler;
private _invitationHandlerToken;
private _contacts;
private _bubbles;
private stats;
static getClassName(): string;
getClassName(): string;
static getAccessorName(): string;
getAccessorName(): string;
constructor(_core: Core, _eventEmitter: EventEmitter, _logger: Logger, _startConfig: {
start_up: boolean;
optional: boolean;
});
/************************************************************/
/** LIFECYCLE STUFF **/
/************************************************************/
start(_options: any, stats: any): Promise;
init(useRestAtStartup: boolean): Promise;
stop(): Promise;
/************************************************************/
/** EVENT HANDLING STUFF **/
/************************************************************/
attachHandlers(): void;
onRosterChanged(data: any): void;
onOpenInvitationManagementUpdate(openInvitation: any): Promise;
onInvitationsManagementUpdate(userInvite: any): Promise;
onJoinCompanyInviteManagementMessageReceived(joincompanyinvite: any): Promise;
onJoinCompanyRequestManagementMessageReceived(joincompanyrequest: any): Promise;
handleReceivedInvitation(id: any, action: any): Promise;
handleSentInvitation(id: any, action: any): Promise;
updateReceivedInvitationsArray(): void;
updateSentInvitationsArray(): void;
/**
* @private
*/
getAllReceivedInvitations(): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method getReceivedInvitations
* @instance
* @category Invitations RECEIVED
* @description
* Get the invite received coming from Rainbow users
* @return {Invitation[]} The list of invitations received
*/
getReceivedInvitations(): any[];
/**
* @public
* @nodered true
* @since 2.9.0
* @method searchInvitationsReceivedFromServer
* @instance
* @category Invitations RECEIVED
* @param {string} sortField="lastNotificationDate" Sort items list based on the given field. Default value : lastNotificationDate.
* @param {string} status="pending" List all invitations having the provided status(es). Possible values : pending, accepted, auto-accepted, declined, canceled, failed. Default value : pending.
* @param {string} format="small" Allows to retrieve more or less invitation details in response. Default value : `small`. Possible values : `small`, `medium`, `full`
* @param {number} limit=500 Allow to specify the number of items to retrieve. Default value : 500
* @param {number} offset=0 Allow to specify the position of first item to retrieve (first item if not specified). Warning: if offset > total, no results are returned. Default value : 0.
* @param {number} sortOrder=1 Specify order when sorting items list. Default value : 1. Possible values : -1, 1.
* @description
* retrieve the invites received from others Rainbow users from server.
* @return {any} The list of invite received
*
*
* | Champ | Type | Description |
* | --- | --- | --- |
* | data | Object\[\] | List of user invitation Objects. |
* | limit | Number | Number of requested items |
* | offset | Number | Requested position of the first item to retrieve |
* | total | Number | Total number of items |
* | id | String | Invitation unique Id |
* | invitedUserId optionnel | String | Invited user unique Rainbow Id. Only available for the inviting user if the invited user has been invited from his userId (parameter invitedUserId in API POST /api/rainbow/enduser/v1.0/users/:userId/invitations) or if the invitation has been accepted. |
* | invitedPhoneNumber optionnel | String | Invited user phoneNumber |
* | invitedUserEmail optionnel | String | Invited user email |
* | invitingUserId | String | Inviting user unique Rainbow Id |
* | invitingUserEmail | String | Inviting user loginEmail |
* | requestedNotificationLanguage | String | Requested notification language (used to re-send email request in that language) |
* | invitingDate | Date-Time | Date the invitation was created |
* | lastNotificationDate | Date-Time | Date when the last email notification was sent |
* | status | String | Invitation status: one of `pending`, `accepted`, `auto-accepted`, `declined`, `canceled`, `failed` * `pending`: invitation has been sent by inviting user and not yet accepted by invited user * `accepted`: invitation has been accepted by invited user * `auto-accepted`: invitation has been auto-accepted (case of users in same company) * `declined`: invitation has been declined by invited user. Only invited user can see that he has declined an invitation. Inviting user still see the invitation as `pending` * `canceled`: invitation has been canceled by inviting user. If invited user does not have an account in Rainbow, he can still use this invitationId received by email to create his Rainbow account, but he will not be added to inviting user roster. * `failed`: invitation email failed to be sent to invited user (determined by parsing SMTP server logs). It can be the case if the provided invited email address does not exists. |
* | type | String | Invitation type: * `visibility` (invited user exists in Rainbow), * `registration` (invited user did not exist in Rainbow when invitation was sent) |
*
*/
searchInvitationsReceivedFromServer(sortField?: string, status?: string, format?: string, limit?: number, offset?: number, sortOrder?: number): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method getAcceptedInvitations
* @instance
* @category Invitations RECEIVED
* @description
* Get the invites you accepted received from others Rainbow users
* @return {Invitation[]} The list of invite sent
*/
getAcceptedInvitations(): any[];
/**
* @public
* @nodered true
* @since 1.65
* @method getInvitationsNumberForCounter
* @category Invitations RECEIVED
* @instance
* @description
* Get the number of invitations received from others Rainbow users
* @return {Invitation[]} The list of invite sent
*/
getInvitationsNumberForCounter(): number;
/**
* @public
* @nodered true
* @since 1.65
* @method getServerInvitation
* @instance
* @category Invitations RECEIVED
* @description
* Get an invitation by its id from server.
* @param {String} invitationId the id of the invite to retrieve
* @return {Invitation} The invite if found
*/
getServerInvitation(invitationId: string): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method getInvitation
* @instance
* @category Invitations RECEIVED
* @description
* Get an invitation by its id
* @param {String} invitationId the id of the invite to retrieve
* @return {Invitation} The invite if found
*/
getInvitation(invitationId: string): any;
/**
* @public
* @nodered true
* @since 1.65
* @method joinContactInvitation
* @instance
* @category Invitations RECEIVED
* @async
* @description
* Accepts an invitation from an other Rainbow user to mutually join the network
* Once accepted, the user will be part of your network.
* Return a promise
* @param {Contact} contact The invitation to accept
* @return {Promise} A promise that contains SDK.OK if success or an object that describes the error
*/
joinContactInvitation(contact: Contact): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method acceptInvitation
* @instance
* @category Invitations RECEIVED
* @async
* @description
* Accepts an invitation from an other Rainbow user to mutually join the network
* Once accepted, the user will be part of your network.
* Return a promise
* @param {Invitation} invitation The invitation to accept
* @return {Promise} A promise that contains SDK.OK if success or an object that describes the error
*
*
* | Champ | Type | Description |
* | --- | --- | --- |
* | id | String | Invitation unique Id |
* | invitedUserId optionnel | String | Invited user unique Rainbow Id. Only available for the inviting user if the invited user has been invited from his userId (parameter invitedUserId in API POST /api/rainbow/enduser/v1.0/users/:userId/invitations) or if the invitation has been accepted. |
* | invitedPhoneNumber optionnel | String | Invited user phoneNumber |
* | invitedUserEmail optionnel | String | Invited user email |
* | invitingUserId | String | Inviting user unique Rainbow Id |
* | invitingUserEmail | String | Inviting user loginEmail |
* | requestedNotificationLanguage | String | Requested notification language (used to re-send email request in that language) |
* | invitingDate | Date-Time | Date the invitation was created |
* | lastNotificationDate | Date-Time | Date when the last email notification was sent |
* | status | String | Invitation status: one of `pending`, `accepted`, `auto-accepted`, `declined`, `canceled`, `failed` * `pending`: invitation has been sent by inviting user and not yet accepted by invited user * `accepted`: invitation has been accepted by invited user * `auto-accepted`: invitation has been auto-accepted (case of users in same company) * `declined`: invitation has been declined by invited user. Only invited user can see that he has declined an invitation. Inviting user still see the invitation as `pending` * `canceled`: invitation has been canceled by inviting user. If invited user does not have an account in Rainbow, he can still use this invitationId received by email to create his Rainbow account, but he will not be added to inviting user roster. * `failed`: invitation email failed to be sent to invited user (determined by parsing SMTP server logs). It can be the case if the provided invited email address does not exists. |
* | type | String | Invitation type: * `visibility` (invited user exists in Rainbow), * `registration` (invited user did not exist in Rainbow when invitation was sent) |
*
*/
acceptInvitation(invitation: Invitation): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method declineInvitation
* @instance
* @category Invitations RECEIVED
* @async
* @description
* Decline an invitation from an other Rainbow user to mutually join the network
* Once declined, the user will not be part of your network.
* Return a promise
* @param {Invitation} invitation The invitation to decline
* @return {Promise} A promise that contains SDK.OK in case of success or an object that describes the error
*
*
* | Champ | Type | Description |
* | --- | --- | --- |
* | data | Object | User invitation Object. |
* | id | String | Invitation unique Id |
* | invitedUserId optionnel | String | Invited user unique Rainbow Id. Only available for the inviting user if the invited user has been invited from his userId (parameter invitedUserId in API POST /api/rainbow/enduser/v1.0/users/:userId/invitations) or if the invitation has been accepted. |
* | invitedPhoneNumber optionnel | String | Invited user phoneNumber |
* | invitedUserEmail optionnel | String | Invited user email |
* | invitingUserId | String | Inviting user unique Rainbow Id |
* | invitingUserEmail | String | Inviting user loginEmail |
* | requestedNotificationLanguage | String | Requested notification language (used to re-send email request in that language) |
* | invitingDate | Date-Time | Date the invitation was created |
* | lastNotificationDate | Date-Time | Date when the last email notification was sent |
* | status | String | Invitation status: one of `pending`, `accepted`, `auto-accepted`, `declined`, `canceled`, `failed` * `pending`: invitation has been sent by inviting user and not yet accepted by invited user * `accepted`: invitation has been accepted by invited user * `auto-accepted`: invitation has been auto-accepted (case of users in same company) * `declined`: invitation has been declined by invited user. Only invited user can see that he has declined an invitation. Inviting user still see the invitation as `pending` * `canceled`: invitation has been canceled by inviting user. If invited user does not have an account in Rainbow, he can still use this invitationId received by email to create his Rainbow account, but he will not be added to inviting user roster. * `failed`: invitation email failed to be sent to invited user (determined by parsing SMTP server logs). It can be the case if the provided invited email address does not exists. |
* | type | String | Invitation type: * `visibility` (invited user exists in Rainbow), * `registration` (invited user did not exist in Rainbow when invitation was sent) |
*
*/
declineInvitation(invitation: Invitation): Promise;
/**
* @private
*/
getAllSentInvitations(): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method getSentInvitations
* @instance
* @category Invitations SENT
* @description
* Get the invites sent to others Rainbow users
* @return {Invitation[]} The list of invite sent
*/
getSentInvitations(): any[];
/**
* @public
* @nodered true
* @since 2.9.0
* @method searchInvitationsSentFromServer
* @instance
* @category Invitations SENT
* @param {string} sortField="lastNotificationDate" Sort items list based on the given field. Default value : lastNotificationDate
* @param {string} status="pending" List all invitations having the provided status(es). Possible values : pending, accepted, auto-accepted, declined, canceled, failed. Default value : pending.
* @param {string} format="small" Allows to retrieve more or less invitation details in response. Default value : `small`. Possible values : `small`, `medium`, `full`
* @param {number} limit=500 Allow to specify the number of items to retrieve. Default value : 500
* @param {number} offset=0 Allow to specify the position of first item to retrieve (first item if not specified). Warning: if offset > total, no results are returned.
* @param {number} sortOrder=1 Specify order when sorting items list. Default value : 1. Possible values : -1, 1.
* @description
* retrieve the invites sent to others Rainbow users from server.
* @return {any} The list of invite sent
*
*
* | Champ | Type | Description |
* | --- | --- | --- |
* | data | Object\[\] | List of user invitation Objects. |
* | authorizedReSendInvitationDate optionnel | Date-Time | Date when the inviting user will be allowed to resend again the invitation to the invited user. authorizedReSendInvitationDate is only set if invitation still have the status pending. |
* | limit | Number | Number of requested items |
* | offset | Number | Requested position of the first item to retrieve |
* | total | Number | Total number of items |
* | id | String | Invitation unique Id |
* | invitedUserId optionnel | String | Invited user unique Rainbow Id. Only available for the inviting user if the invited user has been invited from his userId (parameter invitedUserId in API POST /api/rainbow/enduser/v1.0/users/:userId/invitations) or if the invitation has been accepted. |
* | invitedPhoneNumber optionnel | String | Invited user phoneNumber |
* | invitedUserEmail optionnel | String | Invited user email |
* | invitingUserId | String | Inviting user unique Rainbow Id |
* | invitingUserEmail | String | Inviting user loginEmail |
* | requestedNotificationLanguage | String | Requested notification language (used to re-send email request in that language) |
* | invitingDate | Date-Time | Date the invitation was created |
* | lastNotificationDate | Date-Time | Date when the last email notification was sent |
* | status | String | Invitation status: one of `pending`, `accepted`, `auto-accepted`, `declined`, `canceled`, `failed` * `pending`: invitation has been sent by inviting user and not yet accepted by invited user * `accepted`: invitation has been accepted by invited user * `auto-accepted`: invitation has been auto-accepted (case of users in same company) * `declined`: invitation has been declined by invited user. Only invited user can see that he has declined an invitation. Inviting user still see the invitation as `pending` * `canceled`: invitation has been canceled by inviting user. If invited user does not have an account in Rainbow, he can still use this invitationId received by email to create his Rainbow account, but he will not be added to inviting user roster. * `failed`: invitation email failed to be sent to invited user (determined by parsing SMTP server logs). It can be the case if the provided invited email address does not exists. |
* | type | String | Invitation type: * `visibility` (invited user exists in Rainbow), * `registration` (invited user did not exist in Rainbow when invitation was sent) |
*
*/
searchInvitationsSentFromServer(sortField?: string, status?: string, format?: string, limit?: number, offset?: number, sortOrder?: number): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method sendInvitationByEmail
* @instance
* @category Invitations SENT
* @async
* @description
* This API allows logged in user to invite another user by email.
* At the end of the process, if invited user accepts the invitation, invited user and inviting user will be searchable mutually and will be in each other rosters.
* @param {string} email The email.
* @param {string} lang The lang of the message.
* @param {string} customMessage The email text (optional).
* @return {Object} A promise that contains the contact added or an object describing an error
*
*
* | Champ | Type | Description |
* | --- | --- | --- |
* | data | Object | User invitation Object. |
* | authorizedReSendInvitationDate | Date-Time | Date when the inviting user will be allowed to resend again the invitation to the invited user. |
* | invitationUrl optionnel | String | Invitation URL to be sent to the invited user. Only returned for invitations sent using `invitedPhoneNumber`, as invitation URL link is sent by SMS on client side. |
* | id | String | Invitation unique Id |
* | invitedUserId optionnel | String | Invited user unique Rainbow Id. Only available for the inviting user if the invited user has been invited from his userId (parameter invitedUserId in API POST /api/rainbow/enduser/v1.0/users/:userId/invitations) or if the invitation has been accepted. |
* | invitedPhoneNumber optionnel | String | Invited user phoneNumber |
* | invitedUserEmail optionnel | String | Invited user email |
* | invitingUserId | String | Inviting user unique Rainbow Id |
* | invitingUserEmail | String | Inviting user loginEmail |
* | requestedNotificationLanguage | String | Requested notification language (used to re-send email request in that language) |
* | invitingDate | Date-Time | Date the invitation was created |
* | lastNotificationDate | Date-Time | Date when the last email notification was sent |
* | status | String | Invitation status: one of `pending`, `accepted`, `auto-accepted`, `declined`, `canceled`, `failed` * `pending`: invitation has been sent by inviting user and not yet accepted by invited user * `accepted`: invitation has been accepted by invited user * `auto-accepted`: invitation has been auto-accepted (case of users in same company) * `declined`: invitation has been declined by invited user. Only invited user can see that he has declined an invitation. Inviting user still see the invitation as `pending` * `canceled`: invitation has been canceled by inviting user. If invited user does not have an account in Rainbow, he can still use this invitationId received by email to create his Rainbow account, but he will not be added to inviting user roster. * `failed`: invitation email failed to be sent to invited user (determined by parsing SMTP server logs). It can be the case if the provided invited email address does not exists. |
* | type | String | Invitation type: * `visibility` (invited user exists in Rainbow), * `registration` (invited user did not exist in Rainbow when invitation was sent) |
*
*/
sendInvitationByEmail(email: string, lang: string, customMessage: string): Promise;
/**
* @public
* @nodered true
* @since 2.9.0
* @method sendInvitationByCriteria
* @instance
* @category Invitations SENT
* @async
* @description
* This API allows logged in user to invite another user by criteria.
* At the end of the process, if invited user accepts the invitation, invited user and inviting user will be searchable mutually and will be in each other rosters.
*
*
* **Notes**:
*
* * One of email, invitedPhoneNumber or invitedUserId is mandatory.
* * It's not possible to invite users having only the role `guest`. (CPAAS user)
* * Users with visibility `isolated` or being in a company with visibility `isolated` are not allowed to invite external users.
* * Users with visibility `isolated` or being in a company with visibility `isolated` are not allowed to be invited by external users.
* From **1.53.0**, a user can be embedded in a chat or conference room, as guest, with limited rights until he finalizes his registration.
* It is not a user with the role `guest`.
* This user gets the role `user` and the flag `guestMode` is set to true, waiting for the user finalizes his account. Besides, his `visibility` is 'none'.
* We can't invite this kind of user to join the logged in network. (HTTP error 403509)
*
* Here are some details about this API and user invitation features.
* Users can be invited:
*
* * by `email`:
* * If the provided email corresponds to the loginEmail of a Rainbow user, a visibility request is sent (if this Rainbow user is not in logged in user roster).
* * An InviteUser entry is stored in database (with a generated invitationId).
* * The invited user receive an email with a validation link (containing the invitationId).
* * The invited user is notified with an XMPP message (containing the invitationId).
*
* * The inviting user is notified with an XMPP message (containing the invitationId) (useful for multi-device).
*
* * The list of all visibility requests received by the logged in user (invited user side) can be retrieved with the API [GET /api/rainbow/enduser/v1.0/users/:userId/invitations/received(?status=pending|accepted|auto-accepted|declined)](#api-enduser_invitations-enduser_users_GetReceivedInvites)
* * The list of all visibility requests sent by the logged in user (inviting user side) can be retrieved with the API [GET /api/rainbow/enduser/v1.0/users/:userId/invitations/sent(?status=pending|accepted|auto-accepted|declined)](#api-enduser_invitations-enduser_users_GetSentInvites)
* * The inviting user can re-send a visibility request notification (only by email) using API [POST /api/rainbow/enduser/v1.0/notifications/emails/invite-by-end-user/:invitationId/re-send](#api-enduser_notifications_emails-enduser_ResendInvite)
* * To accept the visibility request (invited user side), client has to call API [POST /api/rainbow/enduser/v1.0/users/:userId/invitations/:invitationId/accept](#api-enduser_invitations-enduser_users_AcceptInvites)
* Once accepted, invited and inviting user will be in each other roster and will be mutually visible (search API, GET users, GET users/:userId, ...)
* * To decline the visibility request (invited user side), client has to call API [POST /api/rainbow/enduser/v1.0/users/:userId/invitations/:invitationId/decline](#api-enduser_invitations-enduser_users_DeclineInvites)
* * If the provided email is not known in Rainbow, an invitation is sent to this email to invite the person to create a Rainbow account
* * An InviteUser entry is stored in database (with a generated invitationId).
* * The invited user receive an email with a creation link (containing the invitationId).
* * The inviting user is notified with an XMPP message (containing the invitationId) (useful for multi-device).
*
* * The list of all visibility requests sent by the logged in user (inviting user side) can be retrieved with the API [GET /api/rainbow/enduser/v1.0/users/:userId/invitations/sent(?status=pending|accepted|auto-accepted|declined)](#api-enduser_invitations-enduser_users_GetSentInvites)
* * The inviting user can re-send a visibility request notification (only by email) using API [POST /api/rainbow/enduser/v1.0/notifications/emails/invite-by-end-user/:invitationId/re-send](#api-enduser_notifications_emails-enduser_ResendInvite)
* * To create his Rainbow account, the invited user has to use API "Self register a user" ([POST /api/rainbow/enduser/v1.0/users/self-register](#api-enduser_users-enduser_SelfRegisterUsers))
* * by phoneNumber (`invitedPhoneNumber`):
* * No match is done on potential existing Rainbow users.
* * An InviteUser entry is stored in database (with a generated invitationId).
* * No email is sent to invited user. It is **up to clients calling this API to send an SMS to the invited user's phone** (with the invitationId).
* * The inviting user is notified with an XMPP message (containing the invitationId) (useful for multi-device).
*
* * If the invitedPhoneNumber correspond to a user already existing in Rainbow, he **will not** be able to see the request using the API [GET /api/rainbow/enduser/v1.0/users/:userId/invitations/received(?status=pending|accepted|auto-accepted|declined)](#api-enduser_invitations-enduser_users_GetReceivedInvites), as no match is done between the invitedPhoneNumber and a potential user existing in Rainbow
* * The list of all visibility requests sent by the logged in user (inviting user side) can be retrieved with the API [GET /api/rainbow/enduser/v1.0/users/:userId/invitations/sent(?status=pending|accepted|auto-accepted|declined)](#api-enduser_invitations-enduser_users_GetSentInvites)
* * The inviting user can re-send a visibility request notification done by phoneNumber using API [POST /api/rainbow/enduser/v1.0/notifications/emails/invite-by-end-user/:invitationId/re-send](#api-enduser_notifications_emails-enduser_ResendInvite), however it is still **up to client to send an SMS to the invited user's phone** (the API only updates the field lastNotificationDate). If needed, it is **up to clients to re-send the SMS to the invited user's phone**.
* * To create his Rainbow account, the invited user has to use API "Self register a user" using the associated invitationId ([POST /api/rainbow/enduser/v1.0/users/self-register](#api-enduser_users-enduser_SelfRegisterUsers))
* * by Rainbow user id (`invitedUserId`):
* * if no user is found with the provided invitedUserId, an error 404 is returned
* * otherwise, a visibility request is sent (if this Rainbow user is not in logged in user roster).
* Same documentation than existing user invited by email apply (see above).
* @param {string} email The email.
* @param {string} invitedPhoneNumber Invited phone number.
* @param {string} invitedUserId Invited Rainbow user unique ID
* @param {string} lang The lang of the message.
* @param {string} customMessage The email text (optional).
* @return {Object} A promise that contains the contact added or an object describing an error
*
*
* | Champ | Type | Description |
* | --- | --- | --- |
* | data | Object | User invitation Object. |
* | authorizedReSendInvitationDate | Date-Time | Date when the inviting user will be allowed to resend again the invitation to the invited user. |
* | invitationUrl optionnel | String | Invitation URL to be sent to the invited user. Only returned for invitations sent using `invitedPhoneNumber`, as invitation URL link is sent by SMS on client side. |
* | id | String | Invitation unique Id |
* | invitedUserId optionnel | String | Invited user unique Rainbow Id. Only available for the inviting user if the invited user has been invited from his userId (parameter invitedUserId in API POST /api/rainbow/enduser/v1.0/users/:userId/invitations) or if the invitation has been accepted. |
* | invitedPhoneNumber optionnel | String | Invited user phoneNumber |
* | invitedUserEmail optionnel | String | Invited user email |
* | invitingUserId | String | Inviting user unique Rainbow Id |
* | invitingUserEmail | String | Inviting user loginEmail |
* | requestedNotificationLanguage | String | Requested notification language (used to re-send email request in that language) |
* | invitingDate | Date-Time | Date the invitation was created |
* | lastNotificationDate | Date-Time | Date when the last email notification was sent |
* | status | String | Invitation status: one of `pending`, `accepted`, `auto-accepted`, `declined`, `canceled`, `failed` * `pending`: invitation has been sent by inviting user and not yet accepted by invited user * `accepted`: invitation has been accepted by invited user * `auto-accepted`: invitation has been auto-accepted (case of users in same company) * `declined`: invitation has been declined by invited user. Only invited user can see that he has declined an invitation. Inviting user still see the invitation as `pending` * `canceled`: invitation has been canceled by inviting user. If invited user does not have an account in Rainbow, he can still use this invitationId received by email to create his Rainbow account, but he will not be added to inviting user roster. * `failed`: invitation email failed to be sent to invited user (determined by parsing SMTP server logs). It can be the case if the provided invited email address does not exists. |
* | type | String | Invitation type: * `visibility` (invited user exists in Rainbow), * `registration` (invited user did not exist in Rainbow when invitation was sent) |
*
*/
sendInvitationByCriteria(email: string, invitedPhoneNumber: string, invitedUserId: string, lang: string, customMessage: string): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method cancelOneSendInvitation
* @instance
* @category Invitations SENT
* @async
* @param {Invitation} invitation The invitation to cancel
* @description
* Cancel an invitation sent
* @return {Object} The SDK Ok object or an error
*/
cancelOneSendInvitation(invitation: Invitation): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method reSendInvitation
* @instance
* @category Invitations SENT
* @async
* @param {string} invitationId The invitation to re send
* @param {string} customMessage Custom message that inviting user can add in email body
* @description
* This API can be used to re-send a user invitation which has already been sent.
* Logged in user must be the one who sent the invitatio.
* An invitation can only be re-sent after a given period since last notification (1 hour by default).
* If invitation is canceled or failed, it is set back to pending and then re-sent.
* If invitation is accepted or auto-accepted, error 409 is returned.
* If invitation is declined, it is set back to pending and re-sent if the last notification was sent since a given period (1 week by default).
* @return {Object} The SDK Ok object or an error
*
*
* | Champ | Type | Description |
* | --- | --- | --- |
* | data | Object | User invitation Object. |
* | authorizedReSendInvitationDate | Date-Time | Date when the inviting user will be allowed to resend again the invitation to the invited user. |
* | invitationUrl optionnel | String | Invitation URL to be sent to the invited user. Only returned for invitations sent using `invitedPhoneNumber`, as invitation URL link is sent by SMS on client side. |
* | id | String | Invitation unique Id |
* | invitedUserId optionnel | String | Invited user unique Rainbow Id. Only available for the inviting user if the invited user has been invited from his userId (parameter invitedUserId in API POST /api/rainbow/enduser/v1.0/users/:userId/invitations) or if the invitation has been accepted. |
* | invitedPhoneNumber optionnel | String | Invited user phoneNumber |
* | invitedUserEmail optionnel | String | Invited user email |
* | invitingUserId | String | Inviting user unique Rainbow Id |
* | invitingUserEmail | String | Inviting user loginEmail |
* | requestedNotificationLanguage | String | Requested notification language (used to re-send email request in that language) |
* | invitingDate | Date-Time | Date the invitation was created |
* | lastNotificationDate | Date-Time | Date when the last email notification was sent |
* | status | String | Invitation status: one of `pending`, `accepted`, `auto-accepted`, `declined`, `canceled`, `failed` * `pending`: invitation has been sent by inviting user and not yet accepted by invited user * `accepted`: invitation has been accepted by invited user * `auto-accepted`: invitation has been auto-accepted (case of users in same company) * `declined`: invitation has been declined by invited user. Only invited user can see that he has declined an invitation. Inviting user still see the invitation as `pending` * `canceled`: invitation has been canceled by inviting user. If invited user does not have an account in Rainbow, he can still use this invitationId received by email to create his Rainbow account, but he will not be added to inviting user roster. * `failed`: invitation email failed to be sent to invited user (determined by parsing SMTP server logs). It can be the case if the provided invited email address does not exists. |
* | type | String | Invitation type: * `visibility` (invited user exists in Rainbow), * `registration` (invited user did not exist in Rainbow when invitation was sent) |
*
*/
reSendInvitation(invitationId: string, customMessage: string): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method sendInvitationsByBulk
* @instance
* @category Invitations SENT
* @async
* @description
* Send invitations for a list of emails as UCaaS
* LIMITED TO 100 invitations
* @param {Array} listOfMails The list of emails
* @param {string} lang Force language of the email notification if not available.
* Language format is composed of locale using format ISO 639-1, with optionally the regional variation using ISO 3166‑1 alpha-2 (separated by hyphen).
* Locale part is in lowercase, regional part is in uppercase. Examples: en, en-US, fr, fr-FR, fr-CA, es-ES, es-MX, ...
* More information about the format can be found on this link.
* Algorithm for choosing language of email:
* invited user language is used if invited user exists in Rainbow and his language is available,
* else provided language in parameter lang is used if provided,
* else inviting user language is used if language is available,
* otherwise English is used.
* @param {string} customMessage Custom message that inviting user can add in email body. The message will be the same for all emails.
* @return {Object} A promise that the invite result or an object describing an error
*
*
* | Champ | Type | Description |
* | --- | --- | --- |
* | report | Object | Report of the bulk operation |
* | status | String | Status of the bulk operation. `ongoing`: there is at least 1 email to send `failed`: there is no email to send and errors occurred with the synchronous validation of the provided emails Possibles values : `ongoing`, `failed` |
* | ongoing | Object\[\] | List of emails which will be treated |
* | email | String | Email address to invite |
* | index | Number | Position of the email address to invite in the input emails array |
* | errors | Object\[\] | Errors which has occurred during the validation of this email. Should always be empty, otherwise the email would be in the failed array. |
* | status | String | Status of the email invitation. Should always be ongoing, as the treatment is asynchronous and there is currently no way for the client to know the progression of the bulk invitations. |
* | failed | Object\[\] | List of emails for which the synchronous validation has failed |
* | email | String | Email address which failed validation |
* | index | Number | Position of the email address in the input emails array |
* | errors | Object\[\] | Errors which has occurred during the validation of this email. |
* | errorCode | Number | HTTP error code |
* | errorMsg | string | HTTP error message |
* | errorDetails | string | Detailed message about the error |
* | errorDetailsCode | Number | Detailed code about the error |
* | status | String | Status of the email invitation (failed). |
* | counters | Object | Counters of the different operation status |
* | total | Number | Total number of email addresses processed |
* | errorDetailsData | Object | Data about the error. The data being in this object (if any) are specific to the error and can help the clients to build an error message regarding the error. |
* | ongoing | Number | Number of emails that will be treated |
* | failed | Number | Number of emails for which the synchronous validation has failed |
*
*/
sendInvitationsByBulk(listOfMails: Array, lang?: string, customMessage?: string): Promise;
sendInvitationsParBulk(listOfMails: Array, lang?: string, customMessage?: string): Promise;
/**
* @public
* @nodered true
* @since 1.65
* @method getAllInvitationsNumber
* @instance
* @category Invitations RECEIVED/SENT
* @description
* Get the number of invitations sent/received to/from others Rainbow users
* @return {Invitation[]} The list of invite sent
*/
getAllInvitationsNumber: () => any;
/**
* @public
* @nodered true
* @since 2.21.0
* @method deleteAUserInvitation
* @instance
* @category Invitations SENT
* @async
* @param {Invitation} invitation The invitation to delete.
* @description
* This API can be used to delete an invitation sent to/received from another Rainbow user.
* @return {Object} The SDK Ok object or an error
*
*
* | Champ | Type | Description |
* | --- | --- | --- |
* | data | Object | User invitation Object. |
* | id | String | Invitation unique Id |
* | invitedUserId optionnel | String | Invited user unique Rainbow Id. Only available for the inviting user if the invited user has been invited from his userId (parameter invitedUserId in API POST /api/rainbow/enduser/v1.0/users/:userId/invitations) or if the invitation has been accepted. |
* | invitedPhoneNumber optionnel | String | Invited user phoneNumber |
* | invitedUserEmail optionnel | String | Invited user email |
* | invitingUserId | String | Inviting user unique Rainbow Id |
* | invitingUserEmail | String | Inviting user loginEmail |
* | requestedNotificationLanguage | String | Requested notification language (used to re-send email request in that language) |
* | invitingDate | Date-Time | Date the invitation was created |
* | lastNotificationDate | Date-Time | Date when the last email notification was sent |
* | status | String | Invitation status: one of `pending`, `accepted`, `auto-accepted`, `declined`, `canceled`, `failed` * `pending`: invitation has been sent by inviting user and not yet accepted by invited user * `accepted`: invitation has been accepted by invited user * `auto-accepted`: invitation has been auto-accepted (case of users in same company) * `declined`: invitation has been declined by invited user. Only invited user can see that he has declined an invitation. Inviting user still see the invitation as `pending` * `canceled`: invitation has been canceled by inviting user. If invited user does not have an account in Rainbow, he can still use this invitationId received by email to create his Rainbow account, but he will not be added to inviting user roster. * `failed`: invitation email failed to be sent to invited user (determined by parsing SMTP server logs). It can be the case if the provided invited email address does not exists. |
* | type | String | Invitation type: * `visibility` (invited user exists in Rainbow), * `registration` (invited user did not exist in Rainbow when invitation was sent) |
*
*/
deleteAUserInvitation(invitation: Invitation): Promise;
/**
* @private
*/
updateContactInvitationStatus(contactDBId: string, status: string, invitation: any): Promise;
/**
* @private
*/
sortInvitationArray(invitA: any, invitB: any): number;
}
export { InvitationsService };