Nebex AI Platform
System Process Guide
Complete visual and written breakdown of every process running on the platform — April 2026
Full Comment Processing Flow
pricing_query demo_request complaint compliment spam general
Lead Capture Deep-Dive
stage: awareness | status: new
challenge: "Wants pricing info" or "Wants a demo"
Comment Classification Rules
- pricing_query — price, cost, fees, kitna, rate, how much, plans
- demo_request — demo, trial, how it works, interested, show me
- complaint — problem, issue, not working, unhappy, bad
- compliment — great, amazing, love, wow, nice, excellent
- spam — follow back, promotional, gibberish, unrelated
- general — everything else, questions, curiosity
Token Expiry — What Happens
- Comment replies fail gracefully — reply saved to DB with error note
- Content Centre shows "Reply saved locally — token needs refresh"
- Health check flags Instagram API as failing
- Telegram alert fires immediately on first failure
- Fix: update FB_PAGE_TOKEN + IG_USER_TOKEN in .env, restart PM2
How to Connect a Client Account (5 Steps)
📋 How to Get the Client's Facebook Page Token
- Go to developers.facebook.com/tools/explorer
- Select the Graph API Explorer or client's Facebook App
- Click "Generate Access Token" at the top right
- Select the client's Facebook Page from the dropdown list
- Make sure these permissions are selected:
instagram_basic instagram_content_publish pages_read_engagement instagram_manage_comments - Click the blue Generate Access Token button → copy the long
EAAxxxx...string - Paste it in the Content Centre modal → click Verify
- All IDs auto-fill → click Connect Account
What Happens After Connecting
- REACH agent can post images/videos to client's Instagram
- Admin clicks "+ Create Post" to trigger REACH immediately
- All posts logged to client_social_posts (likes, reach, saves tracked)
- Client sees their posts in their microsite at nebex.in/c/slug
- Edit button lets you update token when it expires
- Disconnect button (×) removes access instantly with confirmation
Database Tables for Client Social
client_social_accounts
- client_id → links to which client
- platform → instagram / facebook
- ig_account_id → IG Business Account ID
- fb_page_id → Facebook Page ID
- access_token → stored FB Page Token
- account_name → @handle display
- status → active / inactive
- connected_at → when linked
client_social_posts
- client_id → which client
- post_type → image / video / reel
- caption → post text AI generated
- media_url → image or video URL
- permalink → live Instagram URL
- likes / comments / reach / saves
- status → posted / scheduled / failed
- posted_at → publish timestamp
instagram_comment_log
- media_id → which Instagram post
- comment_id → unique, prevents re-processing
- username → Instagram handle
- comment_text → full comment content
- classification → category assigned
- reply_sent → what we replied
- lead_captured → true / false
- processed_at → timestamp
| Time (IST) | Frequency | What Runs | Agent(s) | Output / Result |
|---|---|---|---|---|
| Every 30 min | Always on | Instagram comment monitor — fetches 8 recent posts, classifies all new comments, captures leads, sends CTA replies, hides spam | CARE / CLOSER | Leads saved to DB, Telegram alerts, auto-replies on Instagram |
| 8:30 AM | Daily | Morning health check — 25 system checks (web server, DB, all agent APIs, recent activity, system resources) | SENTINEL | Branded HTML email to ashish@nebex.in + Telegram score report |
| 10:00 AM | Daily | Instagram daily post — Herald writes caption, WaveSpeed generates image, REACH publishes to @nebex.in | REACH / HERALD / PIXEL | Post live on Instagram, Telegram confirmation with link |
| 11:00 AM | Mon / Wed / Fri | Instagram Reel — Herald writes script, ElevenLabs voice, VEO generates video, ffmpeg merges, REACH publishes as Reel | REACH / HERALD / BULBUL / PIXEL | Reel live on Instagram, Telegram confirmation |
| 9:00 PM | Daily | Evening health check — same 25 checks as morning | SENTINEL | Branded email + Telegram score to Ashish |
| On demand | Auto-triggered | Cold client re-engagement — George detects client inactive, auto-triggers CLOSER without waiting for approval | GEORGE / CLOSER | Re-engagement email sent to client |
| On payment event | Auto-triggered | Razorpay webhook → trial expiry / payment received → LEDGER checks status → CARE sends update to client | LEDGER / CARE | Client email + DB status update |
| May 27, 2026 | One-time | Meta IG_USER_TOKEN expiry reminder — token expires June 17, 2026 | SENTINEL | Telegram alert to Ashish: "Refresh Instagram token in 21 days" |
| Oct 3, 2026 | One-time | NVIDIA API key expiry reminder — key expires Oct 5, 2026 | SENTINEL | Telegram alert to Ashish: "NVIDIA key expiring in 2 days" |
SOP 1 — Instagram Token Expired
How you know it's expired
Comment monitor Telegram shows an error message. Daily posts stop publishing at 10AM. Health check email shows Instagram API: FAIL. Server error log: "Session has expired on..."
Fix — takes 5 minutes
1. Go to developers.facebook.com/tools/explorer
2. Select your app → click "Generate Access Token"
3. Select @nebex.in Facebook Page → add instagram permissions
4. Copy the new token starting with EAAxxxx
5. SSH to server and update .env: FB_PAGE_TOKEN= and IG_USER_TOKEN= (same value for both)
6. Restart: pm2 restart nebex-platform --update-env
Verify it worked
Check Content Centre → Social tab — recent posts should appear. Or wait for the next 10AM post and check Telegram for the confirmation message.
SOP 2 — Add a New Client to Platform
Step 1 — Create client account
Go to nebex.in/admin → Add Client → fill name, business type, plan → Save. System auto-creates their microsite URL at nebex.in/c/slug
Step 2 — WELCOME agent auto-fires
On creation, WELCOME agent sends a branded welcome email to the client introducing the Nebex platform and their dedicated agent team.
Step 3 — Connect their Instagram (optional)
If client wants REACH to post for them → Content Centre → Client Social → Connect Account → follow the 5-step token guide in Section 4.
Step 4 — Share their microsite link
Send client: nebex.in/c/their-slug — they can see their reports, posts, tasks, and chat directly with PIXEL for copy suggestions.
SOP 3 — Spawn an Agent Manually
Via curl command (terminal or Postman)
POST to localhost:3000/api/microsite/agents/trigger
Required fields: agentId, clientId, taskType, title, description
Correct task types per agent — CRITICAL
closer → send_proposal or follow_up_lead
scout → generate_research_report
care → send_update
sentinel → review_deliverables
ledger → check_payment_status
reach → create_client_social_post
⚠️ Wrong task types cause "Unknown task" errors and fire a Telegram alert to Ashish every time.
SOP 4 — Check Platform Health
Automatic — twice daily
SENTINEL runs 25 checks at 8:30AM and 9PM IST. You get a branded email + Telegram with a score. Target is 100%.
Manual check anytime
SSH: python3 /opt/ai-platform/scripts/health-check.py
Browser: nebex.in/health (JSON status)
PM2 logs: pm2 logs nebex-platform --lines 50
SOP 5 — Content Centre Tabs Explained
Login: nebex.in/dashboard/content
Posts — All Instagram posts published by REACH, schedule view
Comments — All IG comments, classification, reply status, timestamps
Gallery — All AI-generated images and videos stored on server
AI Costs — OpenAI + Gemini daily/monthly spend tracking
PIXEL Chat — Chat with PIXEL for reply copy suggestions + save as templates
Client Social — All client accounts + their posts + Connect Account modal
⏳ Pending — Not Yet Live
AiSensy WhatsApp Messaging
API key is live in .env. Need to create 2 WhatsApp message templates at app.aisensy.com and submit for Meta approval (1-3 days):
• nebex_eval_ready — Utility template
• nebex_followup — Marketing template
YouTube Channel Automation
Channel to be created by Ashish. Provide YouTube handle → enable YouTube Data API v3 in Google Cloud Console. Then HERALD writes scripts, PIXEL generates visuals via VEO, BULBUL does voiceover, auto-uploads via YouTube Data API.
VOICE Agent Telephony
VOICE agent JD and SOUL.md are complete. Needs Exotel or Plivo API keys configured to actually make and receive calls. Currently has no live calling capability.
A — Daily Instagram Post · Every day at 10:00 AM IST
B — Instagram Reels · Monday / Wednesday / Friday at 11:00 AM IST