See llms.txt for all machine-readable content.

Back to Templates

Deduplicate webhook enquiries with data tables and Telegram notifications

Quick overview

This workflow receives enquiries via a webhook, deduplicates repeated submissions using an idempotency key stored in an n8n Data Table, and processes accepted enquiries with keyword-based classification and Telegram notifications, automatically retrying failed processing on a schedule.

How it works

  1. Receives an enquiry via a POST webhook and loads configurable settings like required fields, deduplication window, and retry limits.
  2. Validates the request body and immediately replies with HTTP 422 if required fields are missing.
  3. Builds an idempotency key from the Idempotency-Key/X-Request-Id headers or a SHA-256 hash of a normalized request body, then checks an n8n Data Table for a recent matching record.
  4. Responds with HTTP 200 for duplicates, otherwise logs the enquiry as “received” in the Data Table and returns HTTP 202 accepted (with a race-condition guard that keeps only the earliest copy).
  5. Loads the saved payload, classifies it into priority and category based on configured keywords, and sends a formatted message to Telegram.
  6. Marks the Data Table row as “done” on success, or records the error, increments attempt count, and sets the row to “failed” or “dead” (with a Telegram alert) when max retries is reached.
  7. Runs every 15 minutes to find “received”/“failed” rows that have waited long enough and retries the processing path until they succeed or become dead letters.

Setup

  1. Create (or choose) an n8n Data Table and set its name in Config, ensuring it includes fields for idempotencyKey, keySource, status, attempts, payload, lastError, category, priority, and processedAt.
  2. Add a Telegram credential and set the target Telegram chat ID in Config for both the main notification and dead-letter alert.
  3. Configure required fields, idempotency header names, keyword lists, dedupe window, retry interval, and max attempts in the Config step.
  4. Activate the workflow, copy the production webhook URL for the “enquiry-intake” path, and configure your form/app to POST enquiries to it (optionally sending an Idempotency-Key header).