Inbound Event API

Follow

Inbound Event API
The Inbound Event API allows you to extend your web presence to capture events initiated by your customers and send them into ENGAGEcx.  The API provides the following methods:

Method Description
ENGAGEcxEpe.init() Used to request the ENGAGEcx chat popup to appear on the web page
ENGAGEcxEpe.sendEvent() Used to send events to the ENGAGEcx Event Processing Engine.

 
The Inbound Event API relies on jQuery, JSChannel and Promises external frameworks. References to these libraries are included in the javascript code snippet generated for the ENGAGEcx channel that the interactions are intended to use.  Copy the entire snippet into your web page header.  


ENGAGEcxEpe.init
This function is used to initialize the ENGAGE.cx Inbound Event API. The init function must be called before attempting to use other functions in the Inbound Event API.

The init function does not accept any parameters

The init function does return a promise, which is resolved when the ENGAGE.cx Inbound Event API initialization process is complete.

Example

ENGAGEcxEpe.init()
  .then(function()
  {
    ENGAGEcxEpe.sendEvent(...);
  }


ENGAGEcxEpe.sendEvent
This function is used to send events using the ENGAGE.cx Inbound Event API. The init function must be called before attempting to call sendEvent.

The sendEvent function takes a single object parameter, which is described below.

{
  // The auth block is a JSON web token
  "auth":
  {
    // Type can be "trustedClientJwt" or "untrustedClientJwt"
    "type": "trustedClientJwt",
// Token must be valid and generated for your access profile id "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJhc2RmIiwiaWF0IjoiMTQzODExNjQzNCIsInRlbmFudElkIjoic2FtcGxlIn0.yTBBMON1q38jlXqJHqAra8q4RZ0kv7DvomWzj_N1t7w"
}, // Access Profile ID values are managed from the // ENGAGE.cx Customer Administration Portal in the // Organization Settings - Integration section "accessProfileId": "12345678-abcd-4321-1234-1234567890abcd", // Entry Point ID values are managed from the // ENGAGE.cx Customer Administration Portal in the // Organization Settings - Integration section "entryPointId": "abcdabcd-1234-abcd-4321-abcd1234567890", "engagementMedium": "none" // See details below // Additional custom and standard fields are placed here }


Engagement Media
The engagementMedium parameter is used to instruct the ENGAGE.cx Event Processing Engine on how to handle the submitted event.

"engagementMedium": "none"

This engagement medium is used to process actions through the ENGAGE.cx Event Processing Engine. Actions are not routed to associates and are immediately closed and sent to the analytic data store.

Other values for engagementMedium are not supported by the current release of the ENGAGE.cx Event Processing Engine.


Designating Signed Fields
For additional security, you can include fields and field values in the signed portion of the JSON Web Token. These properties must be included in the contentClaims section of the JWT payload part. The signature will be validated by ENGAGE.cx prior to any further processing, preventing modification to any signed fields.

You must set auth.type to "untrustedClientJwt" to enable signed field validation.

// Example JSON Web Token header and payload part.
// Note that this block is used to calculate the token
// value and is not included in the sendEvent API call.

// JWT Header Part
{
  "alg": "HS256",
  "typ": "JWT"
}

//JWT Payload Part 
{
  "iss": "12345678-abcd-4321-1234-1234567890abcd",
  "iat": "1438118387",
  "tenantId": "sample",
  "contentClaims":
  {
    "URL": "http://www.engage.cx"
  }
}


Example: Web Page View Action

 <script src="https://code.jquery.com/jquery-2.1.3.min.js" type="text/javascript"></script>
<script src="https://hq.engage.cx/client/browser/engagecx-epe.js" type="text/javascript"></script>
<script type="text/javascript">
function sendPageViewEvent()
{
ENGAGEcxEpe.init()
.then(function ()
{
ENGAGEcxEpe.sendEvent(
{
"auth":
{
"type": "trustedClientJwt",
"token": "[valid-token-value]"
},
"accessProfileId": "[valid-access-profile-id]",
"entryPointId": "[valid-channel-id]",
"engagementMedium": "none",
"URL": "http://www.engage.cx",
"EVENT_CATEGORY_NAME": "Browsed Website",
"PAGE_TITLE": "ENGAGE.cx Relationship Cloud"
})
.then(function (resp)
{
//Optional: process successful response
processResponse(resp);
}, function (err)
{
//Optional: process error response
processError(err);
});
});
}
</script>
Have more questions? Submit a request

Comments

Powered by Zendesk