Constructor
new Client(el, auth, optionsopt)
Example
const client = new forsta.messenger.Client(document.querySelector('#myDivId'),
{orgEphemeralToken: 'secret'});
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
el |
Element | Element where the messenger should be loaded. https://developer.mozilla.org/en-US/docs/Web/API/Element |
|
auth |
ClientAuth | Auth configuration for Forsta user account. |
|
options |
ClientOptions |
<optional> |
Fires:
Methods
addEventListener(event, callback)
Add an event listener.
Parameters:
Name | Type | Description |
---|---|---|
event |
string | Name of the event to listen to. |
callback |
function | Callback function to invoke. |
(async) navPanelToggle(collapseopt)
Expand or collapse the navigation panel.
Parameters:
Name | Type | Attributes | Description |
---|---|---|---|
collapse |
bool |
<optional> |
Force the desired collapse state. |
removeEventListener(event, callback)
Remove an event listener.
Parameters:
Name | Type | Description |
---|---|---|
event |
string | Name of the event to stop listening to. |
callback |
function | Callback function used with |
(async) threadGetAttribute(id, attr) → {*}
Get the value of a thread attribute.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The thread ID to update. |
attr |
string | The thread attribute to get. |
Returns:
- The value of the thread attribute.
- Type
- *
(async) threadList() → {Array.<string>}
List threads known to this client.
Returns:
- List of thread IDs.
- Type
- Array.<string>
(async) threadListAttributes(id) → {Array.<string>}
List the attributes of a thread.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The thread ID to update. |
Returns:
- List of thread attibutes.
- Type
- Array.<string>
(async) threadOpen(id)
Open a thread by its ID
.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The thread ID to open. |
(async) threadSetAttribute(id, attr, value)
Set the value of a thread attribute.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The thread ID to update. |
attr |
string | The thread attribute to update. |
value |
* | The value to set. |
(async) threadSetExpiration(id, expiration)
Set the expiration time for messages in a thread. When this value is set to a non-zero
value, messages will expire from the thread after they are read. Set this value to 0
to disable the expiration behavior.
Parameters:
Name | Type | Description |
---|---|---|
id |
string | The thread ID to update. |
expiration |
number | Expiration time in seconds. The expiration timer starts when the message is read by the recipient. |
(async) threadStartWithExpression(expression) → {string}
Select or create a conversation thread. If the tag expression
argument matches an
existing thread it will be opened, otherwise a new thread will be created.
Parameters:
Name | Type | Description |
---|---|---|
expression |
string | The |
Returns:
The threadId that was opened.
- Type
- string