← Back
#!/bin/bash
# Check arbitrage campaign stats and send to Telegram via Bender bot
cd /home/app/arbitrage

# Get PopAds report
POPADS=$(node popads.js report today campaign 2>&1)
BALANCE=$(node popads.js status 2>&1 | grep balance | head -1)

# Extract key metrics
IMPRESSIONS=$(echo "$POPADS" | grep -o '"impressions": [0-9]*' | head -1 | grep -o '[0-9]*')
COST=$(echo "$POPADS" | grep -o '"cost": [0-9.]*' | head -1 | grep -o '[0-9.]*')

# Format message
MSG="📊 Арбитраж — авто-чек $(TZ='America/Vancouver' date '+%H:%M PST')

🇵🇭 PH Campaign:
• Клики: ${IMPRESSIONS:-0}
• Потрачено: \$${COST:-0}
• ${BALANCE:-баланс неизвестен}

Проверь конверсии в BeMob!"

# Send via Bender bot API (localhost)
curl -s -X POST http://localhost:3001/api/notify \
  -H "Content-Type: application/json" \
  -d "{\"message\": \"$MSG\"}" 2>/dev/null

# Also log to file
echo "$(TZ='America/Vancouver' date '+%Y-%m-%d %H:%M') | clicks: ${IMPRESSIONS:-0} | cost: \$${COST:-0}" >> /home/app/arbitrage/stats.log

📜 Git History

71dd65fchore: initial commit — version control setup5 weeks ago
Show last diff
Loading...