POST. Send JSON to our endpoint, and Definite will execute your block immediately with your data and environment variables. This enables real-time pipelines for events like signups, payments, orders, alerts, and more.
How it works (at a glance)
1
Send a POST to the Definite webhook endpoint with your block ID and JSON payload.
2
Authenticate using a bearer token or request token.
3
Inject & merge: Your JSON is injected as
WEBHOOK_DATA and any env vars are merged into the block’s runtime.4
Execute: Definite runs the block (asynchronously under the hood) with the provided data.
5
Respond: You get a response with execution metadata and (when applicable) results or error details.
Endpoint
POST/v2/webhook/blocks/{block_id}/executeWhere
{block_id} is the UUID of the block to execute.
Authentication
You can authenticate in either of the following ways:-
Bearer token (recommended)
-
Request token in body
API key format:
{user_id}-{api_key_suffix}
Request Body
Data injection & merging
- The
dataobject is injected as a JSON string into theWEBHOOK_DATAenvironment variable. - Environment variables are merged with the block’s existing configuration (see precedence below).
Environment Variable Precedence
When runtime variables are merged, later items override earlier ones:- Block’s saved environment variables
WEBHOOK_DATA(built from requestdata)environment_variables(top-level in the request)python.environment_variables(language-specific overrides)
Execution & Response
SuccessNote: Execution is asynchronous under the hood, but the HTTP response includes enough metadata for you to trace or poll results if needed.
Accessing webhook data inside a Python block
Examples
Basic callCommon use cases
- Event processing: payments, signups, order lifecycle events
- Streaming ingestion: telemetry, IoT, monitoring alerts
- Workflow automation: trigger transformations or enrichment on external events
- Third-party callbacks: process responses from external integrations
Best practices
- Use bearer auth in the
Authorizationheader where possible. - Keep payloads small and focused; put only what the block needs.
- Include an idempotency key (e.g., in
data.request_id) if your sender may retry. - Separate secrets from data: pass secrets via
environment_variables, not indata. - Log execution_id from responses to trace runs in Definite.
Troubleshooting
- 401 Unauthorized: Check API key format and header vs. request token usage.
- 403 Forbidden: Ensure the API key has access to the target block.
- 400 Bad Request: Validate JSON structure; ensure
datais valid JSON if provided. - 5xx errors: Temporary issue—retry with exponential backoff; include an idempotency key.
Summary
Definite webhooks connect your external events to live data processing. Send aPOST with JSON, we inject it into the block runtime, merge your environment variables, execute the block, and return execution metadata so you can trace outcomes—all with a single, simple integration.
