OctiAI

Categories

n8n Workflow Blueprint Prompt — SaaS Trial → CRM Lead Routing

One-shot LLM prompt that produces a deployable, node-by-node n8n workflow spec for trial signups with dedupe, enrichment, scoring, Slack alerts, retries and audit trails.

What You'll Get

How to Use

Provide accurate integration details up front

Before running the prompt, collect the webhook JSON schema, exact CRM API endpoints/credential types, preferred enrichment provider order, and the dedupe key field (e.g., email). The prompt will not fabricate missing critical values — supplying them yields a complete, implementable blueprint.

Works Best With

Best used when you have the core integration variables ready

Prompt Template

## Goal
- Define an operational n8n automation that handles SaaS trial signups → deduplicated CRM lead creation/upsert with enrichment, automated scoring, Slack alerts, and robust error handling so that sales receives qualified leads and failures are auditable.

## Inputs
- Trigger: {{lead_source_trigger}}  
- Target CRM: {{crm_name}}  
- Enrichment providers (ordered preference): {{enrichment_providers}}  
- Slack destination channel: {{slack_channel}}  
- Auth constraints: {{auth_constraints}} (e.g., OAuth2 for CRM, API key for enrichment, webhook secret)  
- Unique dedupe key field: {{dedupe_key_field}} (e.g., email)  
- Required schemas/payloads: provide if available — webhook JSON for signup, CRM create/update fields, enrichment API response examples.  
- Failure policy: on transient errors retry with exponential backoff; on persistent error write to audit store + send Slack alert; for enrichment timeouts continue with partial data and tag lead.  
- Idempotency rule: compute idempotency key as deterministic normalized hash of {{dedupe_key_field}} + source_id.  
- If any of the above critical fields are missing, respond by asking precisely which of these values are missing and do not produce the full blueprint until they are supplied.

## Prompt
Use the following single copy-paste prompt to generate a complete n8n workflow blueprint. The output must be a node-by-node spec suitable for implementation in n8n (nodes, credentials, expressions, data mapping, branching, retries, timeouts, backoff, idempotency, dedupe checks, fallback steps) and must include mapping tables, webhook/API payload schemas, and test payloads.

Prompt to paste into the LLM:
You are an expert n8n workflow engineer. Produce a complete n8n workflow specification that implements SaaS trial signup → CRM lead routing with dedupe, enrichment, scoring, and Slack alerts. Use no magic nodes; every transformation must be explicit. Follow these constraints and output structure exactly.

Context and required values:
- Lead source trigger: {{lead_source_trigger}}
- CRM to upsert: {{crm_name}}
- Enrichment providers (preference order): {{enrichment_providers}}
- Slack channel for alerts: {{slack_channel}}
- Auth constraint summary: {{auth_constraints}}
- Dedupe key field: {{dedupe_key_field}}

Deliverables (create all of these, labelled exactly and in the order listed later under "Output Format"):
1) Overview — business flow and success criteria.
2) Node list (ordered) — for each node include: node type, node name, exact configuration fields, credential type, expressions and JSON where required, conditions/filters, and upstream/downstream connections.
3) Field mapping table(s) — mapping from source webhook fields and enrichment outputs to CRM fields (include data types, normalization rules, and required/optional).
4) Retries/timeouts + dedupe strategy — explicit retry counts, backoff algorithm, timeouts, idempotency key generation algorithm (include precise expression or pseudo-code), CRM search/merge algorithm, and conflict resolution rules.
5) Test payload(s) — at least three test webhook payloads (happy path, duplicate incoming lead, enrichment failure) and expected results per test.

Required node-level details:
- Webhook node: full webhook schema (JSON object), authentication verification (HMAC or secret), sample success code, immediate 200/202 response rules.
- Parse node: explicit field extraction rules and type coercion (dates, numbers, lists).
- Idempotency node: deterministic idempotency key generation expression using normalized {{dedupe_key_field}} and source_id, include algorithm: trim, lowercase, remove punctuation, then sha256.
- CRM lookup node: exact API endpoints or n8n credential type for {{crm_name}}, search query by dedupe key, pagination handling, HTTP request examples (headers, query), and success/failure conditions.
- Branching logic:
  - Path A: CRM found (one or more matches) → merge/update per merge rules.
  - Path B: CRM not found → enrichment → score → create lead.
  - Path C: Multiple matches → escalate to manual review via Slack with quick actions.
