Debugging Bot Behavior in Production
Overview
There are a few different ways to debug your bot's behavior in production:
Using the Conversations Tab (Simple)
The Conversations tab allows you to view the conversation history of your bot which is great for identifying problems. Check out this page to learn more.
Using Logs (Advanced)
If your bot is live and already has users it's recommended to duplicate the bot to debug its behavior. This will allow you to safely test and debug without affecting your live bot. To do this:
- Export your bot by clicking the Botpress icon.
- Select "Export" and save the exported file.
- Go to app.botpress.cloud and log in or create an account.
- Create a new bot within the platform.
- Click the Botpress icon and select "Import from file".
- Select the exported file and wait for the import.
Using Text as Breakpoints in a Conversation
You can add Text Cards at different stages of the conversation to isolate problems:
- Insert Text Cards in various parts of the conversation.
- Deploy the bot to production and engage with it.
- Observe where the conversation deviates from the expected behavior using the text cards as indicators.
Using console.log
in Logs
console.log
in LogsFor more detailed debugging, utilize console.log
statements in the logs:
- Add Execute Code cards containing
console.log('message')
statements. - Replace
'message'
with relevant information or variables likeworkflow.userName
. - Deploy the bot to production and trigger conversations.
- Check the Logs tab to analyze the flow of the conversation and gather more information about the bot's behavior.
Updated 2 days ago