PresenceApi

PresenceApi

new PresenceApi()

Presence API contains methods and event to track presence changes and update agent presence.

Methods

getChannels() → {Promise}

Retrieves list of all available channels.

presenceApi.getChannels()
  .then(channels => {
    console.debug('Presence API got channels: ' + JSON.stringify(channels));
  });
Returns:
Type:
Promise

Promise object represents Channel[] In case of error Promise is rejected and PresenceApiErrorStatus is returned.

getNotReadyCodes() → {Promise}

Retrieves list of all not ready codes.

presenceApi.getNotReadyCodes()
  .then(codes => {
    console.debug('Presence API got not ready reason codes: ' + JSON.stringify(codes));
  });
Returns:
Type:
Promise

Promise object represents NotReadyCode[] In case of error Promise is rejected and PresenceApiErrorStatus is returned.

getPresence() → {Promise}

Retrieves the current agent presence

presenceApi.getPresence()
  .then(presence => {
    console.debug('Presence API got presence: ' + JSON.stringify(presence));
  });
Returns:
Type:
Promise

Promise object represents Presence In case of error Promise is rejected and PresenceApiErrorStatus is returned.

setChannels(params) → {Promise}

Sets new channels

presenceApi.setChannels({
    channelIds: ["CALL", "VOICE_MAIL"]
});
Parameters:
Name Type Description
params object
Name Type Description
channelIds string

New channel Ids

Returns:
Type:
Promise

Promise is resolved if Five9 REST API call succeeded. In case of error Promise is rejected and PresenceApiErrorStatus is returned.

setDefaultNotReadyCode() → {Promise}

Set current status to default not ready reason code.

presenceApi.setDefaultNotReadyCode();
Returns:
Type:
Promise

Promise is resolved if Five9 REST API call succeeded.

setNotReadyCode(params) → {Promise}

Sets a new Not Ready Code

presenceApi.setNotReadyCode({
    notReadyCodeId: "123"
});
Parameters:
Name Type Description
params object
Name Type Description
notReadyCodeId string

Not Ready Code ID

Returns:
Type:
Promise

Promise is resolved if Five9 REST API call succeeded. In case of error Promise is rejected and PresenceApiErrorStatus is returned.

subscribe(apiEvents) → {void}

Subscribes to Presence Api events.

const presenceApi = window.Five9.CrmSdk.presenceApi();
presenceApi.subscribe({
    presenceChanged: (params) => {}
});
Parameters:
Name Type Description
apiEvents PresenceApiEvents

Callbacks corresponding to the events will be called on object passed as parameter

Returns:
Type:
void