- Enrichment nodes: call providers in {{enrichment_providers}} order, with failover; if provider 1 returns 429 or timeout, automatically retry once with backoff then call provider 2. Show request and expected response schema for each provider, and how to map fields.
- Scoring node: deterministic scoring rubric (point values for company size, role seniority, industry match, intent signals). Provide scoring formula and threshold for "sales-ready".
- CRM upsert node: show exact payload to create or update lead in {{crm_name}}, include handling of custom fields, owner assignment, tags, and campaign/source attribution.
- Audit and fallback:
  - On CRM HTTP 5xx or persistent 4xx (e.g., validation error): write full payload + errors to an audit Google Sheet (provide exact column schema) and send detailed Slack alert with link to sheet and suggested manual actions.
  - On enrichment total failure: upsert lead with partial data, set enrichment_status = failed, add enrichment_attempts counter, and notify ops Slack channel.
- Notifications: Slack message payloads for (new sales-ready lead), (duplicate found and merged), (multiple matches requiring review), (audit entry created), with actionable buttons where possible (link to CRM record, review checklist).
- Logging: include an internal audit log node writing to a timestamped JSON blob store (e.g., Google Drive file or S3) containing request/response traces and idempotency key.
- Security: show webhook secret verification expression, credential scopes needed, and rate-limit guard (e.g., throttle node to X reqs/min).

Error handling and retries:
- For transient HTTP failures: retry up to 3 times with exponential backoff (initial 2s, factor 3).
- For enrichment rate limit 429: wait Retry-After header seconds then retry once.
- For permanent validation errors: do not retry; write audit entry and alert Slack.
- For concurrency conflicts on CRM upsert: implement optimistic retry with fresh search before final upsert; if still conflicting, escalate to manual review.

Idempotency & dedupe algorithm:
- Provide pseudo-code and exact n8n expression to compute idempotency_key := sha256(lower(trim(stripPunct(payload.{{dedupe_key_field}}))) + '::' + coalesce(payload.source_id, webhook_id)).
- Describe dedupe search: search CRM by exact idempotency_key custom field; if not indexed, perform search by normalized key then fallback to fuzzy match on email similarity >= 0.95. State merge policy: prefer record with latest lead_score, or if equal prefer most recent activity_date.

Deliver webhook schemas and API payloads:
- Full example webhook JSON for {{lead_source_trigger}} with field types.
- CRM create/update HTTP JSON body example for {{crm_name}} for both create and update paths.
- Enrichment API request/response example for each provider in {{enrichment_providers}}.

Testing:
- Provide 3 test payloads (happy path, duplicate, enrichment timeout) with expected node-by-node outcomes and final CRM state.

Formatting requirements for the LLM output:
- Use exact section order from "Output Format" below.
- Use Markdown headings and code-like blocks for JSON snippets and node configs.
- Number the Node list; for each node include a short "purpose" line.
- Include mapping tables as Markdown tables and include data types and normalization rules.
- Keep responses operator-grade and paste-ready for implementation in n8n.

If any of the required values (CRM API endpoint, webhook JSON schema for {{lead_source_trigger}}, API credential types) are missing, ask precisely which value is missing and stop; do not fabricate values.

Produce the workflow now.

## Output Format
- Output:
  1) Overview
  2) Node list (ordered)
  3) Field mapping table(s)
  4) Retries/timeouts + dedupe strategy
  5) Test payload(s)

## Guardrails
- No “magic nodes”; every transformation and decision must be explicit and show node-level configuration.
- Enforce idempotency: include idempotency key generation and CRM-side lookup before any create.
- Enforce dedupe: primary equality on {{dedupe_key_field}} normalized; secondary fuzzy match threshold 0.95.
- All external calls must include retry/backoff rules and clear fallback behavior.
- Never delete data automatically; merges must create an audit trail and note previous values.
- Sensitive secrets must be referenced only via n8n credentials, never inlined in payload examples.
- Audit trail required for every path that modifies CRM: include timestamp, idempotency_key, upstream_payload, enrichment_results, action_taken, and error if any.

