P
Paulo
Guest
Code:
# AI Sales Agent with Real-Time Data Integration
_Submission for the AI Agents Challenge powered by n8n and Bright Data_
## What I Built
An AI Sales Agent that marries n8nβs low-code automation with **Bright Dataβs real-time web intelligence** to solve one of B2Bβs biggest pains: **hyper-personalized, data-driven sales outreach that is always up-to-date**.
### Key Capabilities
| Feature | Benefit |
|---|---|
| **Natural-language query input** | Users simply ask βTell me about Acme Corpβ. |
| **Real-time company research** | Scrapes live web + LinkedIn via Bright Data. |
| **AI email generation** | Google Gemini crafts βIβll show you how to fix Xβ copy with a **relevant MediaMarkt offer**. |
| **Daily lead enrichment** | Cron-triggered workflow re-scores and re-emails every morning. |
| **Live dashboard** | Webhook-driven front-end to monitor KPIs in real time. |
### Demo Links
| Asset | URL |
|---|---|
| **Video Demo** | [youtu.be/H9ITJmg5_Hk](https://youtu.be/H9ITJmg5_Hk) |
| **Agent Interface** | [brightdata.app.n8n.cloud/webhook/agent](https://brightdata.app.n8n.cloud/webhook/agent) |
| **Dashboard** | [brightdata.app.n8n.cloud/webhook/dashboard](https://brightdata.app.n8n.cloud/webhook/dashboard) |
| **Workflow JSON** | [GitHub Gist](https://gist.github.com/PauloTuppy/55afad076d2f0cdbfe7eae3fe9867438) |
---
## Technical Deep-Dive
### Architecture Overview
mermaid
graph TD
User(Web Interface) -->|POST query| Webhook
Webhook --> Extract[Regex Extract Company]
Extract --> BD_Bright(Bright Data nodes)
BD_Bright --> Company(Company Intel)
BD_Bright --> LinkedIn(LinkedIn Jobs)
BD_Bright --> Products(MediaMarkt Products)
Company & LinkedIn & Products --> Gemini(Google Gemini)
Gemini --> Sheets(Google Sheets)
Sheets --> Dashboard
Cron --> Sheets[Daily Re-enrichment]
Code:
### Model Choice
| Model | Reason |
|---|---|
| **Google Gemini 1.5 Flash** | Fast, stateless, excellent at short persuasive copy. |
### Memory & Context
- **Session IDs** generated per user.
- **Conversation history** appended to each prompt.
- **Google Sheets** = long-term memory & CRM.
### Daily Automation
- **Cron node** fires at 09:00 UTC β re-scrapes β re-scores β re-emails.
---
## Bright Data Verified Nodes in Action
| Task | Dataset / Node | Value |
|---|---|---|
| **Company Intel** | Bright Data Web Scraper | Live profile, news, competitors. |
| **Job Insights** | LinkedIn Jobs Dataset | Growth signals & pain points from postings. |
| **Product Mapping** | MediaMarkt.de Dataset | Relevant offers tied to detected pain. |
| **Lead Enrichment** | Same nodes | Fresh data every 24 h. |
> **Design Decision**: Dropped the complex MCP SSE stream for **direct verified-node calls**βfar more stable and debuggable.
---
## Journey & Lessons Learned
### Phase 1 β MCP SSE Struggles
- **Problem**: Auth failures & streaming complexity.
- **Pivot**: Direct Bright Data nodes β 10Γ more reliable.
### Phase 2 β Data Flow Refactoring
- **Challenge**: Passing context between nodes.
- **Fix**: Unified JSON schema + explicit variable mapping.
### Phase 3 β Frontend & Response
- **Bug**: βWorkflow startedβ instead of full response.
- **Solution**: Re-wired webhook **Respond** node to return final Gemini output.
### Key Takeaways
1. **Simplicity > Complexity** β direct integrations beat fancy protocols.
2. **Real-time data changes everything** β static AI feels dated the moment context expires.
3. **n8n + Bright Data** = production-grade AI agents without writing backend services.
---
> From fragile prototype to **production-ready sales engine** in one weekβproving the future of AI agents is **real-world, real-time, and no-code friendly**.
Continue reading...