Schedule icon
Request icon
Return icon
Switch icon
Log icon
SlackIncomingWebhook icon

Exotel Call Failure Sentinel

Read recent Exotel calls every hour, place no call, and alert Slack when failed calls cross your limits, with busy, no-answer and connect rate.

Categories
Business

Indian businesses use Exotel for delivery-partner masking, order confirmation calls, sales dialers, OTP-by-voice and IVR campaigns. When the account balance runs out, an ExoPhone is blocked or flagged, a call flow is misconfigured, or a telecom route has trouble, calls end with Status: failed instead of ringing the customer, and the operations team only notices when confirmations stop coming back. Exotel records every call's outcome, but nobody watches the rate. This blueprint turns a scheduled, read-only call to the Exotel Call Details API into a calling health gate: io.kestra.plugin.core.http.Request reads recent calls, one jq query computes the failed-call rate and the connect rate, and the result routes to a quiet log or a Slack alert.

How it works

  1. list_calls (io.kestra.plugin.core.http.Request) calls GET /v1/Accounts/{AccountSid}/Calls.json with PageSize=100, a Direction filter and a DateCreated=gte: filter for the lookback window, using HTTP basic auth with the API key and token. It is a read: no call is placed or ended. Retries cover short network blips, and allowFailed plus allowFailure keep an API error from aborting the flow so it can be reported instead.
  2. summarize_calls (io.kestra.plugin.core.debug.Return) first guards for a missing or non-200 response (UNREACHABLE). Otherwise one jq query keeps calls whose Status is final (completed, failed, busy, no-answer), ignores ones still queued, ringing or in progress, and computes the share that failed (the call could not be put through) and the share completed (the connect rate). busy and no-answer are reported but not counted as failures, because they depend on the person called. Fewer than min_calls finished calls is LOW_VOLUME; at or above critical_failure_rate is CRITICAL; at or above warning_failure_rate is WARNING; otherwise HEALTHY.
  3. route_by_failures (io.kestra.plugin.core.flow.Switch) branches on that classification: HEALTHY and LOW_VOLUME log quietly, WARNING posts a Slack note, CRITICAL and UNREACHABLE page Slack. A defaults fallback logs anything unexpected.
  4. log_audit_result (io.kestra.plugin.core.log.Log) writes one audit line per run with the HTTP status and the full summary.
  5. The flow-level errors block pages Slack if the flow itself fails, and the hourly_check trigger runs at 5 minutes past every hour (Asia/Kolkata), shipped disabled: true.

What you get

  • An hourly, read-only check of voice calling with no custom scripting and no extra plugin to install.
  • A status output (HEALTHY / WARNING / CRITICAL / LOW_VOLUME / UNREACHABLE) other flows can gate on, for example to pause an outbound campaign or switch order confirmations to SMS or WhatsApp while calls fail.
  • Slack messages with the failed-call rate, the busy and no-answer counts and the connect rate.
  • An audit line on every run, separate from Slack.

Who it's for

  • Indian e-commerce, logistics, food-delivery and fintech teams that place confirmation, masking or collection calls through Exotel.
  • Sales and support teams running dialer or IVR campaigns.
  • Teams that already run their alerting in Kestra.

Why orchestrate this with Kestra

Exotel's dashboard shows call reports and its status callbacks report one call at a time. Kestra turns a plain, read-only API call into a scheduled, typed classification with retries, a failure path and an execution history, and the status output lets your campaign and notification flows fall back to another channel automatically.

Prerequisites

  • An Exotel account placing calls, with its API key, API token and account SID from the API settings page of the dashboard.
  • The API host of your cluster (api.exotel.com or api.in.exotel.com), shown on the same page.
  • A Slack incoming webhook for the WARNING, CRITICAL, UNREACHABLE and flow-failure alerts.

Secrets

  • EXOTEL_API_KEY: the API key (basic auth username).
  • EXOTEL_API_TOKEN: the API token (basic auth password).
  • EXOTEL_ACCOUNT_SID: the account SID used in the URL path.
  • SLACK_WEBHOOK: Slack incoming webhook used for every alert branch and the flow-failure alert.

In Kestra OSS, secrets are supplied as environment variables prefixed SECRET_ and base64-encoded, for example SECRET_EXOTEL_API_KEY=$(echo -n 'xxxxxxxx' | base64), and read back with {{ secret('EXOTEL_API_KEY') }}. Use the Enterprise secrets backend for encryption at rest and access control.

Quick start

  1. Place a few test calls through the Exotel API (or note a busy hour of real traffic).
  2. Add EXOTEL_API_KEY, EXOTEL_API_TOKEN, EXOTEL_ACCOUNT_SID and SLACK_WEBHOOK as secrets, and set api_host for your cluster.
  3. Run the flow manually with a low min_calls and compare the counts in the logs with the call report in the Exotel dashboard.
  4. Enable hourly_check.

How to extend

  • Follow Metadata.NextPageUri when you place more than 100 calls in the window (the summary reports total_in_window).
  • Add a PhoneNumber filter to watch one ExoPhone with its own limits.
  • Alert on a falling connect_rate too, if a sudden drop in answered calls matters for your campaigns.
  • Restrict the trigger cron to your calling hours, and store the last status in a KV store to alert only on changes.

Inputs

  • api_host: type STRING, default api.exotel.com.
  • direction: type STRING, default outbound-api.
  • lookback_hours: type INT, default 2.
  • warning_failure_rate: type FLOAT, default 5.0 (percent).
  • critical_failure_rate: type FLOAT, default 15.0 (percent).
  • min_calls: type INT, default 30.

Outputs

  • status: one of HEALTHY, WARNING, CRITICAL, LOW_VOLUME, UNREACHABLE.
  • Example path: {{ fromJson(outputs.summarize_calls.value).connect_rate }} for the share of calls that connected.

Links

Pitfalls

  • Only the first page (100 calls, newest first) is read; high-volume accounts need paging or a shorter window.
  • The DateCreated filter is sent in IST (Asia/Kolkata); change the time zone in list_calls if your account reports in another one.
  • busy and no-answer are normal for outbound calling and are not failures here; only failed (the call could not be put through) is.
  • This flow only reads; it never places, ends or records a call.
See How

New to Kestra?

Use blueprints to kickstart your first workflows.