Client

forsta.messenger. Client

The Forsta messenger client class.

Constructor

new Client(el, auth, optionsopt)

Source:
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)

Source:

Add an event listener.

Parameters:
Name Type Description
event string

Name of the event to listen to.

callback function

Callback function to invoke.

Source:

Expand or collapse the navigation panel.

Parameters:
Name Type Attributes Description
collapse bool <optional>

Force the desired collapse state.

removeEventListener(event, callback)

Source:

Remove an event listener.

Parameters:
Name Type Description
event string

Name of the event to stop listening to.

callback function

Callback function used with addEventListener.

(async) threadGetAttribute(id, attr) → {*}

Source:

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>}

Source:

List threads known to this client.

Returns:
  • List of thread IDs.
Type
Array.<string>

(async) threadListAttributes(id) → {Array.<string>}

Source:

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)

Source:

Open a thread by its ID.

Parameters:
Name Type Description
id string

The thread ID to open.

(async) threadSetAttribute(id, attr, value)

Source:

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)

Source:

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}

Source:

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 TagExpression for the desired thread's distribution.

Returns:

The threadId that was opened.

Type
string