How can I get the correct structured data?
# support
c
I gave the prompt for structured data like this "Extract the name that the caller gave us in the name property field. Extract the email that the caller gave us in the email property field. If the extracted email format is incorrect, attempt to correct it to a valid email format. Extract the phone number that the caller gave us in the phone property field. Extract the property address what the client gave us in the property address property field. Extract the schedule time what the client gave us in the schedule time property field." But when I end the call without providing these fields, it sometimes returns "Not Provider" { "Name": "Not provided", "Email": "Not provided", "Phone": "Not provided", "Schedule Time": "Not provided", "Property Address": "Not provided" } I need to create leads with this information in GHL, so I need correctly formatted email addresses and phone numbers. How can I solve this?
v
Hey there! 👋 I see you're having trouble with structured data extraction where fields are returning "Not provided" when creating leads in GHL. While I can't diagnose your specific implementation, I can definitely help with strategies to improve your structured data extraction! Here are several approaches to solve your issue: ## 1. Customize Your Structured Data Prompt and Schema You can customize both the prompt and schema to better handle missing data:
Copy code
json
{
  "structuredDataPrompt": "Extract all available information. If information is missing, use a default value instead of 'Not provided'.",
  "structuredDataSchema": {
    "type": "object",
    "properties": {
      "Name": { "type": "string" },
      "Email": { "type": "string", "format": "email" },
      "Phone": { "type": "string" },
      "Schedule Time": { "type": "string" },
      "Property Address": { "type": "string" }
    },
    "required": ["Name", "Email", "Phone", "Schedule Time", "Property Address"]
  }
}
According to the [call analysis documentation](https://docs.vapi.ai/assistants/call-analysis), this approach gives you more control over how structured data is extracted. ## 2. Improve Email Format Validation For email addresses, try these techniques: - Request users to spell out their email addresses character by character: "Could you please spell out your email address for me? For example, j-o-h-n at e-x-a-m-p-l-e dot c-o-m" - Repeat the spelled-out email back to the user for confirmation - Implement text normalization and regex patterns to clean and validate email formats According to [community discussions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1331353180570914878), having users spell out emails significantly improves accuracy. ## 3. Enhance Phone Number Format Validation For phone numbers: - Use the E.164 format as a standard (e.g., +15558675309)
- Consider setting
numberE164CheckEnabled
to
false
if you need to allow non-E164 numbers - Use Format Plans with regex replacements to customize phone number formatting For example, you can use a custom replacement rule to format phone numbers:
Copy code
json
{
  "formatPlan": {
    "enabled": true,
    "replacements": [
      {
        "type": "regex",
        "regex": "\\+1(\\d{10})",
        "value": "$1"
      }
    ]
  }
}
## 4. Maintain State and Handle Interruptions Ensure your assistant: - Maintains state throughout the conversation - Handles interruptions gracefully - Verifies all required information is collected before ending the call According to [community discussions](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1344181455567196170), this approach helps ensure complete information collection. ## 5. Format Data for GHL Integration When integrating with GHL: - Ensure user input is correctly formatted as required by GHL before passing it to their module - Use GHL webhooks as a custom tool with Vapi for integrating structured data - Break down complex automations into smaller, focused workflows for better maintainability The [GHL tools documentation](https://docs.vapi.ai/tools/GHL) recommends thorough testing of the integration to ensure reliable performance and accurate data passing. Would you like me to elaborate on any of these strategies or provide more specific examples for your use case? Sources: - [Call Analysis Documentation](https://docs.vapi.ai/assistants/call-analysis) - [Community Discussion on Email Formatting](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1331353180570914878) - [Community Discussion on State Management](https://discord.com/channels/1211482211119796234/1211483291191083018/threads/1344181455567196170) - [GHL Tools Documentation](https://docs.vapi.ai/tools/GHL)
k
Hey! To help track down this issue, could you share: - The call ID - What response you expected to get - What response you actually got instead This would really help us figure out what went wrong!
2 Views