See llms.txt for all machine-readable content.

Back to Templates

Create Krevaya review drafts from webhook events without duplicates

Quick overview

This workflow receives authenticated webhook events and creates one Krevaya “draft for review” per requested social platform, using an Idempotency-Key to prevent duplicates, then returns per-platform results and an overall HTTP status to the caller.

How it works

  1. Receives a POST webhook request secured with header authentication containing a JSON content event.
  2. Validates the payload fields (including event_id, revision, body, and platforms), applies default platforms when needed, and rejects disallowed platforms with a 422 response.
  3. Fetches available brands from the Krevaya Automation API and matches the configured brand by name or ID.
  4. Builds one draft request per platform and generates a stable Idempotency-Key from the event ID, revision, brand ID, and platform.
  5. Creates Krevaya “drafts for review” via the Krevaya Automation API, where repeated submissions with the same Idempotency-Key return the original draft instead of creating a new one.
  6. Summarizes all platform outcomes (created, already created, rejected, retry later, or configuration error) and responds to the webhook with a JSON report and an HTTP status (201/200/422/503/502).

Setup

  1. Create a Krevaya API key with the “Drafts for review” preset and add it to n8n as an HTTP Header Auth credential for requests to https://api.krevaya.com.
  2. Create a separate n8n Header Auth credential for the incoming webhook secret and configure your source app to send that header when calling the webhook URL.
  3. Update the workflow configuration values for brand (name or ID), allowed_platforms, and default_platforms to match your Krevaya setup.
  4. Ensure your Krevaya brand’s publishing settings keep drafts in review (auto-approval disabled) so drafts wait for manual approval.

Requirements

  • A Krevaya account on a paid plan, with an API key created from the Drafts for review preset
  • Two n8n Header Auth credentials: one holding the Krevaya key (header name X-API-Key), one holding the webhook secret
  • A source app that can send an authenticated JSON POST request

Customization

  • Change the accepted fields in the Validate event node
  • Change the allowed and default platforms in the Set workflow configuration node
  • Increase revision when the content of an event changes