import { Conversation, PEERTYPE } from "../common/models/Conversation"; import { Logger } from "../common/Logger"; import { EventEmitter } from "events"; import { Core } from "../Core"; import { GenericService } from "./GenericService"; import { Message } from "../common/models/Message"; import { DataStoreType, UrgencyType } from "../config/config.js"; import { Bubble } from "../common/models/Bubble.js"; import { Contact } from "../common/models/Contact.js"; export {}; declare class ImsService extends GenericService { private _conversations; private _pendingMessages; private _bulles; private _imOptions; private _fileStorage; private _presence; static getClassName(): string; getClassName(): string; static getAccessorName(): string; getAccessorName(): string; constructor(_core: Core, _eventEmitter: EventEmitter, _logger: Logger, _imOptions: any, _startConfig: { start_up: boolean; optional: boolean; }); start(_options: any): Promise; stop(): Promise; init(enableCarbonBool: boolean, useRestAtStartup: boolean): Promise; /** * @private * @method enableCarbon * @instance * @description * Enable message carbon XEP-0280
* @async * @category Ims MANAGEMENT * @return {Promise} * @fulfil {} return nothing in case of success or an ErrorManager Object depending the result */ enableCarbon(): Promise; /** * @private * @method disableCarbon * @instance * @description * Disable message carbon XEP-0280
* @async * @category Ims MANAGEMENT * @return {Promise} * @fulfil {} return nothing in case of success or an ErrorManager Object depending the result */ disableCarbon(): Promise; /** * @public * @nodered true * @since 1.39 * @method getMessagesFromConversation * @instance * @description * (beta) Retrieve the list of messages from a conversation
* Calling several times this method will load older message from the history (pagination)
* @param {Conversation} conversation The conversation * @param {number} intNbMessage=30 The number of messages to retrieve. Optional. Default value is 30. Maximum value is 100 * @async * @category Ims MESSAGES * @return {Promise} * @fulfil {Conversation, ErrorManager} Return the conversation updated with the list of messages requested or an error (reject) if there is no more messages to retrieve */ getMessagesFromConversation(conversation: Conversation, intNbMessage?: number): Promise; /** * @public * @nodered true * @since 1.39 * @method getMessageFromConversationById * @instance * @async * @category Ims MESSAGES * @description * (beta) Retrieve a specific message in a conversation using its id
* @param {Conversation} conversation The conversation where to search for the message * @param {string} strMessageId The message id * @return {Message} The message if found or null */ getMessageFromConversationById(conversation: Conversation, strMessageId: string): Promise; /** * @public * @nodered true * @since 1.39 * @method getMessageFromBubbleById * @instance * @async * @category Ims MESSAGES * @description * Retrieve a specific message in a bubble using its id
* @param {Bubble} bubble The bubble where to search for the message * @param {string} strMessageId The message id * @return {Message} The message if found or null */ getMessageFromBubbleById(bubble: Bubble, strMessageId: string): Promise; /** * @public * @nodered true * @method markMessageAsRead * @instance * @description * Send a 'read' receipt to the recipient
* @param {Message} messageReceived The message received to mark as read * @async * @category Ims MESSAGES * @return {Promise} * @fulfil {} return nothing in case of success or an ErrorManager Object depending the result */ markMessageAsRead(messageReceived: Message): Promise; /** * @public * @nodered true * @since 1.39 * @method sendMessageToConversation * @instance * @async * @category Ims MESSAGES * @description * (beta) Send a instant message to a conversation
* This method works for sending messages to a one-to-one conversation or to a bubble conversation
* @param {Conversation} conversation The conversation recipient * @param {string} message The message to send * @param {string} lang=en The content language used * @param {Object} content Allow to send alternative text base content * @param {string} content.type The content message type (text/markdown) * @param {string} content.message The content message body * @param {string} subject The message subject * @param {UrgencyType} urgency=null The urgence of the message. String value can be : 'high' Urgent message, 'middle' important message, 'low' information message, "std' or null standard message * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} * @fulfil {Message} the message sent, or null in case of error, as parameter of the resolve */ sendMessageToConversation(conversation: Conversation, message: string, lang: string, content: any, subject: string, urgency?: UrgencyType, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendMessageToContact * @instance * @async * @category Ims MESSAGES * @description * Send a one-2-one message to a contact
* @param {string} message The message to send * @param {Contact} contact The contact (should have at least a jid_im property) * @param {string} lang=en The content language used * @param {Object} content Allow to send alternative text base content * @param {string} content.type The content message type (text/markdown) * @param {string} content.message The content message body * @param {string} subject The message subject * @param {UrgencyType} urgency=null The urgence of the message. String value can be : 'high' Urgent message, 'middle' important message, 'low' information message, "std' or null standard message * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} * @fulfil {Message} the message sent, or null in case of error, as parameter of the resolve */ sendMessageToContact(message: string, contact: Contact, lang: string, content: any, subject: string, urgency?: UrgencyType, p_messagesDataStore?: DataStoreType): Promise; /** * @private * @description * Store the message in a pending list. This pending list is used to wait the "_onReceipt" event from server when a message is sent.
* It allow to give back the status of the sending process.
* @param conversation * @param message */ /** * @private * @description * delete the message in a pending list. This pending list is used to wait the "_onReceipt" event from server when a message is sent.
* It allow to give back the status of the sending process.
* @param message */ /** * @public * @nodered true * @method sendMessageToJid * @instance * @async * @category Ims MESSAGES * @description * Send a one-2-one message to a contact identified by his Jid
* @param {string} message The message to send * @param {string} jid The contact Jid * @param {string} lang=en The content language used * @param {Object} content Allow to send alternative text base content * @param {string} content.type The content message type (text/markdown) * @param {string} content.message The content message body * @param {string} subject The message subject * @param {UrgencyType} urgency=null The urgence of the message. String value can be : 'high' Urgent message, 'middle' important message, 'low' information message, "std' or null standard message * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} * @fulfil {Message} - the message sent, or null in case of error, as parameter of the resolve */ sendMessageToJid(message: string, jid: string, lang: string, content: any, subject: string, urgency?: UrgencyType, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendMessageToJidAnswer * @instance * @async * @category Ims MESSAGES * @description * Send a reply to a one-2-one message to a contact identified by his Jid
* @param {string} message The message to send * @param {string} jid The contact Jid * @param {string} lang=en The content language used * @param {Object} content Allow to send alternative text base content * @param {string} content.type The content message type (text/markdown) * @param {string} content.message The content message body * @param {string} subject The message subject * @param {Object} answeredMsg The message answered * @param {UrgencyType} urgency=null The urgence of the message. String value can be : 'high' Urgent message, 'middle' important message, 'low' information message, "std' or null standard message * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} * @fulfil {Message} - the message sent, or null in case of error, as parameter of the resolve */ sendMessageToJidAnswer(message: string, jid: string, lang: string, content: any, subject: string, answeredMsg: any, urgency?: UrgencyType, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendMessageToJidAcknowledged * @instance * @async * @category Ims MESSAGES * @description * Send an Acknowledged reply to an urgent message (one to one, or bubble)
* @param {Message} message The message to acknoledge * @param {string} lang="EN" the lang used to acknowledged the message. * @param {string} ackLabel="Acknowledged" the label used to acknowledged the message. * @param {Array} attention=null array containing a list of JID of contact to mention or a string containing a sigle JID of the contact. * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} * @fulfil {Message} - the message */ sendMessageToJidAcknowledged(message: Message, lang?: string, ackLabel?: string, attention?: Array, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendMessageToJidIgnored * @instance * @async * @category Ims MESSAGES * @description * Send an Ignored reply to an urgent message (one to one, or bubble)
* @param {Message} message The message to Ignored * @param {string} lang="EN" the lang used to ignore the message. * @param {string} ignLabel="Ignored" the label used to ignore the message. * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} * @fulfil {Message} - the message */ sendMessageToJidIgnored(message: Message, lang?: string, ignLabel?: string, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendMessageToBubble * @instance * @async * @category Ims MESSAGES * @description * Send a message to a bubble
* @param {string} message The message to send * @param {Bubble} bubble The bubble (should at least have a jid property) * @param {string} lang=en The content language used * @param {Object} content Allow to send alternative text base content * @param {string} content.type The content message type (text/markdown) * @param {string} content.message The content message body * @param {string} subject The message subject * @param {Array} mentions=null array containing a list of JID of contact to mention or a string containing a single JID of the contact. * @param {UrgencyType} urgency=null The urgence of the message. String value can be : 'high' Urgent message, 'middle' important message, 'low' information message, "std' or null standard message * @param {DataStoreType} p_messagesDataStore=urgency used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} * @fulfil {Message} the message sent, or null in case of error, as parameter of the resolve */ sendMessageToBubble(message: string, bubble: Bubble, lang: string, content: any, subject: string, mentions?: Array | string, urgency?: UrgencyType, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendMessageToBubbleJid * @instance * @async * @category Ims MESSAGES * @description * Send a message to a bubble identified by its JID
* @param {string} message The message to send * @param {string} jid The bubble JID * @param {string} lang=en The content language used * @param {Object} content Allow to send alternative text base content * @param {string} content.type The content message type (text/markdown) * @param {string} content.message The content message body * @param {string} subject The message subject * @param {Array} mentions=null array containing a list of JID of contact to mention or a string containing a sigle JID of the contact. * @param {UrgencyType} urgency=null The urgence of the message. String value can be : 'high' Urgent message, 'middle' important message, 'low' information message, "std' or null standard message * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} * @fulfil {Message} the message sent, or null in case of error, as parameter of the resolve */ sendMessageToBubbleJid(message: string, jid: string, lang: string, content: any, subject: string, mentions?: Array | string, urgency?: UrgencyType, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendMessageToBubbleJidAnswer * @async * @category Ims MESSAGES * @instance * @description * Send a message to a bubble identified by its JID
* @param {string} message The message to send * @param {string} jid The bubble JID * @param {string} lang=en The content language used * @param {Object} content Allow to send alternative text base content * @param {string} content.type The content message type (text/markdown) * @param {string} content.message The content message body * @param {string} subject The message subject * @param {Object} answeredMsg The message answered * @param {Array} mentions=null array containing a list of JID of contact to mention or a string containing a sigle JID of the contact. * @param {UrgencyType} urgency=null The urgence of the message. String value can be : 'high' Urgent message, 'middle' important message, 'low' information message, "std' or null standard message * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} * @fulfil {Message} the message sent, or null in case of error, as parameter of the resolve */ sendMessageToBubbleJidAnswer(message: string, jid: string, lang: string, content: any, subject: string, answeredMsg: any, mentions?: Array | string, urgency?: UrgencyType, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @since 2.21.0 * @method retrieveXMPPMessagesByListOfMessageIds * @category Ims MESSAGES * @instance * @description * This API allow user to retrieve it's ims by list of message Ids, peer and peer type
* If message cannot be retrieved response will return status not found.
* @return {Promise} The result * * * | Champ | Type | Description | * | --- | --- | --- | * | data | Object\[\] | list of retrieved message | * | msgId | String | xmpp id of the message | * | peer | String | peer jid with which message has been exchanged | * | status optionnel | String | request status

* unchanged: When XMPP server message copy has the same hash,
* not_found: When message was not found, | * | xml optionnel | String | message content if message has been successfully retrieved (not present if message was status unchanged) | * | hash optionnel | String | message hash if message has been successfully retrieved (not present if message was status unchanged) | * | timestamp optionnel | String | message timestamp if message has been successfully retrieved (not present if message was status unchanged) | * * @param {Array} ims list of object that contains the following:
* [{
* **peer** : string jid with which message has been exchanged
* **msgId** : string xmpp message id of the message to retrieve
* **hash** optionnel : string md5 hash of the message to retrieve If hash is specified response will return status unchanged if XMPP message copy has the same hash Client should use hash whenever possible to reduce response size
* **type** : string Conversation type:
* - user: User to user,
* - room: User to room,
* - bot: User to bot
* Possibles values : "user", "room", "bot"
* }]
* */ retrieveXMPPMessagesByListOfMessageIds(ims: Array): Promise; /** * @public * @nodered true * @since 2.33.0 * @method addPinWithPeerId * @category Ims MESSAGES Pin list * @instance * @description * This API can be used to add a pin in user's Pins list with peerId.
* This API can only be used by user himself
* * @param {string} peerId peerId unique identifier
* @param {PEERTYPE} types type of peer id Valeurs autorisées : rooms, users * @param {Object} body Pin List Object. * * @return {Promise} The result * * * | Champ | Type | Description | * |-----------------|--------|----------------------------------------------| * | `peerId` | String | Id of the conversation's peer. | * | `peerJid` | String | Jid of the conversation's peer. | * | `conversationJid` | String | Jid of the conversation's peer. | * | `messageId` | String | XMPP message Id. | * | `messageTimestamp` | Number | Timestamp of the message. | * | `text` | String | Pin's text. | * | `fileInfo` *(optionnel)* | Object | File information. | * | `creationDate` *(optionnel)* | Number | Creation date in ms since Unix epoch. | * | id | String | Pin's Id | * * */ addPinWithPeerId(peerId: string, types: PEERTYPE, body: any): Promise; /** * @public * @nodered true * @since 2.33.0 * @method getPinWithPeerIdById * @category Ims MESSAGES Pin list * @instance * @description * This API can be used to get a pin in user's Pins list by peerId and pinId.
* This API can only be used by user himself
* * @param {PEERTYPE} types type of peer id Valeurs autorisées : rooms, users * @param {string} peerId peerId unique identifier
* @param {string} pinId id of Pin. * * @return {Promise} The result * * * | Champ | Type | Description | * |-----------------|--------|----------------------------------------------| * | `peerId` | String | Id of the conversation's peer. | * | `peerJid` | String | Jid of the conversation's peer. | * | `conversationJid` | String | Jid of the conversation's peer. | * | `messageId` | String | XMPP message Id. | * | `messageTimestamp` | Number | Timestamp of the message. | * | `text` | String | Pin's text. | * | `fileInfo` *(optionnel)* | Object | File information. | * | `creationDate` *(optionnel)* | Number | Creation date in ms since Unix epoch. | * | id | String | Pin's Id | * * */ getPinWithPeerIdById(types: PEERTYPE, peerId: string, pinId: string): Promise; /** * @public * @nodered true * @since 2.33.0 * @method getAllPinsWithPeerId * @category Ims MESSAGES Pin list * @instance * @description * This API can be used to get all pin in user's Pins list by peerId.
* This API can only be used by user himself
* * @param {PEERTYPE} types type of peer id Valeurs autorisées : rooms, users * @param {string} peerId peerId unique identifier
* * @return {Promise} The result * * Array of pin Object :
* * | Champ | Type | Description | * |-----------------|--------|----------------------------------------------| * | `peerId` | String | Id of the conversation's peer. | * | `peerJid` | String | Jid of the conversation's peer. | * | `conversationJid` | String | Jid of the conversation's peer. | * | `messageId` | String | XMPP message Id. | * | `messageTimestamp` | Number | Timestamp of the message. | * | `text` | String | Pin's text. | * | `fileInfo` *(optionnel)* | Object | File information. | * | `creationDate` *(optionnel)* | Number | Creation date in ms since Unix epoch. | * | id | String | Pin's Id | * * */ getAllPinsWithPeerId(types: PEERTYPE, peerId: string): Promise; /** * @public * @nodered true * @since 2.33.0 * @method removefromWithPeerIdAndPinId * @category Ims MESSAGES Pin list * @instance * @description * This API can be used to remove a pin in user's Pins list by peerId and pinId.
* This API can only be used by user himself
* * @param {PEERTYPE} types type of peer id Valeurs autorisées : rooms, users * @param {string} peerId peerId unique identifier
* @param {string} pinId id of Pin. * * @return {Promise} The result * * Array of :
* * | Champ | Type | Description | * |-----------------|--------|----------------------------------------------| * | status | String | deletion status. | * * */ removefromWithPeerIdAndPinId(types: PEERTYPE, peerId: string, pinId: string): Promise; /** * @public * @nodered true * @since 2.33.0 * @method updatePinWithPeerId * @category Ims MESSAGES Pin list * @instance * @description * This API can be used to add a pin in user's Pins list with peerId.
* This API can only be used by user himself
* * @param {string} peerId peerId unique identifier
* @param {PEERTYPE} types type of peer id Valeurs autorisées : rooms, users * @param {string} pinId id of Pin. * @param {Object} body Pin List Object. * * @return {Promise} The result * * * | Champ | Type | Description | * |-----------------|--------|----------------------------------------------| * | `peerId` | String | Id of the conversation's peer. | * | `peerJid` | String | Jid of the conversation's peer. | * | `conversationJid` | String | Jid of the conversation's peer. | * | `messageId` | String | XMPP message Id. | * | `messageTimestamp` | Number | Timestamp of the message. | * | `text` | String | Pin's text. | * | `fileInfo` *(optionnel)* | Object | File information. | * | `creationDate` *(optionnel)* | Number | Creation date in ms since Unix epoch. | * | id | String | Pin's Id | * * */ updatePinWithPeerId(peerId?: string, types?: PEERTYPE, pinId?: string, body?: any): Promise; _onmessageReceipt(receipt: any): void; /** * @public * @nodered true * @method sendIsTypingStateInBubble * @async * @category Ims TYPING * @instance * @description * Switch the "is typing" state in a bubble/room

* @param {Bubble} bubble The destination bubble * @param {boolean} status=true The status, true for setting "is Typing", false to remove it. * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Object} Return a promise with no parameter when succeed. */ sendIsTypingStateInBubble(bubble: Bubble, status?: boolean, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendIsTypingStateInConversation * @instance * @async * @category Ims TYPING * @description * Switch the "is typing" state in a conversation
* @param {Conversation} conversation The conversation recipient * @param {boolean} status=true The status, true for setting "is Typing", false to remove it * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return Return a promise with no parameter when succeed */ sendIsTypingStateInConversation(conversation: Conversation, status?: boolean, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendApplicationMessageContactJid * @instance * @async * @category Ims Application Messages * @description * Sends a message to a Contact Jid that is ignored in the UCaaS app's message stream * (e.g., in Rainbow Web Client, Desktop, Android, or iOS). * Useful for bots to communicate with other bots in the same conversation * without involving other users via the default application. * * Note: If a peer send the same kind of message, then the SDK receive the `rainbow_onrainbowcpaasreceived` event. It is Fired when a `rainbow-cpaas` event is receveid for a private data exchange. * @param jid - The Contact Jid to which the message is sent * @param xmlElements - List of XML elements to create * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * * @return {Promise} - that resolves on success * * * exemple: * * ``` * * const Element = require('ltx').Element; * let contactEmailToSearch = "xxx@xxx.com"; * // Retrieve a contact by its id * let contact = await rainbowSDK.contacts.getContactByLoginEmail(contactEmailToSearch); * // Retrieve the associated conversation * let conversation = await rainbowSDK.conversations.openConversationForContact(contact); * let now = new Date().getTime(); * let xmlElements = new Element('instance', {'xmlns': 'tests:rainbownodesdk', 'id': now }); * xmlElements.cnode(new Element('displayName').t("My displayName")); * xmlElements.cnode(new Element('description').t("My description")); * // Send message * let msgSent = await rainbowSDK.im.sendApplicationMessageContactJid(contact.jid, xmlElements); * * ``` * */ sendApplicationMessageContactJid(jid: any, xmlElements: any, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendApplicationMessageBubbleJid * @instance * @async * @category Ims Application Messages * @description * Sends a message to a Bubble Jid that is ignored in the UCaaS app's message stream * (e.g., in Rainbow Web Client, Desktop, Android, or iOS). * Useful for bots to communicate with other bots in the same conversation * without involving other users via the default application. * * @param {any} jid - The Bubble Jid to which the message is sent * @param {Element} xmlElements - List of XML elements to create * @param {DataStoreType} p_messagesDataStore=undefined used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} - that resolves on success * * * */ sendApplicationMessageBubbleJid(jid: any, xmlElements: any, p_messagesDataStore?: DataStoreType): Promise; /** * @public * @nodered true * @method sendVoicemailTranscriptionMessage * @instance * @async * @category Voicemail * @description * Sends a message to a contact Jid to add a voice message in the list. * * @param {string} to - The Jid to which the message is sent * @param {any} transcriptInfo : { jid : string, date : string, duration : number, url : string, transcript : string} = { jid : undefined, date : new Date().toISOString(), duration : 0, url : undefined, transcript : undefined} - informations of the voice mail. * @param {DataStoreType} p_messagesDataStore used to override the general of SDK's parameter "messagesDataStore". default value `undefined` to use the general value.
* DataStoreType.NoStore Tell the server to NOT store the messages for delay distribution or for history of the bot and the contact.
* DataStoreType.NoPermanentStore Tell the server to NOT store the messages for history of the bot and the contact. But being stored temporarily as a normal part of delivery (e.g. if the recipient is offline at the time of sending).
* DataStoreType.StoreTwinSide The messages are fully stored.
* DataStoreType.UsestoreMessagesField to follow the storeMessages SDK's parameter behaviour.
* DataStoreType.Store Offline storage and Message Archive Management (XEP-0313) [4] can define their own rules on what messages to store and usually only store messages that contain a body element. * However a sender may want to indicate that a message is worth storing even though it might not match those rules * (e.g. an encrypted message that carries the payload outside the body element). Such a message can be marked with a hint. * @return {Promise} - that resolves on success * * * */ sendVoicemailTranscriptionMessage(to: string, transcriptInfo: { jid: string; date: string; duration: number; fileDescId: string; fromNumber: string; transcript: string; }, p_messagesDataStore: DataStoreType): Promise; /** * @public * @nodered true * @method sendMessageNotification * @instance * @async * @category Notifications * @description * Sends a notification message using REST API POST /api/rainbow/enduser/v1.0/notifications/message. * Body parameters must follow the server documentation: https://api.openrainbow.org/enduser/#api-notifications_IM-sendMessageNotification * * @param {object} data - Body parameters sent to the endpoint. Summary of fields from the server doc: * - to: string | object - Mandatory. Recipient information. Depending on the use case, this can be: * - userId: string - Rainbow user identifier * - loginEmail: string - Rainbow login email * - jid_im: string - Recipient XMPP JID (IM) * - bubbleId: string - Bubble identifier (for group messages, if supported by endpoint) * - type: string - Message transport/type. Ex: "im" (Instant Message). Other values per server doc. * - message: string - Message body text. * - subject: string - Optional subject/title. * - urgency: string - Optional urgency level if supported (e.g., "standard", "urgent"). * - mentions: Array - Optional list of mention targets (e.g., by userId or jid_im). * - attachments: Array - Optional attachments metadata (e.g., fileId, url, name, size, mimeType) if supported. * - options: object - Optional flags and options provided by server (e.g., disablePush, noStore, translate, lang, replyTo, etc.). * * Notes: * - This is only a convenience summary. Always refer to the official API documentation linked above for the exhaustive, authoritative list of fields, constraints, and examples. * - The SDK forwards the payload as-is to the REST API. * * @return {Promise} - resolves with server response */ sendMessageNotification(data: any): Promise; } export { ImsService };