## Examples
- Mini node list excerpt:
  1. Webhook (HTTP in) — purpose: receive signup. Config: path "/webhook/trial-signup", method POST, verify HMAC header X-Signature using credential WebhookSecret. Immediate response: 202 Accepted with body {"status":"received","id":"{{webhook_id}}"}.
  2. Function (normalize) — purpose: compute idempotency_key = sha256(lower(trim(stripPunct(payload.{{dedupe_key_field}}))) + '::' + coalesce(payload.source_id, webhook_id)); output field: idempotency_key.
  3. HTTP Request (CRM search) — purpose: find existing lead by idempotency_key; on 200 with matches route to Merge path else to Enrichment path.

Variables

Usage Notes

Not for

Do not include

n8n Workflow Blueprint Prompt — SaaS Trial → CRM Lead Routing

Convert a verbal or written SaaS trial signup requirements brief into a complete, machine-readable n8n workflow specification (node-by-node), including mapping tables, auth, retries/backoff, branching, error handling, test payloads and audit rules.

Turn this into a working asset in minutes.

Import into Workspace to auto-fill variables, adapt output style, and iterate with OctiAI's prompt editor.

What you'll get

Output format

Markdown

Best used when

Avoid when

Sign in to save, like, or rate this prompt.

Made for

What to fill in

Use the guidance below to complete each placeholder with the right level of detail.

Lead Source Trigger

Provide the key details needed for this variable.

Crm Name

Provide the key details needed for this variable.

Enrichment Providers

Provide the key details needed for this variable.

Slack Channel

Provide the key details needed for this variable.

Auth Constraints

Provide the key details needed for this variable.

Dedupe Key Field

Provide the key details needed for this variable.

Webhook Id

Provide the key details needed for this variable.

Rules

Canonical Examples

Input: Stripe checkout trial signup webhook → HubSpot CRM; enrichment via Clearbit then Hunter; Slack alerts to #sales-leads; dedupe on email; OAuth2 for HubSpot, API keys for enrichment, HMAC webhook secret; webhook id webhook_trial_v1.

Loading result...

Failed to load output.

Overview + ordered node list (Webhook -> Parse -> Normalize/Idempotency -> CRM Search -> Branch (Found/NotFound/Multiple) -> Enrichment (Clearbit→Hunter) with retries -> Scoring -> CRM Upsert -> Audit/Slack/Logging). Includes mapping tables, retry policy, idempotency pseudo-code and exact n8n expression, and 3 test payloads.

Why it works: Provides a complete, node-by-node n8n blueprint for reliably accepting Stripe trial signups, deterministically deduplicating on normalized email, attempting enrichment with Clearbit then Hunter (with failover), scoring leads, upserting into HubSpot via its OAuth2 credential, and producing Slack alerts and audit artifacts. Includes explicit idempotency key expression, retry/backoff rules, and test payloads so engineers can implement in one pass.

Input: Typeform webhook (new response) → Salesforce CRM; enrichment providers FullContact then Clearbit; Slack alerts to #ops-leads; OAuth2 for Salesforce, API keys for enrichments, HMAC webhook secret; dedupe on email; webhook id tf_webhook_01.

Loading result...

Failed to load output.

Output:

1) Overview

Business flow and success criteria

- Flow: Typeform submission -> verify webhook HMAC -> parse -> normalize email -> compute idempotency_key -> search Salesforce for Contact by idempotency_key or email ->
  - Single m

Why it works: Shows a second realistic variant: Typeform as lead source and Salesforce as target. The spec adapts CRM search/upsert to Salesforce REST API, defines exact nodes and mappings, and preserves the same idempotency algorithm, retry/backoff, enrichment failover, scoring rubric, and audit behavior—enabling quick implementation in n8n targeting Salesforce flows.

Works Best With

Best used when you have the core integration variables ready