BackIntegrations and automations
Integrations and automations

Receiving Webhooks and Exposing Public APIs in Blanca's Builder

Learn to manage webhooks and expose public APIs in Blanca's Builder. This guide covers setup, signature verification, input validation, and rate limiting.

Blanca's Builder provides powerful capabilities to extend your application's functionality by integrating with external services or offering data programmatically. This article guides you through setting up webhook endpoints and exposing read-only public APIs within your project.

Last updated: 2026-06-28

Understanding Webhooks and Public APIs

Webhooks are automated messages sent from applications when a specific event occurs, enabling real-time data exchange without continuous polling. They are essentially user-defined HTTP callbacks, often used for integrations, notifications, and triggering automated workflows.

Public APIs, on the other hand, allow external applications to programmatically access and interact with your project's data or functionality. In Blanca's Builder, you can define read-only public API endpoints to securely expose curated information to your partners or other services, typically under the `/api/public/` path.

Setting Up Webhook Endpoints (/api/public/)

To add a webhook endpoint, navigate to the 'API & Integrations' section in your Blanca's Builder project. You'll specify a unique path under `/api/public/` (e.g., `/api/public/my-webhook`), choose the HTTP method (usually POST), and define the logic that will execute upon receiving a request. This logic is where you'll process the incoming data.

Blanca's Builder encourages a secure-by-default approach. For webhooks, it's crucial to implement signature verification to ensure that incoming requests originate from a trusted source and haven't been tampered with. Most services that send webhooks provide a secret key and sign their payloads. Your endpoint logic should recompute the signature using your secret and compare it to the signature in the request headers (e.g., `X-Hub-Signature`, `X-Webhook-Signature`). If they don't match, the request should be rejected.

Input Validation with Zod

After verifying the signature, the next critical step is to validate the incoming data from the webhook. Blanca's Builder projects can leverage Zod, a TypeScript-first schema declaration and validation library, to ensure that the payload conforms to your expected structure and data types. Define a Zod schema that precisely matches the expected structure of your webhook payload.

Using Zod for validation helps prevent common issues like unexpected data formats, missing fields, or incorrect types, which can lead to runtime errors or security vulnerabilities. If validation fails, you should return a `400 Bad Request` status code with a descriptive error message, indicating to the sender that their payload was malformed.

Rate Limiting and Read-Only Public APIs

To protect your application from abuse and ensure fair usage, Blanca's Builder allows you to apply rate limiting to your public API endpoints. This mechanism restricts the number of requests an individual client can make within a specified time frame. Configure rate limits based on factors like IP address, API key, or other identifiable attributes of the requesting client to prevent denial-of-service attacks or excessive resource consumption.

When exposing public APIs, it's often best practice to keep them read-only, especially if they are designed for consuming data rather than modifying it. This minimizes security risks and simplifies your API's design. Ensure that your public endpoints only allow `GET` requests and do not implement any data creation, update, or deletion logic unless explicitly required and secured with robust authentication and authorization mechanisms.

Canonical: https://blancasbuilder.com/knowledge/integrations-and-automations/webhooks-and-public-apis · Blanca's Builder