Closed-Loop Autonomous AI Architecture

Naga AI Assistant (Arya) — Workflow Guide

Gmail & WhatsApp-ல் மெசேஜ் வருவதில் இருந்து, Google Gemini AI Tamil Voice Briefing, Naga-வின் குரல் பதில், மற்றும் Client-க்கு WhatsApp Auto Reply வரை முழுமையான விளக்கம்.

உதாரண காட்சியை தேர்ந்தெடுக்கவும் (Live Scenario Trace):
1

Client Messaging Gmail & WhatsApp

Clients send emails (Gmail) or WhatsApp messages regarding quotation approvals, payment terms, delivery inquiries, or urgent complaints.

Incoming "Dear Naga, We reviewed your quotation. Approve it with 2 installments (50% advance / 50% on completion). Please confirm."
Client Input
2

n8n Automation Ingestion Webhook Dispatch

Your n8n workflow triggers instantly on new Gmail/WhatsApp messages, standardizes the JSON payload, and securely POSTs to Arya's webhook with header authentication.

HTTP POST https://ai.tenkasidreams.com/backend/webhooks/n8n.php [x-n8n-secret]
n8n Pipeline
3

Deterministic Pre-Filter Shield Cost & Spam Optimization

Lightweight ultra-fast regex filter evaluates the message. OTPs, bank marketing, promotional spam, and trivial "thank you" messages are handled in 1ms without invoking Gemini API.

Filter Result ✓ Pass: Actionable Business Content detected. Forwarding to Gemini AI.
Shield Active
4

Google Gemini AI 1.5 Flash Chennai Tamil Voice Briefing

Gemini analyzes urgency, extracts the client's intent, decides if a phone call is mandatory, and creates a natural conversational spoken Tamil briefing with English business terms.

Tamil Briefing "Client quotation approve பண்ணிட்டாங்க. ஆனா 2 installment-ல payment பண்ணலாமா-னு கேக்குறாங்க. நீங்க confirmation தரணும்."
Gemini 1.5 Flash
5

Arya Voice Call to Naga +916382379565

Arya calls Naga's phone via Telephony. Arya speaks in natural Chennai Tamil, briefs Naga in 30 seconds, and asks for instructions on what reply to send.

Arya Spoken Arya: "வணக்கம் Naga! உங்க client கிட்ட இருந்து முக்கியமான மெசேஜ் வந்திருக்கு... இதுக்கு நான் என்ன பதில் சொல்லணும் Naga?"
Voice Telephony
6

Naga's Spoken Instruction Captured Voice-to-Text Recording

Naga answers naturally on the phone. The voice recognition engine transcribes Naga's words and triggers the post-call webhook.

Naga Spoken Naga: "சரி, 2 installment ஓகே. ஆனா முதல் installment நாளைக்குள்ள கட்ட சொல்லு."
Owner Spoken
7

Gemini AI Professional Polish Auto Business Drafting

Gemini AI receives Naga's rough verbal instruction and translates it into a polished, polite, and professional business reply tailored for WhatsApp.

Drafted Text "Dear Ramesh, Thank you for approving the quotation. We are happy to proceed with the 2-installment payment structure (50% advance / 50% upon completion). Kindly process the initial advance payment by tomorrow so we can initiate work immediately. Warm regards, Naga"
AI Crafted
8

Auto WhatsApp Dispatch & Task Record Closed Loop Complete

The message is automatically dispatched back to the client's WhatsApp via WhatsApp Cloud API or n8n outbound webhook. A completed Action Task with full audit trail is saved in the dashboard!

✓ Sent ✓ Sent to Client (+919840123456) on WhatsApp • Task Auto-Completed in Dashboard.
✓ Dispatched

🔌 System Webhook Endpoints & API Reference

Service / Component Method & Endpoint URL Authentication / Headers Role in Workflow
n8n Inbound Webhook POST /backend/webhooks/n8n.php x-n8n-secret: dev_n8n_secret_token_12345 Receives new client emails/messages from n8n
WhatsApp Cloud API GET/POST /backend/webhooks/whatsapp.php hub.verify_token: dev_whatsapp_verify_token_12345 Direct Meta WhatsApp Business webhook integration
Post-Call Webhook POST /backend/webhooks/post-call.php Internal / Telephony bearer Captures Naga's verbal reply & triggers auto-dispatch
Executive Simulation API POST /backend/api/simulate.php Browser Session / REST Simulates incoming messages directly from Dashboard