Make.com Custom HTTP Webhooks Integration

Make.com Custom HTTP Webhooks Integration

November 3, 2026•12 MIN READ
Kanat NazarovBY Kanat Nazarov

Make.com Custom HTTP Webhooks: Building a Fault-Tolerant AI Publishing Pipeline

A webhook integration is easy to demonstrate and surprisingly difficult to operate. The basic flow appears simple: Sanity emits an event, Make.com receives it through a custom HTTP webhook, an AI service transforms the content, and a Next.js application publishes the result. In production, that chain becomes a distributed system with independent queues, retries, timeouts, authentication mechanisms, and failure domains.

The important architectural question is not whether Make.com can call an API. It can. The question is whether an event can be delivered exactly once from the perspective of the business, even when the sender retries, the automation scenario times out, the AI provider returns an invalid response, or the destination database is temporarily unavailable.

This article presents a robust design for Make.com custom HTTP webhooks in a Sanity-driven automated AI publishing pipeline. The design applies equally to editorial systems, ecommerce enrichment, support automation, internal operations, and broader AI workflow automation full stack implementations.

The Architecture: Webhooks Are Ingress, Not a Complete Integration

A custom HTTP webhook in Make.com is an ingress endpoint. It accepts an HTTP request, parses the payload, and starts a scenario. It is not automatically a durable event log, a transaction coordinator, or an idempotency layer.

A practical architecture separates the system into five responsibilities:

  • Content source: Sanity stores editorial documents and emits webhook events.
  • Ingress and orchestration: Make.com receives events and coordinates external API calls.
  • Transformation: An AI service generates metadata, summaries, translations, structured fields, or publication variants.
  • System of record: Sanity or a separate application database stores workflow state and generated artifacts.
  • Delivery layer: Next.js 15 serves published content through low-latency APIs, caching, and incremental revalidation.

The event path should be explicit:

Sanity mutation
    -> authenticated Make.com custom HTTP webhook
    -> event validation and deduplication
    -> AI transformation
    -> schema validation
    -> Sanity transaction or application API
    -> cache revalidation
    -> Next.js 15 delivery

The webhook payload should contain enough information to retrieve authoritative state, but it should not be treated as the complete source of truth. A useful payload includes a document identifier, document type, revision or updated timestamp, operation type, and a correlation identifier. The automation should then fetch the current document from Sanity rather than trusting potentially incomplete event data.

This distinction matters when several edits occur rapidly. Event A may be delivered after Event B due to retry timing, while the Sanity document has already advanced to revision B. Reading the current source document before processing prevents stale event contents from overwriting newer editorial changes.

Designing Make.com Custom HTTP Webhooks for Reliable Ingress

Authentication and request validation

The webhook URL itself must not be considered a sufficient secret. Treat it as a credential that can leak through logs, browser history, screenshots, or scenario exports. Use an additional authentication mechanism where possible:

  • Require a static bearer token or HMAC signature in a request header.
  • Restrict the sender by network policy if the platform supports it.
  • Rotate webhook credentials without changing the downstream contract.
  • Reject requests with unsupported content types or oversized bodies.
  • Keep the raw request identifier for incident correlation.

For HMAC authentication, the sender signs the exact request body. The receiver computes the same digest and compares it using a constant-time comparison. A timestamp prevents replay attacks.

import crypto from "node:crypto";

export function verifySignature(
  body: string,
  timestamp: string,
  signature: string,
  secret: string,
  now = Date.now()
): boolean {
  const age = Math.abs(now - Number(timestamp)) / 1000;
  if (!Number.isFinite(age) || age > 300) return false;

  const message = `${timestamp}.${body}`;
  const expected = crypto
    .createHmac("sha256", secret)
    .update(message)
    .digest("hex");

  const actualBuffer = Buffer.from(signature, "utf8");
  const expectedBuffer = Buffer.from(expected, "utf8");
  return actualBuffer.length === expectedBuffer.length &&
    crypto.timingSafeEqual(actualBuffer, expectedBuffer);
}

Sanity webhook automation Make.com scenarios frequently start with a platform-managed webhook URL. If the sender cannot produce a signature, add a long random token in a header or query parameter and validate it in the first scenario module. Avoid embedding tokens in document fields or URLs that are likely to be copied into analytics systems.

Acknowledge quickly, process asynchronously

Webhook providers commonly retry when they do not receive a successful response within a short period. AI calls, database writes, and cache invalidation are all poor operations to perform before acknowledgment. They have variable latency and can exceed the sender's timeout.

The ingress layer should validate the minimum contract and return a success response quickly. The expensive workflow should run asynchronously. Within Make.com, this generally means using the webhook as the trigger and configuring scenario processing so incoming requests are not blocked by unrelated downstream work. For higher throughput or stronger durability requirements, place a small application-owned ingress service in front of Make.com. That service can persist the event to a database or queue, return a response, and invoke Make.com after durable acceptance.

