Skip to content

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

FieldPurposeGuidance
NameUnique identifier

Short name uniquely identifying the webhook destination.

DescriptionUsage notes

Optional.

MeshExecution graph target

Choose the mesh this webhook will invoke.

IntentEntry point within mesh

Select intent with appropriate input schema.

Mesh version labelVersion snapshot targeting

The label of the version to invoke, for example latest or production. Point production webhooks at a label, not the draft.

Handler

FieldPurposeGuidance
Runs asHandler type

Optional. JavaScript: an ES module that exports handle(request, config). WebAssembly component: a .wasm component implementing the webhook-handler world. Requests go to the mesh as they arrive; a handler can check each one first, reject it, or rewrite its body.

ScriptJavaScript source

Runs with no network access, timers or Node modules. Up to 100 KB.

ComponentWebAssembly binary

A .wasm file. Up to 5 MB.

ConfigValues the handler reads

Name and value pairs available to the handler as config.get(name). Put secrets such as signing keys here rather than in the script.

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

  1. External system issues POST with JSON body matching the Intent input schema.
  2. Server creates a Conversation and a new top level Request tied to the Intent Agent Version.
  3. The HTTP response returns a lightweight acknowledgement.
  4. 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): alg is sha1, sha256 or sha512.
  • request.verifySignature(alg, publicKey, signedData, signature): alg is ed25519, ecdsa-p256-sha256, rsa-pkcs1-sha256 or rsa-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:

ConcernMitigation
URL GuessingGenerated key is high entropy; treat it as a secret. Do not expose in public docs or client side code.
Replay or floodOptionally 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 inputEnsure 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 injectionKeep the input schema minimal. Avoid allowing large free form instruction fields unless necessary.
Extraneous dataReject 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:

  1. Create destination pointing to staging label.
  2. Send test events; validate outcomes.
  3. Reconfigure (or recreate) destination to point to prod once 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.