Skip to main content
All CollectionsFlows
How to leverage dynamic variables in flows
How to leverage dynamic variables in flows

Learn how to use dynamic variables to pass along relevant information and context to your AI Assistant during conversations

Alvaro Vargas avatar
Written by Alvaro Vargas
Updated over 2 months ago

How to Leverage Dynamic Variables in Flows

Learn how to use dynamic variables to pass along relevant information and context to your AI Assistant during conversations.

Dynamic variables allow your AI Assistant to deliver personalized responses and ensure that each interaction feels tailored to the user’s specific needs. By incorporating variables in the AI Assistant Node (Instructions) and Say Node (Prompt), you can seamlessly pass valuable information into conversations, enriching the overall experience.

Adding Dynamic Variables to Instructions

Within the AI Assistant Node, you can leverage dynamic variables to guide how the Assistant interacts with users. These variables help the AI pull context from previous interactions or system data to respond accurately.

To add a dynamic variable in the Instructions, type the { key to open a list of available variables. Select the variable you need, and the AI will automatically insert the relevant value during the conversation. This enables your AI Assistant to adjust its behavior based on real-time data, such as user input, previous API responses, or session-specific information.

For example, consider a customer support flow where a user provides their order number:

Goal: Help users track their order

Instructions:

“Ask the user for their 6-digit order number. Once you have it, respond with:

‘Thank you, {customer_name}. I see your order {order_number} is currently {order_status}. Let me know if you have any further questions!’”

In this case, variables like {customer_name}, {order_number}, and {order_status} are dynamically filled in during the conversation, giving a more personalized and accurate response.

Using Dynamic Variables in the Say Node

Dynamic variables can also be used effectively in the Say Node to craft more contextual and personalized messages. Like with the Instructions, simply type { to insert any available variable.

For instance, if the AI is providing an update based on the latest API response, you can pass dynamic information directly into the response:

Prompt:

“Your order {order_number} has been shipped and is expected to arrive at {delivery_address} by {delivery_time}. Would you like to track it further?”

The AI will replace the placeholders with real-time data from the API, ensuring that users always receive relevant and up-to-date information.

Passing Dynamic Information to the Context Window

Dynamic variables also allow you to pass critical information directly into the context window, providing the AI with the right details to make better decisions throughout the conversation. Whether it’s retrieving a user’s past interaction history or summarizing the key details of an ongoing support case, dynamic variables ensure that the AI maintains awareness of the user’s journey.

For example:

If the AI has collected an order number and needs to follow up, the context window can include:

"Order details: {order_number} is currently {order_status}, and the user is waiting for further assistance."

This keeps all the relevant data in context for future reference without needing the user to repeat themselves.

Example Use Case: Shop360 and Dynamic Table Schema

In this example, the Shop360 AI Assistant helps users choose the correct shoe size by leveraging a dynamically populated size chart. The AI pulls data from a universal table or a specific table based on the brand the customer inquires about, using variables like {brand}, {foot_measurement}, {size_us}, and {size_eu}.

Table Schema:

Type of Table:

Universal Table: Used for all brands that do not have a specific table.

Specific Table: Only for brands that have a dedicated table, such as Nike or Adidas.

Variables:

{brand}: The brand the customer is asking about.

{foot_measurement}: The customer’s foot measurement in centimeters.

{size_us}: The equivalent US size based on the foot measurement.

{size_eu}: The equivalent European size based on the foot measurement.

The AI dynamically selects the appropriate table based on the {brand} variable, pulling in size recommendations according to the user’s {foot_measurement}. This ensures accuracy in the response, using real-time data to guide the user.

Example Interaction:

User: “I need help choosing my shoe size for Nike sneakers.”

Assistant: “Sure! For Nike sneakers, please tell me your foot length in centimeters, and I’ll find the best size for you.”

User: “It’s 26 cm.”

Assistant: “Great! According to the Nike-specific size chart, a 26 cm foot corresponds to a size 8 in US and 42 in EU. Would you like to proceed with this size?”

In this use case, the assistant dynamically switches between different size charts based on the brand being queried, using the {brand} variable to ensure the correct data is used. If no specific brand table is available, it defaults to the universal size chart.

Best Practices for Using Dynamic Variables

1. Contextualize Responses: Make sure to use variables that match the conversation’s context. Avoid overwhelming users with irrelevant data.

2. Test Your Variables: Always test that the correct data is being populated by variables to prevent errors or mismatches during live interactions.

3. Keep It Natural: Aim for responses that feel natural and conversational, even when inserting dynamic data. Variables should enhance the flow, not interrupt it.

Conclusion

Dynamic variables are a powerful way to enrich your AI Assistant’s interactions. Whether you’re crafting personalized responses in the AI Assistant Node or the Say Node, using variables ensures that your assistant is contextually aware and can adapt its answers based on real-time data. By following the best practices above, you can create conversations that feel personal, relevant, and fluid, while delivering the information users need effortlessly.

Did this answer your question?