Commerce Services

Response structures specific to Commerce

Commerce Context and Entities

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": [
    "array", "of", "strings"
  ],
  "attributes": {
    "category": "sneakers",
    "color": ["red", "yellow"],
    "someAttribute": "someValue"
  },
  "price": {
    "type": "exact | lessThan | greaterThan | range | approx",
    "value": 100,
    "from": 10,
    "to": 100
  },
  "sortBy": "new | popular | priceLowToHigh | priceHighToLow | rating | sale"
}
  • 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 is 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 value the User requested. An example phrase might be "I'm looking for sneakers for less than 100 dollars."
    • Where type is "range", both "from" and "to" properties will be present, both 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.

Supported Intents

This section lists out the intents supported for Commerce services, and the values that clients can expect in the responses received to User queries.

New Search

Intent ValueMeaningExample Phrase
newSearchThe user is initiating a search request by specifying a particular product or giving a general description of what they are looking for.I am looking for orange juice

The response to a new search will contain a new Commerce Context indicating the details of the search the User has requested. An example response:

{
    "id": "86f4b80f-bffb-4953-bda8-5a9ac6b5a178",
    "locale": "en-US",
    "conversationId": "f14314d9-8982-4337-a2f5-bc0fef5cba1d",
    "queryType": "audio",
    "textQuery": {
        "text": "i'm looking for orange juice"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
        "keywords": [
            "orange",
          	"juice"
        ],
        "attributes": {
        },
        "price": {},
        "sortBy": ""
    },
    "intent": "newSearch",
    "reply": {
        "text": "Here's what I found"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/86f4b80f-bffb-4953-bda8-5a9ac6b5a178"
        },
        "audio": {
            "href": "/queries/86f4b80f-bffb-4953-bda8-5a9ac6b5a178/audio"
        }
    }
}

Refinement and Contradiction

Intent ValueMeaningExample Phrase
refinementThe user is sorting, narrowing down or expanding their search by adding more product details. Refinement only happens after the user has requested a particular product.Previous query: "Show me handbags"

Refinement query: "Show me red ones"

Contradiction: "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:

{
    "id": "796ffaa0-ade5-4fe2-9180-9b749ae291ac",
    "locale": "en-US",
    "conversationId": "dc8bc6ce-c1b6-4c6e-b848-1d61bbfd37cb",
    "queryType": "audio",
    "textQuery": {
        "text": "show me red ones"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
        "keywords": [
            "handbags"
        ],
      	"attributes": {
            "color": "red"
        },
        "price": {},
        "sortBy": ""
    },
    "intent": "refinement",
    "reply": {
        "text": "Here's what I found"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/796ffaa0-ade5-4fe2-9180-9b749ae291ac"
        },
        "audio": {
            "href": "/queries/796ffaa0-ade5-4fe2-9180-9b749ae291ac/audio"
        }
    }
}

Add to Cart

Intent ValueMeaningExample Phrase
addToCartThe 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)
Add this to my cart.

Add oranges and pizza to my cart.
{
    "id": "937a4901-d964-4ece-b8b8-055b15444529",
    "locale": "en-US",
    "conversationId": "b3f1659b-58e6-4291-864a-34aa0558e067",
    "queryType": "audio",
    "textQuery": {
        "text": "add this to my cart"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
    },
    "intent": "addToCart",
    "reply": {
        "text": "Adding to your cart"
    },
    "entities": {
        "products": [
            {
              	"keywords": [
                  	"oranges"
								],
              	"attributes": {},
              	"price": {},
              	"sortBy": ""
            },
            {
              	"keywords": [
                  	"pizza"
								],
              	"attributes": {},
              	"price": {},
              	"sortBy": ""
            }
        ]
    },
    "_links": {
        "self": {
            "href": "/queries/937a4901-d964-4ece-b8b8-055b15444529"
        },
        "audio": {
            "href": "/queries/937a4901-d964-4ece-b8b8-055b15444529/audio"
        }
    }
}

Go to Cart

Intent ValueMeaningExample Phrase
goToCartThe user wants to view the products they have selected for buying.What's in my cart?
{
    "id": "889cac8b-ba7a-4cf9-9450-558ed8434fb0",
    "locale": "en-US",
    "conversationId": "356e3b54-4747-4ec6-adfa-e47d36e31619",
    "queryType": "audio",
    "textQuery": {
        "text": "what's in my cart"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
    },
    "intent": "goToCart",
    "reply": {
        "text": "Here's what's in your cart"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/889cac8b-ba7a-4cf9-9450-558ed8434fb0"
        },
        "audio": {
            "href": "/queries/889cac8b-ba7a-4cf9-9450-558ed8434fb0/audio"
        }
    }
}

Remove from Cart

