Class: IncomingEngagementRequest

Property Summary

(number) timeout

The amount of time in milliseconds the Visitor has to either accept or decline this engagement request. If the Visitor fails to respond in time the engagementPromise will be rejected with a TIMEOUT cause.

(Promise) engagementPromise

Fulfilled with Engagement

If the request is successful and the engagement is properly established then this promise will be fulfilled with the resulting Engagement.

Rejected with Error

If the request is unsuccessful for any reason then this promise will be rejected with an Error. The Error may have one of the following causes:

  • DECLINE - When the request is declined by the Visitor
  • CANCEL - When the request is canceled by the Operator
  • TIMEOUT - When the Visitor has failed to respond to the request in time
  • INTERNAL_ERROR
  • NETWORK_TIMEOUT

(string) message

A message from the Operator included in this request

(Operator) operator

The Operator who initiated the request.

(Object) logo

A logo included in this request. Provided to be displayed to the Visitor during the request. The object has the following fields:

  • url - The URL to the image

Class Method Summary

Instance Method Summary

Class Method Details

. (void) create({api, id, operator, restrictedOperator, message, logoUrl, platform, timeout, statsClient, cobraObservable, channelObservable, engagementApi, connectionStatusObservable, requestHeaders, internalVisitorStateObservable, volatileNotifications, statusObservable, pubsub, wsProxy})

Instance Method Details

# (Promise) accept()

Accepts this incoming engagement request.

After the request has been accepted, the timeout will be ignored and selectMedia can be called without any time pressure.

Returns:

  • ( Promise ) — Fulfilled with an empty object or rejected with an Error if the process fails for any reason. The Error may have one of the following causes: INTERNAL_ERROR, NETWORK_TIMEOUT, CONFLICT.

# (Promise) decline()

Declines this incoming engagement request.

Returns:

  • ( Promise ) — Fulfilled with an empty object or rejected with an Error if the process fails for any reason. The Error may have one of the following causes: INTERNAL_ERROR, NETWORK_TIMEOUT.

# (Promise) selectMedia(media, options)

After the incoming engagement request has been accepted, this method must be used to specify the Visitor's media selection.

Parameters:

  • media ( string ) The media to use for this engagement. Must be one of the following: 'text', 'phone', 'audio', 'video'.
  • options ( Object )

Options Hash: (options):

  • phoneNumber ( ?string ) The Visitor's phone number in E.164 format to use when media to upgrade to is 'phone'.

Returns:

  • ( Promise ) — Fulfilled with an empty object or rejected with an Error if the process fails for any reason. The Error may have one of the following causes: INVALID_INPUT, INTERNAL_ERROR, NOT_SUPPORTED, NETWORK_TIMEOUT.

    Quickly fuzzy find classes, mixins, methods, file:

    Control the navigation frame:

    You can focus and blur the search input: