- Created chatwoot-agent-bot/ with Node.js webhook server - Bot detects intent (greeting, billing, technical, features, account) - Auto-responds from FAQ knowledge base or escalates to human - FAQ-KB.md: Living knowledge base that grows with customer questions - CHATWOOT-SETUP.md: Complete deployment and configuration guide - Supports Telegram notifications on escalation - Bot runs on port 3001, ready for Chatwoot webhook integration
49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#!/bin/bash
|
|
# HoaLedgerIQ Sales Lead Monitor
|
|
# Polls ROI Calculator endpoint every hour during business hours
|
|
|
|
STATE_FILE="/Users/claw/.openclaw/workspace/agents/sales-lead/state.json"
|
|
LOG_FILE="/Users/claw/.openclaw/workspace/agents/sales-lead/monitor.log"
|
|
INTEGRATION_LOG="/Users/claw/.openclaw/workspace/agents/sales-lead/integration.log"
|
|
|
|
# Function to check ROI Calculator submissions (primary lead source)
|
|
check_calc_submissions() {
|
|
curl -s -H "x-admin-key: K9mP2vL8x4qR7nZ" https://www.hoaledgeriq.com/api/calc-submissions 2>/dev/null
|
|
}
|
|
|
|
# Log with timestamp
|
|
log() {
|
|
echo "[$(date -u +"%Y-%m-%dT%H:%M:%SZ")] $1" >> "$LOG_FILE"
|
|
}
|
|
|
|
# Log to integration log
|
|
log_integration() {
|
|
echo "[$(date)] $1" >> "$INTEGRATION_LOG"
|
|
}
|
|
|
|
# Main monitoring loop
|
|
log "Starting lead monitor check"
|
|
CALC_SUBS=$(check_calc_submissions)
|
|
log "ROI Calc submissions response: ${#CALC_SUBS} bytes"
|
|
|
|
# Parse and check for new submissions
|
|
if [ ${#CALC_SUBS} -gt 0 ]; then
|
|
# Extract submission IDs (simplified - just count for now)
|
|
log "Processing calc submissions..."
|
|
log_integration "✓ hoaledgeriq.com/api/calc-submissions responding"
|
|
log_integration "Response size: ${#CALC_SUBS} bytes"
|
|
fi
|
|
|
|
# Update state
|
|
cat > "$STATE_FILE" << EOF
|
|
{
|
|
"processed_leads": [],
|
|
"processed_calc_ids": [1, 2, 3, 4],
|
|
"last_check": "$(date -u +"%Y-%m-%dT%H:%M:%SZ")",
|
|
"status": "active",
|
|
"notes": "Hourly monitoring enabled. Next check in 60 minutes."
|
|
}
|
|
EOF
|
|
|
|
log "Check complete. Next run at $(date -v+60M +"%Y-%m-%dT%H:%M:%Z")"
|