The choice depends on failure tolerance:

  • Direct Sanity to Make.com: fastest to implement, adequate for low-volume workflows, but dependent on Make.com execution and webhook queue behavior.
  • Sanity to an ingress API to Make.com: more code, but provides durable receipt, custom replay, rate limiting, and independent observability.
  • Sanity to a message broker to workers: appropriate for high volume, strict ordering requirements, or multiple consumers.

Do not confuse a successful HTTP response with successful business processing. Record separate states for received, accepted, processing, completed, failed, and discarded.

State Synchronization and Idempotent Processing

Distributed systems cannot reliably use network delivery as a transaction boundary. Sanity may send the same event twice. Make.com may retry a module. An AI provider may complete a request while the client sees a timeout. A scenario may be manually replayed after an operator has already fixed the original failure.

The solution is an idempotency key backed by durable state. A useful key is derived from the source document identifier and source revision:

sanity:{documentId}:{revisionId}:ai-enrichment:v1

If Sanity does not expose a stable revision identifier in the webhook payload, store the last processed updated timestamp or content hash and retrieve the current document before deciding whether work is necessary. Do not use only the document ID, because that would suppress legitimate future updates.

A processing record can be modeled as follows:

create table automation_runs (
  id uuid primary key,
  idempotency_key text not null unique,
  source_document_id text not null,
  source_revision text,
  status text not null check (status in (
    'received', 'processing', 'completed', 'failed', 'dead_letter'
  )),
  attempt_count integer not null default 0,
  input_hash text not null,
  output_hash text,
  last_error text,
  created_at timestamptz not null default now(),
  updated_at timestamptz not null default now()
);

The unique constraint is the critical invariant. Two workers can race to process the same event, but only one can claim the idempotency key. The winner performs the work; the loser reads the existing state and exits safely.

For Sanity itself, use a workflow field or dedicated automation document to record processing state. A transaction is preferable to several independent mutations. For example, the final update can write the generated fields, source revision, model version, and processing timestamp together. If the source revision no longer matches the revision processed by the worker, reject the update or mark it as stale rather than overwriting newer editorial content.

A compare-and-set rule looks like this conceptually:

if (currentDocument.sourceRevision !== processedRevision) {
  return { status: "stale", action: "discard-output" };
}

await writeGeneratedFields({
  expectedRevision: processedRevision,
  generatedBy: modelVersion,
  generatedAt: new Date().toISOString(),
});

This is optimistic concurrency control. It avoids global locks while protecting content correctness.

Constructing the Automated AI Publishing Pipeline

An automated AI publishing pipeline should not treat the model response as trusted application data. The model is an untrusted, probabilistic dependency. It can return malformed JSON, omit required fields, exceed token budgets, produce unsafe claims, or generate output that violates editorial rules.

The pipeline should use a staged contract:

  1. Fetch the current Sanity document.
  2. Normalize and bound the input fields.
  3. Build a versioned prompt or structured model request.
  4. Call the AI provider with a timeout and retry policy.
  5. Parse the response as structured data.
  6. Validate against a runtime schema.
  7. Apply deterministic business rules.
  8. Persist only if the source revision is still current.
  9. Revalidate the relevant Next.js cache path or tag.

A schema validator such as Zod makes the boundary explicit:

import { z } from "zod";

const GeneratedContent = z.object({
  title: z.string().min(10).max(120),
  description: z.string().min(40).max(320),
  tags: z.array(z.string().min(1).max(40)).max(12),
  confidence: z.number().min(0).max(1),
});

const result = GeneratedContent.safeParse(modelResponse);
if (!result.success) {
  throw new Error("AI output failed the publishing schema");
}

Retries must distinguish transient failures from permanent failures. Retry network resets, HTTP 429 responses, and selected 5xx responses with exponential backoff and jitter. Do not retry invalid credentials, schema violations, policy blocks, or deterministic validation failures without changing the input.

const delay = Math.min(30_000, 500 * 2 ** attempt);
const jitter = Math.floor(Math.random() * 250);
await new Promise((resolve) => setTimeout(resolve, delay + jitter));

Model calls also require cost controls. Set maximum output tokens, enforce input length limits, record the model and prompt version, and track token usage. A model upgrade can change output shape and editorial quality even when the code has not changed. Version generated artifacts so operators can identify which prompt and model produced a field.

Human review should be a first-class state, not an exception path. A practical state machine is:

DRAFT -> QUEUED -> GENERATING -> REVIEW_REQUIRED -> PUBLISHED
                         |              |
                         v              v
                       FAILED         REJECTED

