Prompt on customer speech time out hook
# support
c
Hello, I am facing an issue while using prompt on hook. The assistant says nothing when I give it a "prompt" but works fine when I give it "exact" Hook log- { "id": "log-20", "level": 30, "time": 1769847486403, "timestamp": 1769847486403000000, "severityText": "INFO", "severityNumber": 9, "body": "Hook ran on customer.speech.timeout and said: ", "attributes": { "category": "hook", "callId": "019c1......588", "orgId": "cdbb.....c216f0" } } Hook config- "hooks": [ { "do": [ { "type": "say", "prompt": "say Hello" } ], "on": "customer.speech.timeout", "name": "customer_test", "options": { "timeoutSeconds": 7.5, "triggerMaxCount": 3, "triggerResetMode": "onUserSpeech" } } ],
c
Hi there, Thank you for your message. Our team is currently out of the office. We operate Monday through Friday, from 9:00 AM to 8:00 PM Pacific Standard Time (PST). We’ll get back to you as soon as possible during our normal business hours. If your message is urgent, please mark it accordingly or include “URGENT” in the subject line, and we’ll do our best to respond promptly. Warm regards, Vapi Customer Support Team
v
For simple timeout messages, use the
exact
field instead of
prompt
to ensure the assistant speaks as expected. Here’s how you can update your hook:
Copy code
json
{
  "hooks": [
    {
      "do": [
        {
          "type": "say",
          "exact": "Hello, are you still there?"
        }
      ],
      "on": "customer.speech.timeout",
      "name": "customer_test",
      "options": {
        "timeoutSeconds": 7.5,
        "triggerMaxCount": 3,
        "triggerResetMode": "onUserSpeech"
      }
    }
  ]
}
This will reliably speak your message on timeout. For more dynamic responses, use a detailed prompt with context. Source: [Vapi Assistant Hooks Documentation](https://docs.vapi.ai/assistants/assistant-hooks)
c
This is just a place holder prompt, my original prompt is supposed to be something like - If user says wait say nothing, else say Hello
c
Hi, could you please provide us with the Call ID? Thanks, Shaunak
c
Call id- 019c1cc8-0ba4-7998-8833-49da70bfdee8
Hello??
Any update?
c
Hi, We reviewed the logs for call ID 019c1cc8-0ba4-7998-8833-49da70bfdee8. The hook is firing correctly, but when using
prompt
in the
say
action, it’s producing empty output. This happens because
prompt
triggers an LLM call to generate the speech dynamically, and in this case the LLM is returning nothing. For reliable behavior, we recommend using
exact
instead of
prompt
, for example:
Copy code
{
  "hooks": [
    {
      "do": [
        {
          "type": "say",
          "exact": "Hello"
        }
      ],
      "on": "customer.speech.timeout",
      "options": {
        "timeoutSeconds": 7.5,
        "triggerMaxCount": 3,
        "triggerResetMode": "onUserSpeech"
      }
    }
  ]
}
For logic like “if the user says wait, say nothing; otherwise say _hello_”, we recommend handling that in your system prompt instead. For example: “If the user goes silent, ask if they’re still there. If the user says ‘wait’, remain silent and wait.” Alternatively, you can route the hook to a webhook and handle the conditional logic server-side. Let us know if you want help setting that up.
c
How can I do the "route the hook to a webhooks" logic? And how the webhooks route should look like?
c
You can use something like this:
Copy code
"hooks": [
  {
    "do": [
      {
        "type": "tool",
        "tool": {
          "type": "function",
          "function": {
            "name": "handleCustomerTimeout",
            "description": "Handle customer speech timeout",
            "parameters": {
              "type": "object",
              "properties": {
                "transcript": {
                  "type": "string",
                  "description": "The conversation transcript"
                }
              }
            }
          },
          "server": {
            "url": "https://your-server.com/webhook/timeout-handler"
          },
          "messages": [
            {
              "type": "request-response-delayed",
              "content": "One moment please..."
            }
          ]
        }
      }
    ],
    "on": "customer.speech.timeout",
    "name": "customer_timeout_webhook",
    "options": {
      "timeoutSeconds": 7.5,
      "triggerMaxCount": 3,
      "triggerResetMode": "onUserSpeech"
    }
  }
]
c
So this way how will I get the latest transcript in in webhooks?
c
When you use a custom function tool in a customer.speech.timeout hook, Vapi does not automatically pass the transcript as a parameter. The webhook receives the standard tool‑call payload with call metadata, but not the transcript itself. To access the latest transcript, you’ll need to: 1. Read the call ID from the webhook payload. 2. Make a follow‑up request to the Vapi API to fetch the call details. 3. Extract the transcript (or messages) from that response. For example:
Copy code
GET https://api.vapi.ai/call/{callId}
r
I'm running into this issue as well. I'm using "prompt" instead of "exact" in the hook but it doesn't work. Why is this in the docs if it doesn't work??
For reference:
Copy code
{
    on: "customer.speech.timeout",
    options: {
        timeoutSeconds: 20,
        triggerMaxCount: 3,
        triggerResetMode: "onUserSpeech",
    },
    do: [
        {
            type: "say",
            prompt: "....",
        },
    ],
    name: "idle_message_check",
}
c
Can you please share the call ID?