Does the Workflow feature keep the conversation hi...
# support
n
Does it remember what all it talked or do we have to store everyhing in the variable to pass on the context. Does each node pass context to each other node ?
v
Hi there! 👋 Based on the information I've found, I can help clarify how conversation history and context work in Vapi's Workflow feature. No, the Workflow feature does not automatically retain or pass conversation history between nodes. According to the available documentation, you need to explicitly manage context by storing information in variables to pass it between nodes. [According to the information I found](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334666797932089405), users have reported issues with data being lost or corrupted when passed between nodes, suggesting that context is not automatically maintained throughout the workflow. There are also [documented issues with variable replacement](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1324353725564715121) within workflows, indicating that passing context relies on variables, and this mechanism isn't always reliable. For managing context in your workflows, you have several options: 1. Use variables to explicitly store and pass information between nodes 2. Utilize the
metadata
property that has been added to Say, Edge, Gather, and Workflow Nodes to [store additional information](https://docs.vapi.ai/changelog/2025/1/29) 3. For transfers between assistants, you can use the
rolling-history
feature to [preserve conversation history](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1341910696182681613) Is there anything specific about context management in Vapi Workflows that you'd like me to elaborate on? Sources: - [Discord Thread on Data Passing Issues](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1334666797932089405) - [Discord Thread on Variable Replacement Issues](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1324353725564715121) - [Vapi Changelog](https://docs.vapi.ai/changelog/2025/1/29)
s
@Nikhil The question asks how to make a VAPI voice agent aware of previous call details for a specific customer when making outbound calls, particularly when using separate assistants for each call. ## Overview of Solution The provided answer correctly outlines the core approach of incorporating historical context into the conversation by retrieving past call data and including it in the API request. However, I can enhance this example with more VAPI-specific implementation details. ## Detailed Solution The example correctly identifies the fundamental steps: 1. Retrieve customer call history from your database 2. Format this as context for the AI 3. Include this in your API calls However, the implementation can be improved for VAPI specifically:
Copy code
javascript
// Better implementation for VAPI
{
  "name": "Customer-Aware Outbound Assistant",
  "model": {
    "provider": "openai", // Or anthropic, etc.
    "model": "gpt-4-turbo",
    "messages": [
      {
        "role": "system",
        "content": "You are a voice assistant making an outbound call to a customer. You have access to previous call records below. Use this history to provide personalized service, reference past interactions naturally, and avoid asking for information the customer has already provided. Never explicitly mention that you have access to call records unless the customer asks."
      },
      {
        "role": "user",
        "content": "CUSTOMER PROFILE:\nName: John Smith\nPhone: +1-555-123-4567\nAccount ID: JS12345\n\nPREVIOUS CALL HISTORY:\n\nCall #1 (2023-10-15):\n- Customer inquired about upgrading service plan\n- Discussed premium and standard options\n- Customer was concerned about pricing\n- Action items: Send pricing comparison to customer email\n\nCall #2 (2023-11-02):\n- Follow-up about pricing comparison\n- Customer still undecided\n- Main concerns: Contract length and early termination fees\n- Customer mentioned they were going on vacation until Nov 15\n\nCURRENT CONTEXT:\n- Purpose of today's call: Follow up on service plan upgrade\n- Offer: Special 20% discount available this month only\n- Note: Approval for waiving early termination fee has been granted if needed"
      },
      {
        "role": "assistant",
        "content": "I understand this context and will make the call with this history in mind."
      }
    ],
    "temperature": 0.4
  },
  "firstMessageMode": "assistant-speaks-first",
  "firstMessage": "Hello, this is [Company Name] calling for John. Is this a good time to talk about your service plan options?"
}
Additionally, for dynamic implementation in your workflow:
Copy code
javascript
// Dynamic implementation in a VAPI workflow
async function prepareOutboundCall(customerPhone, customerId) {
  // 1. Fetch customer data and call history
  const customerData = await yourDatabase.getCustomer(customerId);
  const callHistory = await yourDatabase.getCallHistory(customerId);
  
  // 2. Format the history as structured content
  const formattedHistory = formatCallHistory(callHistory);
  
  // 3. Prepare the contextual message
  const contextMessage = `
CUSTOMER PROFILE:
Name: ${customerData.name}
Phone: ${customerData.phone}
Account ID: ${customerData.accountId}

PREVIOUS CALL HISTORY:
${formattedHistory}

CURRENT CONTEXT:
- Purpose of today's call: ${customerData.currentCampaign.purpose}
- Offer: ${customerData.currentCampaign.offer}
- Notes: ${customerData.currentCampaign.notes}
  `;
  
  // 4. Create or update the assistant with this context
  const assistant = await vapi.assistants.create({
    name: `Outbound to ${customerData.name}`,
    model: {
      provider: "openai",
      model: "gpt-4-turbo",
      messages: [
        {
          role: "system",
          content: "You are a voice assistant making an outbound call to a customer. Use the provided call history to personalize the conversation and provide continuity of service."
        },
        {
          role: "user",
          content: contextMessage
        },
        {
          role: "assistant",
          content: "I will use this context to provide a personalized experience."
        }
      ],
      temperature: 0.4
    },
    firstMessageMode: "assistant-speaks-first",
    firstMessage: `Hello, this is ${yourCompany.name} calling for ${customerData.name}. Is this a good time to discuss your service options?`
  });
  
  // 5. Initiate the call
  return vapi.calls.create({
    from: yourCompany.phone,
    to: customerPhone,
    assistantId: assistant.id
  });
}

// Helper function to format call history
function formatCallHistory(callHistory) {
  return callHistory.map((call, index) => {
    const date = new Date(call.timestamp).toISOString().split('T')[0];
    return `
Call #${index + 1} (${date}):
- Purpose: ${call.purpose}
- Main points: ${call.summary}
- Customer concerns: ${call.customerConcerns}
- Action items: ${call.actionItems}
- Outcome: ${call.outcome}
`;
  }).join('\n');
}
This implementation ensures that each outbound call has comprehensive knowledge of previous interactions while maintaining a natural conversational flow, creating a seamless experience that makes customers feel remembered and valued rather than repeating information they've already provided in previous calls.
2 Views