1. The Concept: Intent Extraction
Unlike common marketing tools, the Leads Bot from Projeto Nômade da Corte focuses on real intent. It monitors the web for phrases like "can anyone recommend a developer?" or "where can I buy this product?". The bot identifies the author, extracts contact info, and qualifies the lead automatically.
2. The Scanning Engine (Python)
The social_engine.py file is responsible for bypassing protection systems and collecting data. It uses random "User Agents" and intelligent delays to appear as a human browsing.
import httpx
from bs4 import BeautifulSoup
class SocialIntelligenceEngine:
async def search_real_leads(self, platform, product, keywords, region):
# Assembles the Query (Question) for Google/DuckDuckGo
# Example: site:instagram.com "looking for" developer brazil
query = f'site:{platform}.com "looking for" {keywords} {region}'
# Performs the search without getting blocked
headers = {"User-Agent": "Random_User_Agent_Here"}
response = await self.client.get(f"https://duckduckgo.com/lite/?q={query}")
# Extracts data from HTML (Web Scraping)
soup = BeautifulSoup(response.text, 'html.parser')
# ... name and link extraction logic ...
For Beginners:
Imagine you want to search for something on Google every 5 minutes. If you do it manually, you'll get tired. The robot does it for you, but it "disguises" itself by switching virtual browsers with every search so it doesn't get kicked out by Google.
3. Intelligence Qualification (Lead Scoring)
Finding a post isn't enough; you need to know if it's good. In the dashboard (scrap.html), there's a "Lead Scoring" engine that gives the post a score from 0 to 100.
function localLeadIntelligence(leadText) {
let score = 0;
const weights = {
"budget": 40, // If mention budget, +40 points
"how much": 35, // If ask for price, +35 points
"hire": 30, // If want to hire, +30 points
"job offer": -70 // If it's a job offer, -70 (Not a sales lead)
};
Object.keys(weights).forEach(word => {
if (leadText.toLowerCase().includes(word)) {
score += weights[word];
}
});
return score; // Returns the "temperature" of the lead
}
4. Automatic Response (WhatsApp Sender)
The whatsapp_sender/sender.py module is the most impressive part. It reads hot leads from the database and uses mouse and keyboard automation (PyAutoGUI) to send personalized messages.
import pyautogui
import webbrowser
def send_whatsapp(phone, message):
# Opens WhatsApp Web with the number and message
url = f"https://web.whatsapp.com/send?phone={phone}&text={message}"
webbrowser.open(url)
# Waits for loading (35 seconds for safety)
time.sleep(35)
# Simulates pressing the ENTER key to send
pyautogui.press('enter')
# Closes the tab to not accumulate processes
pyautogui.hotkey('ctrl', 'w')
5. Monitoring Dashboard
This entire operation is controlled by a futuristic panel. You can see what the robot is seeing through real-time screenshots sent by the local engine to Firebase.
// Monitoring the local engine's "Live View"
onValue(ref(db, 'engine_control'), (snapshot) => {
const data = snapshot.val();
if (data.screenshot) {
// Shows the engine screen image in your browser
document.getElementById('browser-view').style.backgroundImage =
`url(data:image/png;base64,${data.screenshot})`;
}
});