Retrieve the Bot’s Response

The BotResponse object provides methods to retrieve the HTTP status code, response HTTP header parameters and response envelope from the bot’s message.

Here is an example of a response body from the bot in JSON format. You can find the API response body schema in our Reference for API v5. This example messages array has messages with the text type and choices type. These types correspond to the TextResponseMessage and ChoicesResponseMessage schemas in the API reference.

The SDK automatically deserializes the JSON body into Java classes. This sample code demonstrates how to extract the bot’s message to the customer from the response body. Not all possible response body schemas and fields are included here.

Here’s the extracted bot’s message to the customer in text format.