Best practices

Take advantage of these techniques for debugging a bot:

  • Use the Bot Logs panel: Use this during development. It’s helpful for checking the data received from API calls, conditioning, and other data that can be helpful during the debug process.
  • Log custom events: Incorporate the logging of custom events into the bot design to capture data that will be helpful for future fixes. We recommend you log custom events for all errors, for example, those encountered in integrations, agent transfers, custom logic, and data validation. You might also log the statuses of API calls, the data in API payloads, and more.
  • Use the Conversation Tester: Use this after the bot is deployed to test the end-to-end flow.

Each of these techniques is further described below.

Use Bot Logs during bot development

The Bot Logs panel can display the log of the conversation in the Preview window or the log of a conversation in a supported channel for 30 minutes after the last message in the conversation. This makes it a useful tool in a few ways.

  • If you're encountering unexpected behavior, always check the Bot Logs panel. Errors and failures are displayed in red, so you'll know at a glance if and where they occurred.
  • Because a log provides a more technical view of the underlying process flow that occurred during the conversation, it can deepen your understanding of how that processing works and support research. For example, you can use the log to identify the patterns or intents that were matched in the conversation.

Here's a visual overview of the Bot Logs window:

Bot Logs window with various features highlighted

  • 1 = Use the User ID input box to specify the log you want to view.

    To get the User ID during a bot conversation, type "display userid".

  • 2 = Display or refresh the logs.
  • 3 = Search the logs for a term or string.
  • 4 = Is there too much output for your liking? Filter the types of info that you see.
  • 5 = Clear the logs.

Errors and failures are displayed in red, so you can spot them quickly.

Access the Bot Logs panel

  1. With the Dialogs page displayed, click Preview in the upper-right corner.
  2. Just outside the lower-left corner of the Preview window, click the Bot Logs icon.

    The Bot Logs icon that's just outside the lower-left corner of the Preview window

    This opens the Bot Logs panel, so it is displayed beside the Preview window.

    For ease of use during bot development, by default, the user ID for the consumer in the conversation in the Preview window is entered in the User Id input box, and the associated logs are automatically displayed.

Log custom events in the bot

Incorporate the logging of custom events into the bot design to capture data that will be helpful for future fixes. Examples include:

  • botContext.logCustomEvent(interaction, “Caught Errors”, error);
  • botContext.logCustomEvent(interaction, “LogPreApi”, payload);
  • botContext.logCustomEvent(interaction, “LogPostApi”, payload);
  • botContext.logCustomEvent(interaction, “ApiRequestFail”, error);
  • botContext.logCustomEvent(botContext.getCurrentUserMessage(), “KnowledgeBase”, articleTitle);
  • botContext.logCustomEvent(botContext.getCurrentUserMessage(), ‘UserJourney’, question);

For more info, see the details on the logCustomEvent scripting function. Also see our example guide.

Use the Conversation Tester after deployment

Use the Conversation Tester after the bot is deployed to test the end-to-end flow. Learn more.

To aid in debugging, you can use the printDebugMessage scripting function in the code areas of an interaction to print messages — for example, the consumer's most recent message — to the Bot Logs window.

Events glossary

Max limit on daisy chaining of interactions: 10

This error is:

BREAKING THE INTERACTION FLOW. Reached max limit on daisy chaining of interactions: 10

This error occurs when you have linked together 10 or more, consecutive Statement and/or Integration interactions within a single dialog. In other words, within those interactions, there are no Question interactions that stop the flow to ask for user input.

When the limit of 10 is reached, the interaction flow is stopped.

The limit of 10 is designed to prevent infinite loops and other potential error conditions.

Iteration count exceeded 5

This error is:

Breaking the interaction flow because iteration count exceeded 5

This error occurs when you have linked together 5 or more, consecutive Statement and/or Integration interactions across multiple dialogs. In other words, within those interactions, there are no Question interactions that stop the flow to ask for user input.

When the limit of 5 is reached, the interaction flow is stopped.

The limit of 5 is designed to prevent infinite loops and other potential error conditions.

FAQs

Is sensitive info (PII and PCI data) masked in bot logs?

Yes, it is.

How long are bot logs available?

Bot logs are available for 30 minutes after the last message in the conversation. This is the case both during preview in bot development and in a conversation on any channel. This TTL for bot logs isn't related to the bot's session length, and the value isn't configurable.

Can I specify a conversation ID to display the bot logs for it?

No, not at this time.

Tips

Is the space for Bot Logs feeling too small? Expand it:

Expanding the Bot Logs window to near full screen

Is the output too verbose and long? Don't forget the filters are there:

The list of filters available in Bot Logs