| name | apify-webhooks-events |
| description | Implement Apify webhooks for Actor run notifications and event-driven pipelines.
Use when setting up run completion alerts, building event-driven scraping pipelines,
or configuring ad-hoc webhooks for individual runs.
Trigger with "apify webhook", "apify events", "actor run notification",
"apify run succeeded webhook", "apify ad-hoc webhook".
|
| allowed-tools | Read, Write, Edit, Bash(curl:*) |
| version | 1.5.0 |
| license | MIT |
| author | Jeremy Longshore <jeremy@intentsolutions.io> |
| tags | ["saas","scraping","automation","apify"] |
| compatibility | Designed for Claude Code |
Apify Webhooks & Events
Overview
Configure webhooks to receive notifications when Actor runs complete, fail, or time out. Apify supports both persistent webhooks (for all runs of an Actor) and ad-hoc webhooks (for a single run). Event-driven architecture is the recommended pattern for production Apify integrations.
Prerequisites
npm install apify-client in your project (and express if you build an HTTP handler)
- An API token in
APIFY_TOKEN — read it from the environment
(process.env.APIFY_TOKEN) or pass Authorization: Bearer $APIFY_TOKEN on REST
calls, never hard-code it
- A public HTTPS endpoint for Apify to POST to (use ngrok while developing)
- Familiarity with
apify-sdk-patterns
Event Types
| Event | Fired When |
|---|
ACTOR.RUN.CREATED | A new Actor run starts |
ACTOR.RUN.SUCCEEDED | Run finishes with SUCCEEDED status |
ACTOR.RUN.FAILED | Run finishes with FAILED status |
ACTOR.RUN.ABORTED | Run is manually or programmatically aborted |
ACTOR.RUN.TIMED_OUT | Run exceeds its timeout |
ACTOR.RUN.RESURRECTED | A finished run is resurrected |
Instructions
Step 1: Create a Persistent Webhook
Persistent webhooks fire for every run of an Actor. Set condition.actorId, list
the eventTypes you care about, and shape the delivered body with
payloadTemplate:
import { ApifyClient } from 'apify-client';
const client = new ApifyClient({ token: process.env.APIFY_TOKEN });
webhook = client.().({
: [, , ],
: { : },
: ,
: .({
: ,
: ,
: ,
: ,
: ,
}),
: ,
});
.();