Configure Context Information for Your Website
The Live Experience widget lets you define a variety of context information that's relayed to the Associate Desktop and displayed to an associate when in a call.
To configure a particular piece of context information, you use the
contextAttributes
set method, and specify a key indicating the
name of the context attribute to set and a value indicating the value of that
context attribute.
Key | Value Example | Notes |
---|---|---|
appLocation |
"Support Tab" |
The appLocation value should match the name of a value configured for Application Location in the Admin Console. For information on configuring an Application Location on an engagement scenario, see Manage Engagement Scenarios. |
|
"bob@example.com" | Retrieved from your application's UI. |
fullName |
"Bob Dobbs" | Retrieved from your application's UI. |
location |
"Scottsdale, AZ" |
Retrieved via the device's location API. |
phone |
"415-555-1212" | Retrieved from your application's UI. |
You can define additional context attributes using the Live Experience Admin Console. See Configure Oracle Live Experience to Send and Receive SMS Messages.
<script type="text/javascript">
require(["oracle.live.api"], function(liveApi) {
const getAuthToken = (callback) => {
fetch(new Request("/my_server_path/auth.cgi"))
.then(response => { return response.json(); })
.then(auth => { callback(auth.access_token, auth.expires_in); });
};
getAuthToken((myAuthToken, myTokenExpiry) => {
liveApi.controller.service.userID = "bob@example.com";
liveApi.controller.service.tenantID = "MyTenant";
liveApi.controller.service.authToken = myAuthToken;
liveApi.controller.service.authRefresh(myTokenExpiry, () => {
app.getAuthToken((jwt) => {
liveApi.controller.service.authToken = jwt; });
});
// Optional context attributes...
liveApi.controller.contextAttributes.set("email", "customer@example.com");
liveApi.controller.contextAttributes.set("fullName", "Bob Dobbs");
liveApi.controller.contextAttributes.set("phone", "415-555-1212");
liveApi.controller.contextAttributes.set("appLocation", "Scenario Name");
});
});
</script>
The example above sets context information for a user's name, email address, and phone number, which are displayed to associates when calls come into the Associate Desktop. The example also sets the location on the web page from where the call originates.
For more information about context configuration, see the Live Experience JavaScript API Reference.
What to do next
Next, Add the Live Experience Widget to your Web Page.