Intent ValueMeaningExample Phrase
removeFromCartThe user wants to remove one or more products from their shopping cart. The user can refer to the products they want to remove using their exact product names, product descriptions or product references.
Mark that this is a client implementation.
Could you remove oranges
{
    "id": "afd65453-8995-4773-b9aa-6830d06af6ab",
    "locale": "en-US",
    "conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
    "queryType": "audio",
    "textQuery": {
        "text": "could you remove oranges"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
      	"keywords": [
          	"oranges"
        ],
      	"attributes": {
        },
      	"price": {},
      	"sortBy": ""
    },
    "intent": "removeFromCart",
    "reply": {
        "text": "Removing item from your cart"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
        },
        "audio": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
        }
    }
}

Checkout

Intent ValueMeaningUser query (example)
checkoutGeneral intent meaning everything related to placing an order apart from payment.I want to checkout.
{
    "id": "afd65453-8995-4773-b9aa-6830d06af6ab",
    "locale": "en-US",
    "conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
    "queryType": "audio",
    "textQuery": {
        "text": "i want to checkout"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
    },
    "intent": "checkout",
    "reply": {
        "text": "Taking you to checkout"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
        },
        "audio": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
        }
    }
}

Pay

Intent ValueMeaningUser query (example)
payThe user wants to pay for the items in their shopping cart.I'd like to pay
{
    "id": "afd65453-8995-4773-b9aa-6830d06af6ab",
    "locale": "en-US",
    "conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
    "queryType": "audio",
    "textQuery": {
        "text": "i'd like to pay"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
    },
    "intent": "pay",
    "reply": {
        "text": "Taking you to payment page"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
        },
        "audio": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
        }
    }
}

Order Status

Intent ValueMeaningUser query (example)
orderStatusThe user asks about more information on their purchase and delivery.Has my order been shipped yet?
{
    "id": "afd65453-8995-4773-b9aa-6830d06af6ab",
    "locale": "en-US",
    "conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
    "queryType": "audio",
    "textQuery": {
        "text": "has my order been shipped yet"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
    },
    "intent": "orderStatus",
    "reply": {
        "text": "Checking your order"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
        },
        "audio": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
        }
    }
}

Go to Home

Intent ValueMeaningUser query (example)
goToHomeScreenThe user wants the system to display its home screen.Take me home
{
    "id": "afd65453-8995-4773-b9aa-6830d06af6ab",
    "locale": "en-US",
    "conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
    "queryType": "audio",
    "textQuery": {
        "text": "take me home"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
    },
    "intent": "goToHomeScreen",
    "reply": {
        "text": "Taking you home"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
        },
        "audio": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
        }
    }
}

Help

Intent ValueMeaningUser query (example)
helpThe 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 ValueMeaningUser query (example)
resetThe 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.
Cancel everything
{
    "id": "afd65453-8995-4773-b9aa-6830d06af6ab",
    "locale": "en-US",
    "conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
    "queryType": "audio",
    "textQuery": {
        "text": "cancel everything"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
    },
    "intent": "reset",
    "reply": {
        "text": "Resetting"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
        },
        "audio": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
        }
    }
}

Start Conversation

Intent ValueMeaningUser query (example)
startConversationThe 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.Hello
{
    "id": "afd65453-8995-4773-b9aa-6830d06af6ab",
    "locale": "en-US",
    "conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
    "queryType": "audio",
    "textQuery": {
        "text": "hello"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
    },
    "intent": "startConversation",
    "reply": {
        "text": "Hi"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
        },
        "audio": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
        }
    }
}

End Conversation

Intent ValueMeaningUser query (example)
endConversationThe user and/or the system leaves the conversation/shopping task.Good bye
{
    "id": "afd65453-8995-4773-b9aa-6830d06af6ab",
    "locale": "en-US",
    "conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
    "queryType": "audio",
    "textQuery": {
        "text": "goodbye"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
    },
    "intent": "endConversation",
    "reply": {
        "text": "See you soon"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
        },
        "audio": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
        }
    }
}

Jabber

Intent ValueMeaningUser query (example)
jabberThe user and/or the system produces a meaningless utterance (something that makes no sense to the system)I well, I don’t, hem, I mean...
{
    "id": "afd65453-8995-4773-b9aa-6830d06af6ab",
    "locale": "en-US",
    "conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
    "queryType": "audio",
    "textQuery": {
        "text": "I mean stop no"
    },
    "audioQuery": {
        "mimeType": "audio/wav"
    },
    "context": {
    },
    "intent": "jabber",
    "reply": {
        "text": "Sorry, I did not understand that"
    },
    "entities": {
    },
    "_links": {
        "self": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab"
        },
        "audio": {
            "href": "/queries/afd65453-8995-4773-b9aa-6830d06af6ab/audio"
        }
    }
}

Unknown

Intent ValueMeaningUser query (example)
unknownAny 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 compare these products?
{
    "id": "afd65453-8995-4773-b9aa-6830d06af6ab",
    "locale": "en-US",
    "conversationId": "6ecd6bb8-28b5-4771-879d-979cda880a44",
    "queryType": "audio",
    "textQuery": {
        "text": "can you tell me what this product is about"
    },
    "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"
        }
    }
}