Prompt Details
Model
(gemini-3.0-flash)
Token size
399
Example input
[AUTOMATION_PLATFORM]: n8n
[WORKFLOW_OBJECTIVE]: Capture leads from a Facebook Ads Webhook, verify existence in Kommo CRM, and if new, register in Google Sheets and notify a Slack sales channel.
Example output
## Node Architecture
* **Webhook Trigger (Facebook Lead Ads):** Configured as a POST endpoint to receive real-time lead data. This is the most efficient method as it eliminates the need for polling and reduces execution overhead.
* **Kommo CRM Search Node:** Utilizes the "Get Many Leads" or "Get Many Contacts" action to query the CRM using the lead's email or phone number as a filter.
* **If Node (Logic Controller):** Evaluates the result from the CRM search.
* **True Branch:** Lead already exists; flow terminates or updates existing record.
* **False Branch:** Lead does not exist; proceeds to creation and notification.
* **Google Sheets Node:** Appends a new row to the designated tracking spreadsheet with the lead's details.
* **Slack Node:** Sends a formatted message to the sales channel containing the lead source and contact info.
* **Error Handler (Error Trigger):** A separate sub-flow or "On Error" configuration to catch failed API calls and log them for manual review.
## Configuration Guide
* **Facebook Ads (Webhook):**
* **Auth Method:** System User Access Token (Long-lived).
* **Setup:** Requires verification of the "Hub Mode" and "Verify Token" within the n8n Webhook node settings to establish the initial handshake with Meta.
* **Kommo CRM:**
* **Auth Method:** OAuth2.
* **Rate Limit Management:** Kommo enforces a limit (typically 7 requests per second). Configure the node's "Retry on Fail" settings with a wait time of 2000ms and 3 max attempts.
* **Google Sheets:**
* **Auth Method:** OAuth2 (Google Service Account or User Account).
* **Operation:** Append. Ensure the "First Row Contains Headers" toggle is active to prevent data misalignment.
* **Slack:**
* **Auth Method:** OAuth2 (Slack App Bot Token).
* **Scope:** Requires chat:write permissions for the specific channel.
## Data Mapping
* **Facebook to CRM Search:**
* Map {{ $json.field_data.email }} to the Kommo contact filter query.
* **Facebook to Google Sheets:**
* Column A (Name): {{ $json.field_data.full_name }}
* Column B (Email): {{ $json.field_data.email }}
* Column C (Phone): {{ $json.field_data.phone_number }}
* Column D (Timestamp): {{ $now }}
* **Facebook to Slack Notification:**
* Message Text: "New Lead Received! Name: {{ $json.field_data.full_name }} | Campaign: {{ $json.campaign_name }}."
## Technical Resource
### Optimized Data Transformation (n8n Expression)
To ensure the phone number is standardized before reaching the CRM and Google Sheets, use the following expression within a **Set Node**. This removes non-numeric characters to prevent API validation errors:
{{ $json.field_data.phone_number.replace(/[^0-9+]/g, '') }}
### API Rate Limit Strategy (Wait Node Logic)
To prevent 429 Too Many Requests errors when processing bulk webhook bursts, insert a **Wait Node** before the Kommo search with the following JSON configuration for the "Limit" logic:
* **Wait Amount:** 1
* **Wait Unit:** Seconds
* **Resume:** After Time Elapsed
This "throttling" ensures that even if Facebook sends 10 leads simultaneously, the n8n worker processes them in a staggered manner, staying within Kommo's API threshold.
By purchasing this prompt, you agree to our terms of service
GEMINI-3.0-FLASH
Universal Multi-Platform Blueprint.
Master AI implementation with this professional-grade architect tool. Designed for Engineers and Consultants, this prompt generates robust, production-ready workflows for AI Agents and complex automations.
Includes advanced logic for:
API Auth Context (OAuth2/API Key)
Rate Limit Strategies
Error Handling & Scalability
Custom Technical Resources (JSON/JS)
Stop building basic flows and start architecting scalable AI solutions.
...more
Updated 1 week ago
