Introduction
Bardeen, the no-code/low-code automation tool powered by AI, revolutionizes productivity in 2026 by connecting over 100 apps like Gmail, Slack, Notion, or Google Sheets. For experts, it goes beyond basic playbooks: imagine extracting leads from a website via AI scraping, enriching them with external APIs, then routing them to a CRM via multiple triggers. This expert tutorial guides you step by step to build complex workflows, integrating custom JavaScript and advanced JSON configurations. Why is it crucial? In a world where time is the scarcest resource, a well-designed Bardeen playbook saves hours weekly and scales infinitely without server code. Ready to turn your processes into an autonomous machine? (128 words)
Prerequisites
- Bardeen Pro or Enterprise account (for unlimited actions and advanced AI)
- Bardeen Chrome extension installed (2026+ version)
- Knowledge of JSON, JavaScript, and REST APIs
- Target apps connected: Gmail, Google Sheets, Slack
- Dev tools: Postman for testing webhooks, VS Code editor for custom JS
Step 1: Set Up Advanced Integrations
Start in the Bardeen interface (bardeen.ai). Go to Integrations and connect your apps via OAuth. For experts, enable Custom Apps: import private APIs using JSON schema. This lets you add any service, like an internal CRM. Test with a simple ping to validate. Analogy: it's like wiring high-voltage cables – a bad config blows the whole circuit.
JSON Schema for Custom App API
{
"name": "Mon CRM Interne",
"description": "Intégration API CRM privé",
"actions": [
{
"name": "createLead",
"description": "Créer un lead",
"inputParameters": {
"type": "object",
"properties": {
"email": { "type": "string" },
"name": { "type": "string" },
"source": { "type": "string" }
},
"required": ["email", "name"]
},
"outputParameters": {
"type": "object",
"properties": {
"leadId": { "type": "string" }
}
}
}
],
"baseUrl": "https://api.moncrm.com/v1",
"auth": {
"type": "apiKey",
"headerName": "X-API-Key"
}
}This JSON schema defines a Custom App for Bardeen, exposing a 'createLead' action. Import it into Bardeen via Custom Apps > Import JSON. Pitfall: forget 'required' and inputs will be missing; always test with Postman first.
Step 2: Create a Multi-Source Trigger
Expert triggers combine events (e.g., new email) and polls (e.g., periodic scraping). In Playbooks > New, select Multiple Triggers. Add 'New Email in Gmail' AND 'Webhook'. This fires on email + external signal, perfect for qualified leads. Set up IF conditions to filter (e.g., @prospect.com domain).
JSON Configuration for Multi-Trigger Playbook
{
"name": "Lead Hunter Multi",
"triggers": [
{
"type": "gmail.newEmail",
"filters": {
"subject": "contient:lead",
"from": "@prospect.com"
}
},
{
"type": "webhook",
"url": "https://hook.bardeen.ai/abc123"
}
],
"actions": [],
"conditions": [
{
"if": "{{trigger.type}} == 'gmail.newEmail'",
"then": "proceed"
}
]
}Export/import this JSON via Playbook Settings > Export. It defines two triggers with filters. Benefit: resilient to downtime from one source. Pitfall: sync timestamps to avoid duplicates.
Step 3: Integrate Advanced AI Scraping
Bardeen excels at AI scraping: select Scrape with AI on a web page. The AI parses structurally (e.g., extract name/phone from a LinkedIn profile). For experts, chain with Enrich Data to geolocate via APIs like Clearbit. Result: structured table ready for Sheets.
Custom JavaScript for Post-Scraping AI Parsing
function run(actionParams) {
const scrapedData = actionParams.scraped; // Tableau d'objets IA
const leads = scrapedData.map(item => {
const name = item.name || 'N/A';
const email = item.email || item['contact-email'] || 'N/A';
const phone = item.phone?.replace(/[^\d+]/g, '') || 'N/A';
return {
name,
email: email.toLowerCase().trim(),
phone,
score: item.relevance > 0.8 ? 'High' : 'Low',
timestamp: new Date().toISOString()
};
}).filter(lead => lead.email !== 'N/A');
return { leads, count: leads.length };
}Add this custom JS action via + Action > Run JavaScript. It cleans up AI-scraped data. Works on any input; pitfall: handle nulls to avoid crashes, test with console.log in dev.
Step 4: Chain Actions with Webhooks and APIs
Connect to external services via Send Webhook then Custom App. E.g., post leads to HubSpot, then Slack notification. Use dynamic variables like {{lead.email}} for personalization. For scale, enable Polling every 5 minutes.
JS Script for API Enrichment Call
async function run(actionParams) {
const lead = actionParams.lead;
const apiKey = 'sk-your-clearbit-key';
const response = await fetch(`https://person.clearbit.com/v2/combined/find?email=${lead.email}`, {
headers: { Authorization: `Bearer ${apiKey}` }
});
const data = await response.json();
return {
...lead,
company: data.company?.name || 'Unknown',
location: data.geo?.city || 'N/A',
title: data.employment?.title || 'N/A',
enriched: true
};
}Async JS action to enrich leads via Clearbit API (replace apiKey). Bardeen supports native fetch. Pitfall: rate limits – add try/catch and retry logic for production; log errors to Slack.
Webhook Payload for External Trigger
{
"event": "new_lead",
"data": {
"lead": {
"email": "example@prospect.com",
"source": "scraping",
"timestamp": "2026-01-01T12:00:00Z"
},
"action": "process"
},
"signature": "sha256=abc123signature"
}Send this payload to your Bardeen webhook via curl or Zapier. Validates signature for security. Great for integrating legacy systems; pitfall: use HTTPS only to avoid MITM attacks.
Step 5: Deploy and Monitor the Playbook
Switch to Live Mode, set quotas (e.g., 100 runs/day). Monitor via Analytics: success rates, execution times. Add Error Handling with Slack alerts. Scale by duplicating playbooks.
JS for Custom Logging and Alerting
function run(actionParams) {
const error = actionParams.error;
const lead = actionParams.lead;
const slackPayload = {
text: `🚨 Erreur playbook: ${error.message}`,
fields: [{ title: 'Lead', value: lead.email, short: true }]
};
// Bardeen auto-poste à Slack si configuré
console.error('Lead failed:', lead.email, error);
throw new Error(`Failed lead: ${lead.email} - ${error.message}`); // Re-trigger si needed
}Integrate at the end of the playbook to catch errors. Auto-posts to integrated Slack. Pitfall: infinite loops – limit retries to 3 via conditions.
Best Practices
- Modularize: Break into reusable sub-playbooks (e.g., shared 'Enrich Lead').
- Secure: Use env variables for API keys, enable 2FA on Bardeen.
- Optimize: Batch actions (100 leads/run) to avoid quotas; test with mock data.
- Version: Export JSON playbooks to Git for rollback.
- Fine-tune AI: Retrain scrapers on 50+ examples for >95% accuracy.
Common Mistakes to Avoid
- Quotas exhausted: Monitor Analytics; upgrade to Pro before production.
- Mis-scoped variables: Nested {{ }} cause undefined – debug step-by-step.
- JS sync/async mix: Always use async for APIs, or risk infinite timeouts.
- Blocked scraping: Rotate user-agents; respect robots.txt for legality.
Next Steps
Dive deeper with the Bardeen API docs, integrate custom LLMs via OpenAI actions. Check out Learni trainings on AI automation for pro certifications. Community: Bardeen Discord for open-source playbooks.