|
| 1 | +--- |
| 2 | +title: Subscribe to events from Cloudflare services with Queues |
| 3 | +description: Subscribe to events from Cloudflare services to build custom workflows, integrations, and logic. |
| 4 | +products: |
| 5 | + - queues |
| 6 | +date: 2025-08-19 12:00:00 UTC |
| 7 | +--- |
| 8 | + |
| 9 | +You can now subscribe to events from other Cloudflare services (for example, [Workers KV](/kv/), [Workers AI](/workers-ai), [Workers](/workers)) and consume those events via [Queues](/queues/), allowing you to build custom workflows, integrations, and logic in response to account activity. |
| 10 | + |
| 11 | + |
| 12 | + |
| 13 | +Event subscriptions allow you to receive messages when events occur across your Cloudflare account. Cloudflare products can publish structured events to a queue, which you can then consume with [Workers](/workers/) or [pull via HTTP from anywhere](/queues/configuration/pull-consumers/). |
| 14 | + |
| 15 | +To create a subscription, use the dashboard or [Wrangler](/workers/wrangler/commands/#subscription-create): |
| 16 | + |
| 17 | +```bash |
| 18 | +npx wrangler queues subscription create my-queue --source r2 --events bucket.created |
| 19 | +``` |
| 20 | + |
| 21 | +An event is a structured record of something happening in your Cloudflare account – like a Workers AI batch request being queued, a Worker build completing, or an R2 bucket being created. Events follow a consistent structure: |
| 22 | + |
| 23 | +```json title="Example R2 bucket created event" |
| 24 | +{ |
| 25 | + "type": "cf.r2.bucket.created", |
| 26 | + "source": { |
| 27 | + "type": "r2" |
| 28 | + }, |
| 29 | + "payload": { |
| 30 | + "name": "my-bucket", |
| 31 | + "location": "WNAM" |
| 32 | + }, |
| 33 | + "metadata": { |
| 34 | + "accountId": "f9f79265f388666de8122cfb508d7776", |
| 35 | + "eventTimestamp": "2025-07-28T10:30:00Z" |
| 36 | + } |
| 37 | +} |
| 38 | +``` |
| 39 | + |
| 40 | +Current [event sources](/queues/event-subscriptions/events-schemas/) include [R2](/r2/), [Workers KV](/kv/), [Workers AI](/workers-ai/), [Workers Builds](/workers/ci-cd/builds/), [Vectorize](/vectorize/), [Super Slurper](/r2/data-migration/super-slurper/), and [Workflows](/workflows/). More sources and events are on the way. |
| 41 | + |
| 42 | +For more information on event subscriptions, available events, and how to get started, refer to our [documentation](/queues/event-subscriptions/). |
0 commit comments