Plugin Context

The entry function of the plugin always receives a context object which contains essential information like phone number, user id, etc.

The context object always (in case of every event) contains the following properties:

Name

Type

Notes

Name

Type

Notes

eventId

string

Name of event being handled.

A few example values (including but not limited to):

  • call-incoming

  • call-ended

  • onclicktoact

callStarted

boolean

true if the call has engaged (call was answered)

callInProgress

boolean

true if a call is about to start:

  • Inbound call is ringing

  • User is dialing an outbound call

Is changed to false when call ends, regardless of call result (answered or unanswered)

customer

object

If a customer was picked by phone number (either automatically or manually by the agent) then it contains the details of that. The object has the following properties:

  • logicalName: entity name (account or contact)

  • id: primary key

  • name: display name

The property can also be set by a plugin. As a result, the value set to the property will be used as the context of the current call.

direction

int

  • 0: inbound

  • 1: outbound

userId

string

Enreach Cloud user id of agent

crmUserId

string

CRM user id of agent

phoneNumber

string

Phone number the call is engaged to

isDirty

boolean

True if the currently displayed form is dirty

callInitiatedFrom

object

Object reference of entity where the call was initiated from, in case of Click-to-dial event. The object has the following properties:

  • logicalName: entity name (account or contact)

  • id: primary key of entity

  • name: display name

  • fieldName: the field where the user clicked the phone icon

  • format: data format

customerSearchResults

object

An object storing account and contact search results by phone number. Can be used to customize multiple matches grid. For additional information, see the relevant page.

eventData object

The value of context.eventData object depends on the use case. For call-related cases, the object sent by WebRTC is passed here, containing all kind of call information.

Exceptions:

  • beforeCreateInboundCallSession event: besides call information, two additional piece of data is stored here:

    • context.eventData.sessionParameters: Session parameters of the CIF2 session which is being opened. By hooking up a plugin and amending this parameter, any custom session template can be used.

    • context.eventData.sessionTemplateId: By default it contains the id of the configured session template to be used. A custom plugin can update it before opening the session, so default session template can be overridden on the fly.

 

© Enreach, Mannerheimintie 117, 00280 Helsinki, Finland
+358 40 450 3000, www.enreach.fi