Low-risk metadata can publish automatically when confidence and validation thresholds are met. Claims, regulated content, or customer-facing copy may require manual approval. This policy belongs in deterministic application logic rather than in the prompt.

Next.js 15, APIs, and Operational Boundaries

Next.js 15 should remain a delivery and application boundary, not a hidden queue for long-running Make.com executions. Route handlers can expose low-latency APIs for status, manual approval, and replay requests, but they should not depend on serverless execution limits for multi-minute AI jobs.

Use server-side credentials for Sanity and AI providers. The browser should receive only published content and narrowly scoped workflow actions. For a status endpoint, return an automation run identifier, current state, timestamps, and a safe error category. Do not expose prompts, tokens, raw provider responses, or internal stack traces.

Cache invalidation is part of the write protocol. After a successful Sanity mutation, trigger revalidation for the affected path or tag. Do not revalidate after a failed write, because that creates a false signal that the new content is available.

import { revalidateTag } from "next/cache";

export async function markPublished(slug: string) {
  await writeToSanity();
  revalidateTag(`article:${slug}`, "max");
}

The exact caching strategy depends on hosting and Next.js configuration, but the invariant is universal: persistence must succeed before cache invalidation is emitted. If revalidation fails after persistence, enqueue a revalidation retry rather than rolling back a successful content write.

Production Protocols & Implementation Checklist

  • Define a versioned webhook contract with document ID, operation, revision, timestamp, and correlation ID.
  • Authenticate every request with a rotating token or HMAC signature.
  • Reject stale timestamps and replayed event IDs.
  • Return quickly from ingress and move expensive work to asynchronous execution.
  • Store an idempotency key with a unique database constraint.
  • Fetch authoritative Sanity state before generating content.
  • Use optimistic concurrency checks before writing generated fields.
  • Validate AI output with a runtime schema and deterministic content policies.
  • Apply bounded retries with exponential backoff and jitter.
  • Route exhausted failures to a dead-letter state with operator replay support.
  • Record model, prompt, input hash, output hash, latency, token usage, and cost.
  • Revalidate Next.js content only after the source write succeeds.
  • Keep secrets out of Make.com logs, request URLs, prompts, and client responses.

A minimal Make.com scenario should therefore be composed around explicit gates: webhook trigger, authentication check, deduplication lookup, Sanity fetch, AI request, schema or rule validation, Sanity mutation, and notification or dead-letter handling. Each module should have a named error route. Silent continuation is dangerous because it converts a known failure into partial data.

Observability, Capacity, and Failure Testing

Measure the system as a distributed workflow rather than as a single API call. The most useful metrics include:

  • Webhook acceptance rate and HTTP response latency.
  • Event-to-completion latency at p50, p95, and p99.
  • Duplicate event rate and idempotency suppression count.
  • AI provider error rate, timeout rate, token usage, and cost per document.
  • Schema validation failure rate.
  • Sanity mutation conflict rate.
  • Queue depth, retry count, and dead-letter volume.
  • Cache revalidation success rate.
  • Percentage of content requiring human review.

Every log line should include a correlation ID, source document ID, idempotency key, scenario or run ID, and model version. Structured logs are more useful than narrative messages because they support aggregation across Sanity, Make.com, application APIs, and provider dashboards.

Failure testing should be deliberate. Send duplicate webhooks, reorder revisions, terminate the process after the AI response but before persistence, return malformed model output, simulate Sanity conflicts, and force cache invalidation failures. The expected result is not that every operation succeeds. The expected result is that failures are visible, recoverable, and non-destructive.

Load testing should include burst behavior. Editorial teams often publish multiple documents at once, and a webhook system that performs well at one request per minute may collapse under a bulk import. Rate-limit AI calls, cap concurrent scenario executions, and define backpressure behavior. If Make.com execution limits become the bottleneck, move durable queueing and high-volume workers into an application-owned service while retaining Make.com for low-code coordination and notifications.

Conclusion

Make.com custom HTTP webhooks are effective integration primitives, but production reliability comes from the surrounding architecture. Treat webhook delivery as at-least-once, fetch Sanity as the authoritative state, identify work with durable idempotency keys, and protect writes with optimistic concurrency. Treat AI output as untrusted input that requires schema validation, bounded retries, cost controls, and review policies.

For an automated AI publishing pipeline, the essential invariants are straightforward: no event is silently lost, no duplicate event causes duplicate business effects, no stale revision overwrites newer content, and no cache claims success before persistence succeeds. Monitor latency, retries, conflicts, validation failures, cost, and dead-letter volume. With those controls in place, Sanity webhook automation Make.com can support a dependable AI workflow automation full stack architecture rather than becoming another opaque source of production failures.

Leave a log note