XUND
API ReferenceChatbot

Answer the last asked question

POST/v1/chatbot/answer

The chatbot is built mainly on a question–answer flow. This endpoint answers the last asked question.

QuestionType-related behavior

  • TEXT — the question is expected not to have options. Send the answer value, or skip the question (if it is skippable), and the check moves on to the next question without any additional action.
  • SINGLE_SELECT — the question is expected to have options. Send the id of the selected option, or a skip answer (if the question is skippable), and the check moves on to the next question.
  • INFO — the question is expected not to have options. The check moves on only if a skip answer is sent to this endpoint.
  • EXTENDING — the question is expected to have options. If the patient selected an option, send the id of the selected option, then request the question again: its option list will be expanded with new items. Patients can keep selecting new options as long as they want; the question must be requested again after each selection. Finish the selection loop by sending a skip answer — required for the check flow to move on.
  • FUNCTION — this endpoint cannot be used for FUNCTION-type questions. For an OVERVIEW function, fetch and then confirm the overview; for a report function, fetch the report, which ends the check.

Authorization

BearerToken
AuthorizationBearer <token>

Authenticate with a JWT bearer token obtained from the token endpoint with your Client Id and API key.

In: header

Header Parameters

check-id*string

The ongoing check's identifier.

Request Body

application/json

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

curl -X POST "https://example.com/v1/chatbot/answer" \  -H "authorization: Bearer <token>" \  -H "check-id: 5e93d7a1-f240-43b5-8937-33419ea9cb6a" \  -H "Content-Type: application/json" \  -d '{    "questionId": "6bcd3297-3c66-47c2-af3e-1fc8688be628",    "answer": {      "value": "1980"    }  }'
{  "checkStatus": "IN_PROGRESS"}

Last updated on