Le Nguyen
Salesforce Architect with 10+ years of experience in CRM, integrations, and automation. Skilled in Apex, LWC, REST APIs, and full-stack dev (JavaScript, .NET). I build secure, scalable workflows in n8n—connecting Salesforce, Stripe, and more. Passionate about lead scoring, data sync, and secure field masking. Certified Application Architect with deep expertise in platform, integration, and data architecture.
Templates by Le Nguyen
LeadBot autopilot — chat-to-lead for Salesforce
LeadBot Autopilot — Chat-to-Lead for Salesforce Description — How It Works Greets & Guides: Welcomes the visitor and collects info step-by-step — Full Name → Email → Mobile → Product Interest. Validates Inputs: Checks email/phone formats; politely re-asks if invalid. De-dupe in Salesforce: Looks up by email; updates an existing lead if found. Create/Update Lead: Writes to Salesforce, including ProductInterestc. Notify Instantly: Sends a Slack alert to your team and a personalized email to the prospect. Close the Loop: Confirms submission and ends the chat. Description — Set Up Steps (≈45–75 mins) Connect Credentials (20–30 mins): Salesforce OAuth, OpenAI, Slack, SMTP. Tune the Prompt (5–10 mins): Greeting, field order, product options. Map Fields (10–15 mins): Name split, email/phone, ProductInterestc. Smoke Test (10–15 mins): Run a full chat; verify de-dupe, Slack + email. Go Live (5–10 mins): Expose the webhook/chat entry point on your site.
Salesforce lead capture with GPT-4 personalized email & SMS follow-up
How It Works This workflow transforms n8n into a smart Web Lead Form alternative to Salesforce's traditional Web-to-Lead, capturing leads, creating Salesforce records, and sending AI-personalized responses via email or SMS. Capture Submission: User submits form data (name, email, phone, description, preference) via n8n's hosted form. Create Lead: Maps data to a new Salesforce Lead. Personalize Message: Uses OpenAI to generate a tailored welcome based on description and preference (detailed for email, concise for SMS). Route Outreach: Branches to send via Twilio SMS or SMTP email depending on preference. Set Up Steps Setup takes about 15-30 minutes if you have credentials ready. Focus on connecting services; detailed configs are in workflow sticky notes. Duplicate this template in n8n. Add your Salesforce, OpenAI, Twilio, and SMTP credentials (no hardcoding—use n8n's credential manager). Customize form fields if needed and test with sample data. Activate and share the form URL on your site. n8n Web to Lead Form.json
Domain-specific web content crawler with depth control & text extraction
This template implements a recursive web crawler inside n8n. Starting from a given URL, it crawls linked pages up to a maximum depth (default: 3), extracts text and links, and returns the collected content via webhook. --- 🚀 How It Works 1) Webhook Trigger Accepts a JSON body with a url field. Example payload: { "url": "https://example.com" } 2) Initialization Sets crawl parameters: url, domain, maxDepth = 3, and depth = 0. Initializes global static data (pending, visited, queued, pages). 3) Recursive Crawling Fetches each page (HTTP Request). Extracts body text and links (HTML node). Cleans and deduplicates links. Filters out: External domains (only same-site is followed) Anchors (), mailto/tel/javascript links Non-HTML files (.pdf, .docx, .xlsx, .pptx) 4) Depth Control & Queue Tracks visited URLs Stops at maxDepth to prevent infinite loops Uses SplitInBatches to loop the queue 5) Data Collection Saves each crawled page (url, depth, content) into pages[] When pending = 0, combines results 6) Output Responds via the Webhook node with: combinedContent (all pages concatenated) pages[] (array of individual results) Large results are chunked when exceeding ~12,000 characters --- 🛠️ Setup Instructions 1) Import Template Load from n8n Community Templates. 2) Configure Webhook Open the Webhook node Copy the Test URL (development) or Production URL (after deploy) You’ll POST crawl requests to this endpoint 3) Run a Test Send a POST with JSON: curl -X POST https://<your-n8n>/webhook/<id> \ -H "Content-Type: application/json" \ -d '{"url": "https://example.com"}' 4) View Response The crawler returns a JSON object containing combinedContent and pages[]. --- ⚙️ Configuration maxDepth Default: 3. Adjust in the Init Crawl Params (Set) node. Timeouts HTTP Request node timeout is 5 seconds per request; increase if needed. Filtering Rules Only same-domain links are followed (apex and www treated as same-site) Skips anchors, mailto:, tel:, javascript: Skips document links (.pdf, .docx, .xlsx, .pptx) You can tweak the regex and logic in Queue & Dedup Links (Code) node --- 📌 Limitations No JavaScript rendering (static HTML only) No authentication/cookies/session handling Large sites can be slow or hit timeouts; chunking mitigates response size --- ✅ Example Use Cases Extract text across your site for AI ingestion / embeddings SEO/content audit and internal link checks Build a lightweight page corpus for downstream processing in n8n --- ⏱️ Estimated Setup Time ~10 minutes (import → set webhook → test request)
Automate invoice processing with OCR, GPT-4 & Salesforce opportunity creation
PDF Invoice Extractor (AI) End-to-end pipeline: Watch Drive ➜ Download PDF ➜ OCR text ➜ AI normalize to JSON ➜ Upsert Buyer (Account) ➜ Create Opportunity ➜ Map Products ➜ Create OLI via Composite API ➜ Archive to OneDrive. --- Node by node (what it does & key setup) 1) Google Drive Trigger Purpose: Fire when a new file appears in a specific Google Drive folder. Key settings: Event: fileCreated Folder ID: google drive folder id Polling: everyMinute Creds: googleDriveOAuth2Api Output: Metadata { id, name, ... } for the new file. --- 2) Download File From Google Purpose: Get the file binary for processing and archiving. Key settings: Operation: download File ID: ={{ $json.id }} Creds: googleDriveOAuth2Api Output: Binary (default key: data) and original metadata. --- 3) Extract from File Purpose: Extract text from PDF (OCR as needed) for AI parsing. Key settings: Operation: pdf OCR: enable for scanned PDFs (in options) Output: JSON with OCR text at {{ $json.text }}. --- 4) Message a model (AI JSON Extractor) Purpose: Convert OCR text into strict normalized JSON array (invoice schema). Key settings: Node: @n8n/n8n-nodes-langchain.openAi Model: gpt-4.1 (or gpt-4.1-mini) Message role: system (the strict prompt; references {{ $json.text }}) jsonOutput: true Creds: openAiApi Output (per item): $.message.content → the parsed JSON (ensure it’s an array). --- 5) Create or update an account (Salesforce) Purpose: Upsert Buyer as Account using an external ID. Key settings: Resource: account Operation: upsert External Id Field: taxid_c External Id Value: ={{ $json.message.content.buyer.tax_id }} Name: ={{ $json.message.content.buyer.name }} Creds: salesforceOAuth2Api Output: Account record (captures Id) for downstream Opportunity. --- 6) Create an opportunity (Salesforce) Purpose: Create Opportunity linked to the Buyer (Account). Key settings: Resource: opportunity Name: ={{ $('Message a model').item.json.message.content.invoice.code }} Close Date: ={{ $('Message a model').item.json.message.content.invoice.issue_date }} Stage: Closed Won Amount: ={{ $('Message a model').item.json.message.content.summary.grand_total }} AccountId: ={{ $json.id }} (from Upsert Account output) Creds: salesforceOAuth2Api Output: Opportunity Id for OLI creation. --- 7) Build SOQL (Code / JS) Purpose: Collect unique product codes from AI JSON and build a SOQL query for PricebookEntry by Pricebook2Id. Key settings: pricebook2Id (hardcoded in script): e.g., 01sxxxxxxxxxxxxxxx Source lines: $('Message a model').first().json.message.content.products Output: { soql, codes } --- 8) Query PricebookEntries (Salesforce) Purpose: Fetch PricebookEntry.Id for each Product2.ProductCode. Key settings: Resource: search Query: ={{ $json.soql }} Creds: salesforceOAuth2Api Output: Items with Id, Product2.ProductCode (used for mapping). --- 9) Code in JavaScript (Build OLI payloads) Purpose: Join lines with PBE results and Opportunity Id ➜ build OpportunityLineItem payloads. Inputs: OpportunityId: ={{ $('Create an opportunity').first().json.id }} Lines: ={{ $('Message a model').first().json.message.content.products }} PBE rows: from previous node items Output: { body: { allOrNone:false, records:[{ OpportunityLineItem... }] } } Notes: Converts discount_total ➜ per-unit if needed (currently commented for standard pricing). Throws on missing PBE mapping or empty lines. --- 10) Create Opportunity Line Items (HTTP Request) Purpose: Bulk create OLIs via Salesforce Composite API. Key settings: Method: POST URL: https://<your-instance>.my.salesforce.com/services/data/v65.0/composite/sobjects Auth: salesforceOAuth2Api (predefined credential) Body (JSON): ={{ $json.body }} Output: Composite API results (per-record statuses). --- 11) Update File to One Drive Purpose: Archive the original PDF in OneDrive. Key settings: Operation: upload File Name: ={{ $json.name }} Parent Folder ID: onedrive folder id Binary Data: true (from the Download node) Creds: microsoftOneDriveOAuth2Api Output: Uploaded file metadata. --- Data flow (wiring) Google Drive Trigger → Download File From Google Download File From Google → Extract from File → Update File to One Drive Extract from File → Message a model Message a model → Create or update an account Create or update an account → Create an opportunity Create an opportunity → Build SOQL Build SOQL → Query PricebookEntries Query PricebookEntries → Code in JavaScript Code in JavaScript → Create Opportunity Line Items --- Quick setup checklist 🔐 Credentials: Connect Google Drive, OneDrive, Salesforce, OpenAI. 📂 IDs: Drive Folder ID (watch) OneDrive Parent Folder ID (archive) Salesforce Pricebook2Id (in the JS SOQL builder) 🧠 AI Prompt: Use the strict system prompt; jsonOutput = true. 🧾 Field mappings: Buyer tax id/name → Account upsert fields Invoice code/date/amount → Opportunity fields Product name must equal your Product2.ProductCode in SF. ✅ Test: Drop a sample PDF → verify: AI returns array JSON only Account/Opportunity created OLI records created PDF archived to OneDrive --- Notes & best practices If PDFs are scans, enable OCR in Extract from File. If AI returns non-JSON, keep “Return only a JSON array” as the last line of the prompt and keep jsonOutput enabled. Consider adding validation on parsing.warnings to gate Salesforce writes. For discounts/taxes in OLI: Standard OLI fields don’t support per-line discount amounts directly; model them in UnitPrice or custom fields. Replace the Composite API URL with your org’s domain or use the Salesforce node’s Bulk Upsert for simplicity.
AI-powered lead scoring with Salesforce, GPT-4o, and Slack with data masking
Boost your sales team’s efficiency with an end-to-end, privacy-first lead-scoring engine—ready to drop straight into your n8n instance. 🔹 What it does Salesforce Trigger watches for new or updated Leads every hour. HTTP Request fetches the full record so you never miss a field. Mask Data (JS Code) automatically tokenises PII (name, email, address, etc.) before any external call—ideal for GDPR/SOC 2 compliance. OpenAI (GPT-4o) scores each lead 0-100, assigns a grade A-F, lists key reasons, recommends one next action, and even drafts a personalised email template. Unmask Data (JS Code) swaps the tokens back in only when you explicitly need them—so sensitive data never leaks to logs or AI prompts. Slack Node delivers a concise, team-friendly summary (score, grade, reasons, next step, and draft email) right to the rep who needs it. 🔹 Why you’ll love it Security by design – field-level masking with reversible tokens. No-code friendly – clear sticky notes explain every step; swap Salesforce for any CRM in minutes. AI you can trust – scoring rubric baked into the system prompt for consistent results. Instant hand-off – reps get an actionable Slack message instead of another spreadsheet. Perfect for rev-ops teams that want smarter prioritisation without rebuilding their stack—or exposing customer data. Plug it in, set your own masking list, and start converting the leads that matter most.
Automated Zalo OA token management with OAuth and webhook integration
Description (How it works) This workflow keeps your Zalo Official Account access token valid and easy to reuse across other flows—no external server required. High-level steps Scheduled refresh runs on an interval to renew the access token before it expires. Static Data cache (global) stores access/refresh tokens + expiries for reuse by any downstream node. OAuth exchange calls Zalo OAuth v4 with your appid and secretkey to get a fresh access token. Immediate output returns the current access token to the next nodes after each refresh. Operational webhooks include: A reset webhook to clear the cache when rotating credentials or testing. A token peek webhook to read the currently cached token for other services. Setup steps (estimated time ~8–15 minutes) Collect Zalo credentials (2–3 min): Obtain appid, secretkey, and a valid refresh_token. Import & activate workflow (1–2 min): Import the JSON into n8n and activate it. Wire inputs (2–3 min): Point the “Set Refresh Token and App ID” node to your env vars (or paste values for a quick test). Adjust schedule & secure webhooks (2–3 min): Tune the run interval to your token TTL; protect the reset/peek endpoints (e.g., secret param or IP allowlist). Test (1–2 min): Execute once to populate Static Data; optionally try the token peek and reset webhooks to confirm behavior.
Multi-channel campaign messaging with GPT-4 and Salesforce
How it works Fetch campaign & members from Salesforce. GPT‑4 auto‑writes a channel‑appropriate, personalised outbound message. Switch node sends via Twilio (SMS/WhatsApp), SMTP (Email). Mark each member as processed to avoid double‑touches. Error trigger notifies Slack if anything fails. Set‑up steps Time: ~10‑15 min once credentials are ready. Prereqs: Active Salesforce OAuth app, Twilio account, SMTP creds, Slack app. In‑flow sticky notes walk you through credential mapping, environment variables, and optional tweaks (e.g., campaign SOQL filter). > Copy the workflow, add your keys, and run a quick manual test—after that you can place it on a cron or Salesforce trigger.
Automatically enrich Salesforce accounts with web crawling, LinkedIn data, GPT
Crawl the web, mine LinkedIn, think with GPT, and auto‑enrich Salesforce—all inside n8n. --- 🔧 How It Works (High-Level) Listen – Trigger on new Salesforce Accounts. Discover – Crawl the company site (depth-limited) + grab/parse LinkedIn. Distill – GPT (JSON mode) returns a clean insight object + HTML summary. Enrich – Update the Account record in Salesforce automatically. --- 🛠 Setup Steps (≈15–25 minutes) Import the workflow JSON into n8n. Connect Credentials: Salesforce OAuth2 + OpenAI API key. Tune Settings: Set maxDepth (default = 1), confirm the model (e.g., gpt‑4o). Test with a sample Account to verify crawl + update. Enable Trigger and let it run. --- 💼 Business Impact Zero manual research: Insights appear in Salesforce instantly. Consistent data: Unified JSON schema + confidence rating. Faster qualification: Reps see services, size, HQ, etc., without leaving SF. Scalable & automated: Works 24/7 on every new Account. AI-ready outputs: Raw JSON for automations, HTML for dashboards/Lightning. --- 🌟 Optional Enhancements Push insights to Slack/Teams. Auto-create tasks if rating < 60 or data missing. Archive raw HTML to S3 for audits.
Automate stale deal follow-ups in Salesforce with GPT-5.1, email, Slack & tasks
How it works Runs every morning at 8:00 using the Schedule Trigger. Sets a staledays value and queries Salesforce for Opportunities where StageUnchangedDays_c equals that value and the stage is not Closed Won / Closed Lost. For each “stale” Opportunity, loads full deal details and sends them to an OpenAI model. The model uses the query_soql tool to pull recent Notes, the primary Contact, and the Opportunity Owner, then returns a single JSON object with: a personalized follow-up email for the client, a short SMS template, a concise Slack summary for the sales team, and a ready-to-use Task payload for Salesforce. n8n parses that JSON, sends the email via SMTP, posts the Slack message to your chosen channel, and creates a Salesforce Task assigned to the Opportunity Owner so every stalled deal has a clear next step. Setup steps Estimated setup time: ~30–45 minutes if your Salesforce, OpenAI, SMTP and Slack credentials are ready. Create StageUnchangedDaysc on Opportunity (Salesforce) Field Type: Formula (Number, 0 decimal places) Formula: text IF( ISBLANK(LastStageChangeDate), TODAY() - DATEVALUE(CreatedDate), TODAY() - DATEVALUE(LastStageChangeDate) ) This field tracks how many days the Opportunity has been in the current stage. Connect credentials in n8n Salesforce OAuth2 for the Salesforce nodes and the query_soql HTTP Tool. OpenAI (or compatible) credential for the “Message a model” node. SMTP credential for the customer email node. Slack credential for the internal notification node. Configure your follow-up rules In Edit Fields (Set), set stale_days to the threshold that defines a stalled deal (e.g. 7, 14, 30). In Perform a query, optionally refine the SOQL (record types, owners, minimum amount, etc.) to match your pipeline. Update the Send Email SMTP Customer node with your real “from” address and tweak the wording if needed. Point Send Message To Internal Team (Slack) to the right channel or user. Test safely Turn off the Schedule Trigger and run the workflow manually with a few test Opportunities. Inspect the AI output in Message a model and Parse JSON to confirm the structure (email, sms, slack, task.api_body). Check that the email and Slack messages look good and that Salesforce Tasks are created, assigned to the right Owner, and linked to the correct Opportunity. Go live Re-enable the Schedule Trigger. Monitor the first few days to confirm that follow-ups, Slack alerts, and Tasks all behave as expected, then let the automation quietly keep your pipeline clean and moving.