Unsubscribe to an event

Updated 

sprChat('unsubscribeToUpdate')

This API can be used if we don’t want to listen particular type of events from live chat widget that have already been subscribed.
Parameters:

(every parameter is optional unless marked *):

Name

Typescript type

Description

Default Value

topic*

string

Update that was previously subscribed to. 

-

subscriber*

(params: {

    request: StringAnyMap;

    response: {

      data: StringAnyMap;

      error: StringAnyMap;

    };

}) => void;

Pass the same subscriber fn which we want to unsubscribe(reference needs to be the same).

-


Examples 

unsubscribe to live chat’s availability event 

window.sprChat('unsubscribeToUpdate', {
    topic:
'availabilityChanged',
    subscriber: onAvailabilityChange,
// pass the same subscriber fn to unsubscribe
});


unsubscribe to notification count of all the conversation

window.sprChat('unsubscribeToUpdate', {
    topic:
'unreadCountChanged',
    subscriber: onUnreadCountChanged,
// pass the same subscriber fn to unsubscribe
});

unsubscribe to externalEvent trigged by bot/rule flow

window.sprChat('unsubscribeToUpdate', {
    topic:
'externalEventTriggered',
    subscriber: onExternalEvent,
// pass the same subscriber fn to unsubscribe
});

unsubscribe to live chat is load successfully or not

window.sprChat('unsubscribeToUpdate', {
    topic:
'loadCompleted',
    subscriber: onLoadCompleted,
// pass the same subscriber fn to unsubscribe
});


unsubscribe to different analytics events of live chat

window.sprChat('unsubscribeToUpdate', {
    topic:
'eventTriggered',
    subscriber: onEventTriggered,
// pass the same subscriber fn to unsubscribe
});


unsubscribe to see open new conversation is created or not 

window.sprChat('unsubscribeToUpdate', {
    topic:
'openNewConversation',
    subscriber: onNewConversation,
// pass the same subscriber fn to unsubscribe
});


unsubscribe to send external event 

window.sprChat('unsubscribeToUpdate', {
    topic:
'sendExternalEvent',
    subscriber: onSendExternalEvent,
// pass the same subscriber fn to unsubscribe
});