Contexts
Descriptions of the standard supported contexts for the Kustomer Cards SDK.
Supported contexts for cards
When creating a card, you can specify what data model context the card needs to display. The standard data model contexts are the following:
customer
A customer represents a contact within an organization. Every customer has a unique profile that an agent can view in the workspace. The customer profile features a chronological view of all of the objects directly related to the customer, such as conversations, billing information, and customer ratings. Explore the Kustomer API for more information on the Customers resource.
conversation
A conversation represents a set of interactions with a customer about a specific topic. Conversations can span multiple channels and include a set of messages and internal notes. Explore the Kustomer API for more information on the Conversations resource.
company
Customers can be linked to companies. Explore the Kustomer API for more information on the Companies resource.
app
An app represents the given app that configured and is associated with the current Klass View (or KView). The app context is only valid for the settings page on apps that define a custom iFrame-based settings page.
widget
A widget widget is an iFrame-formatted UI element that lets you easily display content that can be accessed throughout Kustomer. The context data for a widget also includes whether a user has the widget currently opened, allowing your widget to react to when a user opens or closes the widget.
For example, if you want to show a confirmation screen when a user closes a widget:
Kustomer.on('context', (context) => {
const isWidgetOpen = context.widget.isOpen;
if(!isWidgetOpen) {
if(/* we need to show confirmation screen */)
Kustomer.open(); // re-opens widget
// Add logic here to show confirmation screen in your widget
}
}
})
kobject.[yourObjectName]
KObjects are custom objects that organizations can create to extend the base data model of the Kustomer platform. As a result, organizations can store information specific to their business and link that data to customer records through any other standard or custom object. Examples of KObjects include tracking numbers for shipped orders and reservation numbers for a hotel booking.
custom
In addition to standard contexts such as Customer and Conversation, we also support custom contexts when you create a KView. For example, if your KView renders an iFrame-based card, you can define your own context as in the following code:
<DynamicCard
title={'My iFrame KView'}
src={'https://www.example.com/kustomer/kview/index.html'}
context={{
type: 'myCustomContext',
customContext: {
firstName: 'John',
lastName: 'Smith',
isEmployee: false,
eyeColor: 'brown',
}
}}
/>
Updated over 1 year ago