Call ended assistant hoook
# support
j
I want to notify slack on ANY error from the call. Right now it seems I'd have to specify each one. Is there a way to wildcard match or select all? filters: [ { type: "oneOf", key: "call.endedReason", oneOf: ["pipeline-error"], }, ], also, is the SDK or docs more up to date. there are different endedReason types in both
v
To notify Slack on any call error, remove the
filters
array from your
call.ending
hook so it triggers for all call end reasons. For example:
Copy code
json
{
  "hooks": [{
    "on": "call.ending",
    "do": [{
      "type": "tool",
      "tool": {
        "type": "function",
        "function": {
          "name": "report_error",
          "parameters": {
            "type": "object",
            "properties": {
              "text": {
                "type": "string",
                "value": "A call error occurred."
              }
            }
          },
          "description": "Reports a call error to Slack."
        },
        "async": false,
        "server": {
          "url": "<your-serverless-function-url>"
        }
      }
    }]
  }]
}
This will send a Slack notification for all call endings, not just specific errors. For more details, see the [Assistant Hooks documentation](https://docs.vapi.ai/assistants/assistant-hooks). Source: - [Assistant Hooks documentation](https://docs.vapi.ai/assistants/assistant-hooks)
c
Hi Jessica, You can find details on the various reasons a call might end by examining the
endedReason
codes available in your call logs. Each code indicates a specific reason, such as assistant-related issues, pipeline errors, connectivity problems, or call forwarding events. You can view the complete list and their explanations in the [call ended reasons document](https://docs.vapi.ai/calls/call-ended-reason). If you're specifically looking for how this affects your analytics or custom call handling, the changelog also lists updates on tracking calls ended due to hook actions, which capture automated handling outcomes. Let me know if you need any more information on a specific code or process.
j
what is the source of truth? in the documentation you linked, there's "pipeline-error-*" but the assistant hooks docs uses "pipeline-error". does the hook filter support wildcard?
c
The truth is in the docs, but despite it using a wildcard it was meant to be more of a placeholder for all the various enums for endedReasons (because there is a lot). The hook filter does not support general regex or wildcards, but there are three values that are built to be wildcards to match specific types of error values. Combine these three values in your config and you got all the error types: -
"pipeline-error"
-
"providerfault"
-
"vapi-fault"
I'll even sweeten the deal for you. Here's the config for a tool for a slack webhook:
Copy code
{
  "hooks": [
    {
      "on": "call.ending",
      "filters": [
        {
          "type": "oneOf",
          "key": "call.endedReason",
          "oneOf": [
            "pipeline-error",
            "providerfault",
            "vapi-fault"
          ]
        }
      ],
      "do": [
        {
          "type": "tool",
          "tool": {
            "type": "apiRequest",
            "method": "POST",
            "url": "https://hooks.slack.com/services/YOUR/SLACK/WEBHOOK",
            "body": {
              "type": "object",
              "properties": {
                "text": {
                  "type": "string",
                  "value": "🚨 Call Error: {{call.endedReason}} for call {{call.id}}"
                }
              }
            }
          }
        }
      ]
    }
  ]
}
j
thanks kyle!
c
No worries. Let us know if you need anything.