Webhook Destinations
Webhook Destinations allow external systems to trigger a Mesh Intent by making a simple HTTP POST to a unique URL. They are ideal for event driven or scheduled automation scenarios where you want a Mesh to react autonomously without a human manually starting a conversation.
Quick Reference
Configuration
| Field | Purpose | Guidance |
|---|---|---|
| Name | Unique identifier | Short name uniquely identifying the webhook destination. |
| Description | Usage notes | Optional. |
| Mesh | Execution graph target | Choose the mesh this webhook will invoke. |
| Intent | Entry point within mesh | Select intent with appropriate input schema. |
| Mesh version label | Version snapshot targeting | The label of the version to invoke, for example |
Handler
| Field | Purpose | Guidance |
|---|---|---|
| Runs as | Handler type | Optional. JavaScript: an ES module that exports |
| Script | JavaScript source | Runs with no network access, timers or Node modules. Up to 100 KB. |
| Component | WebAssembly binary | A |
| Config | Values the handler reads | Name and value pairs available to the handler as |
Overview
When you create a Webhook Destination you create a new, unique URL that can be used to invoke a mesh.
The resulting URL looks conceptually like:
https://api.partite.ai/webhooks/<unique-key>Self hosted deployments use your local base URL (for example http://localhost:8080/webhooks/<generated-key>). The caller performs a JSON POST. The body must conform to the Intent input message schema (exact field names, required fields, types, descriptions leveraged for agent context). If validation fails a 4xx error is returned and no conversation is started.
Execution Flow
- External system issues
POSTwith JSON body matching the Intent input schema. - Server creates a Conversation and a new top level Request tied to the Intent Agent Version.
- The HTTP response returns a lightweight acknowledgement.
- The Mesh processes the Request: agents may call tools, sub agents, transfer control, etc. This happens asynchronously to acknowledging receipt of the request.
Handlers
A handler is a small program that runs on each request before the mesh sees it. Use a handler to verify a signature, reject unwanted events, or rewrite the body into the input schema of the intent.
The handler exports handle(request, config). To accept the request, return nothing. To reject the request, return {status, message}. The sender receives that status and message.
The request object has these methods:
request.method()request.url()request.header(name)request.headers()request.body(): returns bytes.request.setBody(text): replaces the body.request.verifyHmac(alg, key, signedData, expected):algissha1,sha256orsha512.request.verifySignature(alg, publicKey, signedData, signature):algised25519,ecdsa-p256-sha256,rsa-pkcs1-sha256orrsa-pss-sha256.
config.get(key) returns a value from the Config of the handler.
signedData is the list of pieces that the sender signed, in order. Each piece is { tag: "bytes", val: Uint8Array } or { tag: "body" }.
These globals are available: console, TextEncoder, TextDecoder, atob, btoa, URL, URLSearchParams, crypto.getRandomValues, crypto.randomUUID and Buffer. Other Node modules, timers and fetch are not available. The request body limit is 1 MB.
This example checks a GitHub style HMAC signature. It then reduces the body to one field.
export function handle(request, config) {
const header = request.header("X-Hub-Signature-256") ?? "";
const expected = Buffer.from(header.slice(7), "hex");
const key = new TextEncoder().encode(config.get("secret"));
if (!request.verifyHmac("sha256", key, [{ tag: "body" }], expected)) {
return { status: 401, message: "bad signature" };
}
const event = JSON.parse(new TextDecoder().decode(request.body()));
request.setBody(JSON.stringify({ action: event.action }));
}Use Cases
- Event bridging: Forward SaaS webhooks (GitHub issue created, PagerDuty incident, Stripe dispute) into a Mesh for analysis or enrichment.
- Scheduled automation: A cron job hits the destination daily to generate a report (Mesh agents fetch data via MCP tools and synthesize structured output).
- Data ingestion and classification: Low latency classification of incoming items before they enter a pipeline.
- Autonomous follow ups: Trigger a Mesh to draft and send responses, create tickets, or open PRs after external events (ensure separation of capabilities, see Security).
Security Considerations
Webhook Destinations intentionally trade simplicity (just a URL + JSON) for limited built in auth controls:
| Concern | Mitigation |
|---|---|
| URL Guessing | Generated key is high entropy; treat it as a secret. Do not expose in public docs or client side code. |
| Replay or flood | Optionally place an API gateway or reverse proxy in front to rate limit and log. A handler can verify an HMAC or signature before the mesh runs. |
| Untrusted input | Ensure the Intent agent is not simultaneously granted tools that can perform sensitive state changes and access sensitive data (avoid the lethal trifecta). Use a validation or sanitization sub agent via a Call Link before action agents. |
| Prompt injection | Keep the input schema minimal. Avoid allowing large free form instruction fields unless necessary. |
| Extraneous data | Reject unneeded fields early. Schema enforcement keeps the prompt small and reduces opportunity for injection. |
Operational best practices:
- Rotate (regenerate) destination keys if you suspect exposure (delete and recreate the destination).
- Maintain an allowlist of source IP addresses at your edge if feasible.
- Log request IDs and Mesh version label for trace correlation (associate external event ID with Conversation ID).
Versioning Strategy Interaction
Point Webhook Destinations at a Mesh version label (prod, staging) to decouple rollout from external integrations. Workflow:
- Create destination pointing to
staginglabel. - Send test events; validate outcomes.
- Reconfigure (or recreate) destination to point to
prodonce label updated.
Avoid pointing high volume production webhooks to the Draft Mesh unless actively testing. The Draft may change mid processing.
Summary
Webhook Destinations provide a lightweight, structured bridge from external events into your Mesh. By pairing a unique URL with a strongly typed Intent input schema and a labeled Mesh version you gain predictable invocation, safe evolution (via labels) and clear observability. Keep schemas lean, enforce grounding where accuracy matters, and partition agent capabilities to maintain security.