# Webhooks

Webhooks are event-triggered HTTP callbacks that notify another application when something happens.

Cloud concept. Updated 2026-10-29. Page: https://blowstack.com/tools/cloud-concepts-hub/webhooks

> A webhook lets an event producer send a request to a registered endpoint instead of requiring the consumer to repeatedly poll for changes. Engineers use webhooks to trigger builds and tests, integrate enterprise applications, and start asynchronous AI workflows, while explicitly handling authentication, retries, and duplicate deliveries.

Practice exams covering Webhooks: [DVA-C02 AWS Certified Developer - Associate](https://blowstack.com/practice-exams/aws-certified-developer-associate), [DOP-C02 AWS Certified DevOps Engineer - Professional](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional), [AIP-C01 AWS Certified Generative AI Developer - Professional](https://blowstack.com/practice-exams/aws-certified-generative-ai-developer-professional).

## 6 key aspects of Webhooks

Reliable webhooks combine selective event delivery with authenticated requests, durable asynchronous processing, idempotency, and controlled execution.

1. **Event-driven HTTP delivery**: The producer calls a registered endpoint when a selected event occurs, reducing the need for frequent polling. The receiver must expose an endpoint reachable by the producer and understand its event contract.
2. **Selective automation triggers**: Filter by event type, repository, branch, or other supported attributes to start only the intended builds or workflows. Check for overlapping pull-request and push triggers that could execute the same work twice.
3. **Authenticated and validated requests**: Verify the producer's signature or other supported credentials before trusting an event, and validate its schema and size. Protect signing secrets and apply replay defenses appropriate to the producer's protocol.
4. **Fast acknowledgment with durable handoff**: Persist or enqueue accepted events before returning success, then perform slow work asynchronously. An HTTP acknowledgment should not be mistaken for confirmation that a build, test suite, or AI task finished.
5. **Idempotency and failure recovery**: Expect duplicate deliveries and potentially missing or out-of-order events. Deduplicate using stable identifiers, retry transient failures, and provide dead-letter handling and reconciliation for important workflows.
6. **Controlled execution of untrusted input**: Repository contributions and enterprise event payloads can contain hostile code or text. Isolate builds, restrict permissions, and ensure AI-generated actions remain subject to application authorization and validation.

## Cloud services for Webhooks

For CI/CD, CodeBuild can consume supported repository webhook events directly and run filtered build or test jobs. For custom enterprise integrations, API Gateway exposes the endpoint and Lambda validates the request before durably handing off work. EventBridge routes normalized events to interested consumers, while SQS buffers work and supports controlled retries. A downstream worker can call Amazon Bedrock for an AI task and update the originating application through its API. Keep webhook acknowledgment separate from workflow completion, and carry event identifiers through the components for deduplication, tracing, and failure investigation.

- **[AWS CodeBuild](https://blowstack.com/tools/cloud-services-hub/aws-codebuild)**: Uses repository webhooks to start builds and tests for supported source providers. Webhook filter groups select relevant events and branches; repository rules must separately enforce required checks before merging.
- **[Amazon API Gateway](https://blowstack.com/tools/cloud-services-hub/amazon-api-gateway)**: Provides an HTTPS entry point for custom webhook integrations and routes requests to backend handlers. Configure throttling and request handling appropriately, and preserve the request representation needed for signature verification.
- **[AWS Lambda](https://blowstack.com/tools/cloud-services-hub/aws-lambda)**: Runs webhook handlers that authenticate requests, validate payloads, and hand events to downstream services. Keep the request path short and use least-privilege execution roles.
- **[Amazon EventBridge](https://blowstack.com/tools/cloud-services-hub/amazon-eventbridge)**: Routes normalized webhook events to downstream targets using event patterns. EventBridge API Destinations can also send events to external HTTPS endpoints; an event bus is not itself a general-purpose public webhook receiver.
- **[Amazon Bedrock](https://blowstack.com/tools/cloud-services-hub/amazon-bedrock)**: Provides model inference for downstream tasks such as summarizing incoming tickets or drafting responses. Invoke it from an authorized worker after webhook validation rather than treating the model service as the webhook receiver.

## Webhooks exam questions

Real practice exam questions on Webhooks, with the correct answer and its explanation.

### Question 1 (DVA-C02)

**Question:**

An onboarding application uses an AWS Lambda function to submit identity-verification jobs to an external provider. The provider returns HTTP 202 with a verification ID within 1 second, but verification takes several minutes. The provider supports a job-status API and can send signed HTTPS completion notifications to a configured URL.

The application must return a pending status to the user promptly and mark the identity as verified only after the provider reports a successful verification. Application code must not repeatedly query the provider or keep the submission request open while verification runs.

Which implementation meets these requirements?

**Correct answer:** Store the verification ID with a pending status. Configure the provider to send completion notifications to an Amazon API Gateway endpoint backed by Lambda. Validate the notification signature, correlate the verification ID, and mark the identity as verified only for a successful completion event.

**Explanation:** This webhook-based design receives the provider's eventual result independently of the submission request. Signature validation authenticates the notification, and the verification ID associates the result with the correct pending application. Neither polling nor a long-lived submission request is required.

### Question 2 (AIP-C01)

**Question:**

A company adds AI-generated marketing copy to its multi-tenant product-management application. A third-party generative AI service processes requests asynchronously and sends completion callbacks to an Amazon API Gateway endpoint backed by AWS Lambda.

The Lambda handler already verifies the provider's HMAC signature over the original request body. Each callback contains a globally unique, immutable provider job ID and customer-supplied passthrough metadata, including tenantId and productId. The provider signs the entire callback but does not validate the metadata. Customers can choose arbitrary metadata values when requesting generation.

During each authorized job submission, the application's backend stores the returned provider job ID with the authenticated tenant ID and authorized product version. These records cannot be modified by customers. All tenants use the same provider integration and signing secret.

A security review finds that the callback handler currently uses tenantId and productId from the signed metadata to select which product receives the generated copy. The company must prevent a customer from causing generated content to be written to another tenant's product while retaining the asynchronous integration.

Which change meets this requirement?

**Correct answer:** After verifying the signature, use the provider job ID to retrieve the backend's stored job record. Derive the destination tenant and product version exclusively from that record, and reject callbacks without a matching record.

**Explanation:** The stored record binds the provider's immutable job ID to the tenant and product version authorized during submission. Looking up that binding prevents customer-controlled metadata from selecting another tenant's resource. Signature verification still authenticates the callback, while the trusted record establishes its authorized destination.

### Question 3 (DOP-C02)

**Question:**

A company maintains an open-source application in GitHub. An AWS CodeBuild webhook automatically runs unit tests when contributors open or update pull requests targeting main, including pull requests from forks. Contributors can modify application code, test scripts, and the buildspec. The tests require no AWS API access, Docker privileged mode, or private network connectivity.

The project currently uses the same service role as the production release project. This role can retrieve deployment secrets and update production resources. The company requires pull request tests to continue running automatically without maintainer approval, but contributor-controlled code must not be able to obtain deployment secrets, modify production, or start builds with production permissions. The production release workflow must retain its existing capabilities.

Which solution best meets these requirements?

**Correct answer:** Use a separate pull request project with a dedicated service role that permits only required build logging and reporting and cannot access production, retrieve deployment secrets, assume privileged roles, pass roles, or start release builds. Disable privileged mode and omit private-network access and deployment secrets. Keep production permissions exclusively in the release project, which is invoked only through the trusted post-merge release workflow.

**Explanation:** Separate projects and execution roles establish a permissions boundary between untrusted pull request code and trusted release operations. The pull request project retains automatic testing but has neither production credentials nor a route to privileged builds. The release project keeps the permissions needed by the trusted release workflow.

## Practice Webhooks in a full exam

Questions on Webhooks in each practice exam, with every answer option and an explanation for each:

- [AIP-C01](https://blowstack.com/practice-exams/aws-certified-generative-ai-developer-professional): 3 questions
- [DOP-C02](https://blowstack.com/practice-exams/aws-certified-devops-engineer-professional): 3 questions
- [DVA-C02](https://blowstack.com/practice-exams/aws-certified-developer-associate): 2 questions

## What is Webhooks

A webhook is an integration pattern in which an application sends an HTTP request to a configured callback URL when a selected event occurs. The request commonly uses HTTPS POST and contains a JSON payload describing the event, its identifier, and relevant resources. Unlike polling, where a consumer repeatedly asks whether anything changed, a webhook pushes a notification when the producer detects a change. This can reduce unnecessary requests and shorten the time between an event and its processing.

In CI/CD, a source repository can send webhook events when developers open or update pull requests or merge code. A build service can filter these events and run compilation, unit tests, security checks, or integration tests. For example, AWS CodeBuild supports webhook-triggered builds for supported repository providers. Configure filters for the intended event types and branches rather than building on every repository action. A merge may be represented by a pull-request-merged event or by a push to the destination branch, depending on the provider and integration. Selecting overlapping triggers can cause duplicate builds.

Starting a build is not the same as enforcing a merge gate. Publish test results through the repository integration and configure branch protection or repository rules to require the appropriate checks. Treat code from untrusted pull requests as potentially hostile: it can change build scripts and attempt to extract credentials. Use restricted build roles, isolate execution, and avoid exposing deployment secrets to untrusted contributions.

For enterprise integrations, an HTTPS endpoint can receive events from a ticketing system, customer relationship management application, or document platform. An API gateway routes requests to a webhook handler, which validates the sender, checks the payload, and accepts work for asynchronous processing. For example, Amazon API Gateway and AWS Lambda can receive a ticket-created event, then publish a normalized event to Amazon EventBridge or place work on Amazon SQS. A downstream worker can invoke a generative AI model to summarize the ticket or draft a response, then update the originating application through its API.

Webhook handlers should return a successful response promptly, but only after the event has been durably accepted for processing. Performing a long build or model invocation before responding risks exceeding the sender's timeout. A successful acknowledgment usually means the notification was accepted, not that the business workflow completed. Track completion separately and design status updates so they do not create notification loops.

Security depends on the producer's supported authentication mechanism. When signatures are available, verify them using the documented algorithm and the original request bytes; parsing and reserializing JSON can invalidate a signature. Use timestamps and delivery identifiers to help reject replays, rotate signing secrets, and enforce payload limits. HTTPS protects transport but does not, by itself, prove that the caller is the expected application. In AI workflows, treat event text as untrusted input and do not allow embedded instructions to grant tool access or bypass authorization.

Webhooks do not inherently guarantee delivery, ordering, or exactly-once processing. Retry policies vary by sender, and timeouts can cause redelivery even when processing succeeded. Make consumers idempotent using a stable event identifier, use bounded retries and dead-letter handling downstream, and monitor delivery failures and processing lag. For critical integrations, provide reconciliation against the source system because receiver-side queues cannot recover an event that never arrived. Webhooks provide lightweight connectivity, but they are not a substitute for a durable message broker or a complete workflow engine.

## Learn Webhooks in lessons

2 short lessons on Webhooks in 2 certification courses.

- AIP-C01: Webhooks: reliable asynchronous event intake (Premium), https://app.blowstack.com/lessons/webhooks-reliable-asynchronous-event-intake-aip-c01
- DOP-C02: Webhooks: repository event triggers for builds and tests (Premium), https://app.blowstack.com/lessons/webhooks-repository-event-triggers-for-builds-and-tests-dop-c02
