Retrieve the questions to suggest about one product before the shopper has asked anything. This is the zero state of qna. Zero state is the term Constructor Autocomplete uses for what it shows before the shopper types: see Autocomplete examples.
The questions are the ones GET /v1/item_questions returns for the same request: questions curated in the dashboard, merged over the questions generated for the item ahead of time. Their order can differ between shoppers and between experiment arms. When the item has none, the index key's fallback questions are returned, if it has any. No question is generated during the request, and an unknown item_id is not an error.
The questions arrive as the options of one follow_up_refinement event. When there are none, the stream has no follow_up_refinement, and the JSON response has no follow_up_refinement field. On the stream, the start event's request carries zero_state: true, so it can be told apart from a qna answer.
To answer a question, send it unchanged as shopper_input to POST /v1/agent_insights/qna, with the same page_context, i, ui, features and feature_variants. A question can be answered from an answer stored for its exact text, so a changed string is answered live. Not every question has a stored answer, and some are always answered live.
parameters.num_questions sets the most questions to return. Without it, the number configured for the index key applies. The index key's question order can return fewer questions than either. page_context.item_id selects the product; page_context.variation_id and the other page_context fields are accepted but do not change the questions, which are kept per item.
Only key, c, ui, us, s, i, features and feature_variants change the result. The other agent insights query parameters are still validated, but have no effect here. A num_results query parameter, the count parameter of GET /v1/item_questions, is rejected with 400: send parameters.num_questions instead. The body takes no shopper_input and no request_context.
Migrating from GET /v1/item_questions
- Method:
GET /v1/item_questionssends everything in the query string;POST /v1/agent_insights/qna/zero_statesends a JSON body plus query parameters. - Response format:
GET /v1/item_questionsreturns JSON;POST /v1/agent_insights/qna/zero_statestreams SSE by default, or sendAccept: application/jsonfor one JSON document. - Item:
?item_id=and?variation_id=becomepage_context.item_idandpage_context.variation_id, plus the requiredpage_context.page_type. - Count:
?num_results=becomesparameters.num_questions. - Questions:
questions[].valuebecomesfollow_up_refinement.options. - No questions:
{"questions": []}becomes nofollow_up_refinement. - Errors:
GET /v1/item_questionsanswers an invalid request with422;POST /v1/agent_insights/qna/zero_stateanswers with400and anAgentInsightsErrorResponse.