Query responses for commerce services contain a set of information to support intent-specific actions by clients. The general structure of a Commerce Context is
keywords is a list of words uttered by your User. These should typically be used to populate a free-form text search field.
attributes are a set of key/value pairs identified in the query your User uttered. Each entry is the name of a service-specific attribute and its corresponding value(s). Clients must support attribute values being either single-valued or an array of values. The attributes that are supported in this section are specific to your integration with Voysis.
price is an optional object that indicates a price restriction uttered by your User. Clients should support both a missing "price", or an empty price object being returned.
Where type is exact, lessThan, greaterThan or approx, an integer "value" will be present indicating the price that the User requested. An example phrase might be "I'm looking for sneakers for less than 100 dollars."
Where type is range, both the from and to properties will be present, representing the integer values of the requested range. An example phrase might be "I'm looking for sneakers between 70 and 150 dollars."
sortBy is an enumerated value indicating how the User would like results to be sorted.
new indicates that newest products should be sorted to the top of the results.
popular indicates most popular products should be sorted to the top of the results.
priceLowToHigh indicates the results should be sorted with the lowest priced products at the top, in increasting order of cost.
priceHighToLow indicates the results should be sorted with the highest prices products at the top, in decreasing order of cost.
rating indicates the results should be sorted with the highest rates products at the top.
sale indicates that products that are on sale should be sorted to the top of the results.
Commerce Entities
Usually the information about the products the user requested are specified in the context field. The exception is when the user intent is addToCart. This is because the user can utter this request from any context and will expect to get back to this context after the items requested are added to their cart. For example, a user may ask for oranges and apples to be added to their cart from the shoes section of your app/website. The context has to be returned to shoes after the oranges and apples are added to the cart so the user may continue shopping for shoes if they still want to.
The user is sorting, narrowing down or expanding their search by adding more product details. Refinement only happens after the user has already requested a particular product.
Previous query: "Show me handbags".
Refinement query: "Show me red ones".
Contradiction query: "Actually, show me black ones".
Refinement works by using the Commerce Context that was submitted along with the refinement audio query and generating a new context for use by the client. As such, it is important for client implementations to copy the context from the previous query into the submitted query's context property. An example refinement response:
The user wants to put one or more products in their shopping cart.
The user can also add an item that he/she is currently looking at (needs to be on the item's page)
The user asks the system about its capabilities and example commands.
What can you do?
{
"id": "afd65453-8995-4773-b9aa-6830d06af6ab",
"locale": "en-US",
"conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
"queryType": "audio",
"textQuery": {
"text": "what can you do"
},
"audioQuery": {
"mimeType": "audio/wav"
},
"context": {},
"intent": "help",
"reply": {
"text": "Here are some example things you can ask: Product Search: 'Show me some ...', 'I am looking for ...' Sorting: 'I want the cheapest ...', 'What are the most popular ... ' Add to cart: 'Add this to my cart' Order Status: 'What is the status of my order', 'Where's the stuff I ordered' Transact: 'I want to pay now', 'What's in my cart', 'Take me to checkout'"
},
"entities": {},
"_links": {
"self": {
"href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
},
"audio": {
"href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
}
}
}
Reset
Intent Value
Meaning
User query (example)
reset
The user asks the system to forget everything they have said so far and remove any items they have added to their shopping cart.
Mark that this is client implementation.
The user and/or the system intentionally makes their presence known to each other or to show attention. People usually take this action to start their conversations with each other.
Any user or system intent that is not in the list of intents described here.
This is something that is meaningful but our system doesn't handle it yet.
Can you tell me why this product isn't on sale?
{
"id": "afd65453-8995-4773-b9aa-6830d06af6ab",
"locale": "en-US",
"conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
"queryType": "audio",
"textQuery": {
"text": "can you tell me why this product isn't on sale"
},
"audioQuery": {
"mimeType": "audio/wav"
},
"context": {},
"intent": "unknown",
"reply": {
"text": "Sorry, I don't know how to do this yet"
},
"entities": {},
"_links": {
"self": {
"href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
},
"audio": {
"href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
}
}
}