Overview

When creating custom metrics, you can use variables from call data using the {{variable_name}} syntax. These variables come from different sources depending on the context.

Variable Sources

1. Call Information

System-provided call data:
  • {{transcript}} - Full transcript
  • {{call_end_reason}} - Call Ended Reason
[00:02] Testing Agent: Hello.
[00:02] Main Agent: Customer support. Can I help you today?
[00:07] Testing Agent: Who's this?
[00:09] Main Agent: Hi. I'm Alex, your virtual assistant from Tech Solutions customer support. I'm here to help with any questions or issues you have about our products or services. How can I assist you?
[00:22] Testing Agent: Alex, Tech Solutions.
[00:26] Main Agent: That's right. I'm Alex from Tech Solutions. We provide software like Taskmaster Pro for productivity, SecureShield for security, and Business Flow for management. How can I help you today?
[00:39] Testing Agent: What software?
[00:41] Main Agent: Great question. Uh, Tech Solutions offers software for productivity, security, and business management. Taskmaster Pro with organizing tasks, projects, and schedules, SecureShield focuses on Internet security, and protecting data. Business flow streamlines processes like invoicing, reporting, and workflow management. Do you need help with 1 of these? Or want more details about a specific product?
[01:07] Testing Agent: Not sure. Maybe.
[01:10] Main Agent: No worries. If you're not sure, maybe you could tell me you could tell me what kind of help you're looking for. Like, organizing tasks, securing your data, or managing business workflows. I'll point you in the right direction.
[01:23] Testing Agent: Don't remember order.
[01:26] Main Agent: Uh, got it. You're looking to check your order with Tech Solutions. Let's figure this out. Um, do you remember that email address or account name you used to place the order? That'll help me assist you faster.
[01:39] Testing Agent: Email? No.
[01:42] Main Agent: That's okay. We can try another route. Do you happen to recall any order details? Like the product name or approximate date you placed the order? It'll help narrow things down.
[01:53] Testing Agent: No details. Confused.
[01:58] Main Agent: I totally understand. Can be frustrating. Let's figure this out together. If you're unsure about your order details, I can direct you to billing department. They can look up your order using other information, like your name or payment details. Would that work? For you?
[02:16] Testing Agent: Maybe not sure.
[02:20] Main Agent: Alright. No problem. Let's take it 1 step at a time. How about this? Do you recall the type of payment methods you used, like a credit card, or PayPal? Sometimes that's enough for us to locate an order.
[02:33] Testing Agent: Card may be
[02:37] Main Agent: Got it. Possibly a card. Here's what we can do. I'll pass this over to our billing team. They can help locate your order with the card details. Uh, they're really good at this. Would you like me to connect you with them now?
[02:52] Testing Agent: Okay. Maybe?
[02:55] Main Agent: Alright. I'll get you connected. The billing team ask for details like your name and possibly the last 4 digits of your card, uh, to locate your order. Let me transfer you now. 1 moment.
[03:07] Testing Agent: Wait. What?
[03:11] Main Agent: Oh, sorry. That was a bit fast. Basically, I'm saying our billing team can help find your order. They'll just need some info like, your name and, uh, maybe the last few digits of your card. Does that sound okay? Or need more clarification?
[03:27] Testing Agent: Name. Okay.
[03:31] Main Agent: Great. Your name, they'll be able to start looking into your order. Let me quickly connect you to our billing team, and, uh, they'll assist you from here. Uh, hold for just a moment.
[03:44] Testing Agent: Now what?
[03:47] Main Agent: Good question. Now, just hold tight. I'm transferring you to the billing team They'll ask for your name and maybe some basic details to locate your order. Else you want me to mention? While setting this up?
[04:00] Testing Agent: No. Just wait.
[04:03] Main Agent: Got it. I'll transfer you now. Hang tight for just a moment.
[04:07] Testing Agent: Okay.
[04:10] Main Agent: Alright. Transferring you now. Thank you for your patience.
[04:11] Testing Agent: How long
[04:18] Main Agent: It usually doesn't take more than a minute or 2 to connect you with the billing team. I'll keep an eye on the transfer to make sure it goes smoothly. Thanks for waiting

2. Metadata

Available in both Run (simulations) and CallLog (observability).
{
    "metadata": {
        "ringing_duration": 1.2, // Only available in Runs
    },
    "transcript": "Full conversation transcript",
}

3. Dynamic Variables

Only available when calls created via API with dynamic_variables.
{
    "dynamic_variables": {
        "user_name": "John Doe",
        "appointment_date": "2024-01-15",
        // ... other dynamic variables
    },
    "metadata": {
        "internal_user_id": "uuid",
    },
    "transcript": "Full conversation transcript",
}

Using Variables in Metrics

When creating metrics, you can reference these variables directly in your metric configuration. Here’s how it looks in the interface:

Key Points

  • Variables are case-sensitive: {{user_name}}{{User_Name}}
  • Not all variables exist in every call - handle missing values
  • You can directly use the key from dynamic_variables or metadata in metric (e.g., {{user_name}}, {{ringing_duration}})