Skip to main content

Ask the bot instance a question

Available since MicroStrategy ONE (March 2024)

caution

This API is planned for future retirement. Therefore, MicroStrategy recommends that you transition to the Ask Question to Bots in the Application API for bot-related workflows.

Using Ask Question to Bots in the Application API:

  • Bot instances are managed automatically, eliminating the need for manual instance management.
  • The API automatically selects the most appropriate bot to answer a question, or you can specify a specific bot by including its ID in the query parameters.
  • It offers ongoing support and updates, ensuring compatibility with new bot-related features.

This workflow sample demonstrates how to ask the bot instance a question.

info

Obtain the authorization token needed to execute the request using POST /api/auth/login.

Ask the bot instance a question

Endpoint: POST /api/bots/{botId}/instances/{instanceId}/questions

note

Replace {botId} in POST /api/bots/{botId}/instances/{instanceId}/questions with the chatbot ID and {instanceId} with your bot instance ID created with POST /api/bots/{botId}/instances in your environment.

Sample Request Body:

{
"text": "What is the average revenue for year 2023"
}

Sample Curl:

curl 'https://demo.microstrategy.com/MicroStrategyLibrary/api/bots/6C6D314E4C881C01BFD79084DD5B2D42/instances/5B1EB48585F04384A97F3D831D7C7416/questions' \
-X 'POST' \
--header 'X-MSTR-AuthToken: t40ltbk411923ipk85r8r0tace' \
--header 'X-MSTR-ProjectID: FCC1924411EAABC39C6C0080EFA54501' \
--header 'Prefer: respond-async' \
--header 'Content-Type: application/json' \
--data '{
"text": "What is the average revenue for year 2023"
}'

Sample Response:

Response CodeStatus
201Successfully accept the bot question
400Error in accepting the bot question
401Authorization failed
404Bot or bot instance does not exist

Sample Response Body on success:

{
"id": "5B1EB48585F04384A97F3D831D7C7416"
}