Skip to main content
Cookbook Maintenance Webhook Actions

Get Alerted When a Webhook Fails with Webhook Actions and AI

A message to Slack, email or another channel when a webhook gives up on a delivery, tested once on your yes.

Difficulty Beginner
Time ~5 min

Prerequisites

A site connected to WPVibe running Webhook Actions 3.3.4 or newer (tested on 3.3.4, free) on WordPress 6.9 or newer and PHP 8.0 or newer, with an administrator account. At least one notification channel added in Webhook Actions, Notifications, Channels.

The prompt
My WordPress site uses Webhook Actions. Alert me on [the channel, for example my Slack channel or my email] when [one webhook, for example the order sync, or any webhook] gives up on a delivery.

1. Run discover_abilities with category webhook-actions. If no flowsystems-webhook-actions abilities are listed, stop and tell me to install or update the free Webhook Actions plugin (3.3.4 or newer; its abilities need WordPress 6.9 or newer). If list-webhooks is there but an ability this needs is missing, tell me AI write access is off (Webhook Actions, Settings, Let connected AI tools build webhooks) and stop.
2. Run flowsystems-webhook-actions/list-notification-channels. If none fits what I named, tell me to add it in Webhook Actions, Notifications, Channels (channels hold secrets, so only I can add them) and stop. Never make up a channel id.
3. Run flowsystems-webhook-actions/list-webhooks. If I named a webhook, find it; if several match, ask which. If its notifications_mode is off, tell me it sends no alerts at all, so a rule would never fire until I turn its notifications back on in that webhook's settings in Webhook Actions, and stop. If I said any webhook, the rule is site-wide: leave out webhook_id, and name any webhook whose notifications_mode is custom or off, because site-wide rules do not cover those.
4. Run flowsystems-webhook-actions/list-notification-rules (with that webhook_id, or without it for site-wide rules). If a rule already sends permanently_failed to that channel, show it to me and stop. For one webhook, also check the site-wide rules, and if one already covers it (its notifications_mode is inherit and that rule's id is not in its muted_rule_ids), tell me each failure would then send two alerts, and ask whether to add this rule anyway.
5. Run flowsystems-webhook-actions/create-notification-rule with a clear name, event permanently_failed (sent once per delivery when Webhook Actions gives up: after the last retry for a 5xx, 429 or network error, or at once for a 4xx answer such as 401 or 404, which is never retried), the channel_ids and, for one webhook, its webhook_id. Leave the template out so Webhook Actions writes the message, unless I asked for my own wording; if I did, read flowsystems-webhook-actions/get-trigger-schema for the paths first and show me the preview it returns.
6. Tell me a test sends a real message to every channel on the rule now, and wait for my yes. Then run flowsystems-webhook-actions/test-notification-rule with the rule's id and confirmed true, show me the result for each channel and ask me whether it arrived.
7. Tell me the other events I can be alerted on (failed_attempt for every failed try, retry_scheduled, recovered when a delivery succeeds after failing) and that throttle_seconds or a daily digest keeps a busy webhook from flooding the channel. Change nothing else.
Already connected?

Skip pasting the full prompt. Drop this into your AI on a site that already has WPVibe:

Run the “Get Alerted When a Webhook Fails with Webhook Actions and AI” recipe from the WPVibe cookbook on my connected site.

Webhook Actions retries a delivery that failed because the service was down, and gives up at once on answers like 401 or 404. Either way the order or the lead then never arrives, and nobody notices for days.

The AI adds a notification rule in Webhook Actions: when one webhook, or any webhook, gives up on a delivery, a message goes to the Slack channel, email address or other channel you already set up there. It sends one test message only after your yes and shows you what was sent.

Channels hold passwords and tokens, so you add them yourself in Webhook Actions, Notifications, Channels; the AI only uses them. The test is a real message to every channel on the rule. Webhook Actions can also alert on each failed attempt or when a webhook recovers. To work out why one failed, use this recipe.

Outcome

A notification rule that tells you on the channel you picked when a delivery is given up on, with one test message you saw arrive.