How to use JSON in ChatbotBuilder 🤖📦✨
Welcome to our Community Video Spotlight featuring Diana Pinheiro, a talented co-creator from the Chatbot Builder AI (CBB) community.
In this detailed tutorial, Diana walks us through an efficient method to use JSON within ChatbotBuilder, specifically leveraging the bot's default reply prompt to collect and extract user data seamlessly.
Whether you're looking to gather user information for support requests or appointment bookings, this guide will empower you to build smarter, more interactive chatbots that handle data precisely and reliably.
Introduction to JSON in ChatbotBuilder
JSON (JavaScript Object Notation) is a lightweight data format that is widely used for storing and exchanging data.
In the context of chatbot development, JSON can be a powerful tool to structure and retrieve user inputs during conversations.
Diana’s approach centers on using JSON within ChatbotBuilder’s default reply prompt, which allows the bot to ask for specific pieces of information and organize them into structured data formats.
What makes this method stand out is the use of JSON flows combined with custom functions, which enables the chatbot to extract only the required fields from the conversation history and map them to Custom User Fields (CUFs).
This approach is both flexible and scalable, making it ideal for various applications such as customer support or appointment management.

Setting Up Your Bot for JSON Data Collection
Diana begins by creating a simple new bot without any pre-existing information.
The key step here is to modify the bot's settings to rely solely on the default reply prompt, which means unchecking the default agent.
This setup gives you full control over the conversation flow and the data collection logic.
Within the flows section, Diana edits the default reply prompt to include specific rules for different user intents.
For example, if a user asks for help, the bot will prompt for name, email, and the topic of the help request.
Alternatively, if the user wants to book an appointment, the bot will ask for their name, email, type of animal (cat or dog), the breed if it’s a dog, and the preferred appointment date.
This conditional questioning is made possible by crafting the prompt carefully to include logic branches inside the JSON flow.
The bot essentially tailors its questions based on previous responses, making the conversation feel natural and relevant.

Why Use JSON for Data Retrieval?
Diana emphasizes that the JSON flow is designed only for retrieving information from the conversation.
The JSON uses the chat history to locate and extract the specified fields, rather than capturing every single user input.
This selective data extraction is crucial for keeping your data clean and focused on what matters.
Creating and Managing JSON Flows
Next, Diana demonstrates how to create JSON flows tailored for each user scenario.
She starts by duplicating existing JSON flow templates available in ChatbotBuilder to save time.
Then, she customizes these flows by specifying exactly which fields she wants the AI to retrieve — for example, name, email, and topic for the help request flow.
Once the flow is set up, running it in preview mode will generate a JSON output showing the structured data collected from the user.
This preview helps verify that the flow works correctly and that the fields are being captured as expected.

Using JSON Pathfinder Tools
After obtaining the JSON output, Diana recommends using a JSON pathfinder tool to map the JSON fields to your chatbot’s CUFs.
These tools allow you to browse through the JSON structure and identify the exact paths where each piece of data is stored.
For example, you might find that the user’s name is located at x.name
, email at x.email
, and topic at x.topic
.
Diana points out an important tip shared by fellow CBB member Ryan: when mapping these paths, you should remove the leading x
to ensure proper integration with CUFs.
Once mapped, these CUFs can be used throughout your chatbot to personalize conversations, trigger workflows, or integrate with external systems.
Including JSON Examples for Consistency
One standout insight from Diana’s tutorial is the importance of including a JSON example in your prompt.
This example acts as a template that the AI will follow every time it generates JSON data.
By providing a consistent format, you reduce the risk of the AI changing field names or data structures unexpectedly.
This consistency is vital because any change in field names would break the path mappings and cause your CUFs to receive incorrect or no data.
Including examples is a simple yet effective trick to maintain data integrity.
Handling Complex Data and Conditions
For the appointment booking flow, Diana introduces more complex conditions.
For instance, the bot asks if the user has a cat or dog.
If the user selects dog, the bot will then ask for the breed. T
his conditional branching ensures that users are only asked relevant questions, improving their experience and reducing confusion.
In addition, Diana notes that some fields, like dates, should be mapped as text CUFs rather than identity fields for better compatibility.
This subtle detail highlights the importance of testing and adjusting your mappings based on the data types involved.
Creating Functions to Trigger JSON Flows
To activate these JSON flows within the chatbot, Diana shows how to create custom functions.
Each function corresponds to a particular JSON flow — one for help requests and another for appointment bookings.
These functions are then added to the default reply flow.
The bot uses conditions to determine which function to trigger based on the conversation context and whether all required data fields have been collected.
This modular approach allows you to maintain clean, organized flows and makes it easy to extend your bot’s capabilities by adding new functions and JSON flows as needed.
Testing Your Bot and Seeing Results
Finally, Diana tests the bot in action. She demonstrates asking for help, providing name, email, and topic, and watching as the bot triggers the JSON flow and outputs the structured data.
She also tests the appointment booking, showing how the bot correctly asks about the animal type, requests the breed only if it’s a dog, and collects the preferred appointment date. The JSON output captures all this data accurately, proving the entire setup works smoothly.

Conclusion
Diana’s tutorial offers a clear, practical roadmap for harnessing JSON within ChatbotBuilder to collect and organize user data efficiently.
By leveraging the default reply prompt, creating targeted JSON flows, mapping data to CUFs, and using functions to trigger these flows, you can build chatbots that deliver personalized and dynamic user experiences.
Remember these key takeaways:
- Use the default reply prompt for maximum control over conversations.
- Design JSON flows to extract only the data you need from chat history.
- Utilize JSON pathfinder tools to correctly map JSON fields to CUFs.
- Include JSON examples in your prompts to ensure consistent data formatting.
- Set up functions to modularly trigger JSON flows based on user intents.
- Test thoroughly to handle conditions and data types properly.
With these strategies, your chatbot will be ready to collect valuable user information smoothly, opening doors to smarter automation and better customer engagement.
Big thanks to Diana Pinheiro for sharing this insightful method with the CBB community.
If you’re a chatbot builder looking to enhance your data collection workflows, this guide is a must-try!
For any questions or further discussion, feel free to join the CBB Discord community
where Diana and other co-creators are always ready to help.
