equal-aqua•5w ago
Assistant hooks with prompt action type not working
I am setting the below hook but it does nothing.
If I switch to "exact" it works fine.
"hooks": [
{
"on": "customer.speech.timeout",
"options": {
"timeoutSeconds": 10,
"triggerMaxCount": 1,
"triggerResetMode": "onUserSpeech"
},
"do": [
{
"type": "say",
"prompt": "Are you still here?"
}
]
}
]
10 Replies
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
Vapi
Customer Support Team
quickest-silver•5w ago
Try setting "triggerResetMode": "onAssistantResponse" instead of "onUserSpeech".
Also make sure your hook is inside the assistant configuration JSON and not under a specific prompt.
If it still doesn’t trigger, wrap it in an "exact" event or increase "timeoutSeconds" slightly — some hooks only fire when the assistant is idle long enough.
equal-aquaOP•4w ago
Hi, thanks for the response, but if I try this I get this error "each value in hooks.options.triggerResetMode must be one of the following values: onUserSpeech, never".
The problem is not that the hook does not trigger. The hook triggers fine but only if I set it to "exact". So the problem is with the "prompt" type.
Does it work for you?
Hi DomT,
To utilize assistant hooks effectively, you'll want to define them in your assistant configuration to perform automated actions during specific call events. You can set up hooks for events like
call.ending, assistant.speech.interrupted, or customer.speech.timeout.
Here's a quick example for handling a customer speech timeout:
For more flexibility, you can also define conditions under which a hook should trigger using filters. For detailed guidance on hooks and examples, please refer to the Assistant hooks documentation.
If you have any specific scenarios or issues, feel free to let me know.equal-aquaOP•4w ago
Hi, please take a look at my original example. I know how hooks work and I have already made them work fine.
What does not work is the "prompt". If I use "exact" as in your example, the hook works fine.
If I switch to "prompt" though, which is supported by the documentation, it does not work.
Can you please test your example like this?
{
"hooks": [{
"on": "customer.speech.timeout",
"options": {
"timeoutSeconds": 10,
"triggerMaxCount": 3,
"triggerResetMode": "onUserSpeech"
},
"do": [{
"type": "say",
"prompt": "Are you still there? Please let me know how I can help you."
}],
"name": "timeout_check"
}]
}
Hi there,
I tested your exact hook configuration on our side, and the hook does work correctly with
prompt. The assistant didn’t repeat the phrase exactly as written because prompt lets the model paraphrase, but the hook did trigger and the assistant responded based on the prompt you provided.
If you want the assistant to say the exact phrase verbatim, switching back to "exact" is the correct choice — but functionally, the hook is firing properly in both cases.
Let me know if you'd like me to test this within your specific assistant config as well.
equal-aquaOP•6d ago
Hi, I think I figured out the problem. I am using my own Azure API key for the GPT model. This is why it does not work. If I switch to OpenAI's model it works fine. It also works with Anthropic but it also does NOT work with other models such as Gemini or Llama 4 Maverick 17B 128e Instruct.
So, it works only with specific models.
Do you think you can look into this?
Note that I am talking about the "prompt" type. The "exact" works fine with my API key model.
This might explain why I couldn't reproduce it because I was using openAI models. Could you remove your Azure key to check if it works that way? We will look into it in the meantime
equal-aquaOP•6d ago
Hi, if I remove my api key it says it does not find credentials for azure-openai. As I mentioned though, if I use OpenAI direct models (not Azure), it works just fine. Thank you for looking into this.
Could you also provide a call id for the calls using azure and not openAI directly when using `prompt` hooks? I have a feeling it might be incompatible with azure.