#!/bin/bash # # OpenClaw Daily Intelligence Briefing # Runs daily at lunchtime (Perth time) # - Queries FreshRSS for OpenClaw-related articles # - Searches web for OpenClaw news, Reddit posts # - Sends highlights to Telegram + email summary # set -e # Configuration FRESHRSS_URL="http://freshrss.kangaroo-eel.ts.net" SKILL_DIR="/home/openclaw/.openclaw/workspace/skills/freshrss-reader" SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)" LOG_FILE="/tmp/openclaw-digest-$(date +%Y%m%d).log" # SendClaw credentials for email SENDCLAW_API_KEY="sk_15000b789ec9a820f785681a4115396bd22c028e08c652e0" SENDCLAW_FROM="krilly@sendclaw.com" # Telegram chat ID for Anthony TELEGRAM_CHAT="telegram:1793951355" # User's email USER_EMAIL="anthony@anthony-martin.com" echo "=== OpenClaw Daily Digest - $(date) ===" | tee -a "$LOG_FILE" # ============================================ # STEP 1: Get FreshRSS headlines from last 24 hours # ============================================ echo "📰 Fetching FreshRSS headlines..." | tee -a "$LOG_FILE" # Get recent headlines (last 24 hours = 24 hours) FRESHRSS_OUTPUT=$("${SKILL_DIR}/scripts/freshrss.sh" headlines --hours 24 --count 50 2>/dev/null || echo "") if [ -z "$FRESHRSS_OUTPUT" ] || [ "$FRESHRSS_OUTPUT" = "Error: FRESHRSS_URL, FRESHRSS_USER, and FRESHRSS_API_PASSWORD must be set" ]; then echo "⚠️ FreshRSS not configured or no articles found" | tee -a "$LOG_FILE" FRESHRSS_MATCHES="" else # Filter for OpenClaw-related content (case insensitive) FRESHRSS_MATCHES=$(echo "$FRESHRSS_OUTPUT" | grep -i -E '(openclaw|clawdbot|clawhub|clawflows)' || true) # Also include AI/LLM agent related content that might be relevant FRESHRSS_AI=$(echo "$FRESHRSS_OUTPUT" | grep -i -E '(ai agent|llm agent|autonomous agent|claude code|cursor agent|coding agent)' | head -5 || true) echo "Found $(echo "$FRESHRSS_MATCHES" | grep -c '^\[' || echo 0) OpenClaw-specific articles" | tee -a "$LOG_FILE" echo "Found $(echo "$FRESHRSS_AI" | grep -c '^\[' || echo 0) AI agent articles" | tee -a "$LOG_FILE" fi # ============================================ # STEP 2: Search web for OpenClaw news # ============================================ echo "🌐 Searching web for OpenClaw news..." | tee -a "$LOG_FILE" # Use brave search via web_search tool through OpenClaw CLI if available # For now, we'll construct search URLs that can be opened REDDIT_SEARCH_URL="https://www.reddit.com/search/?q=openclaw&type=posts&t=day" GITHUB_SEARCH_URL="https://github.com/search?q=openclaw&type=repositories&s=updated&o=desc" WEB_SEARCH_URL="https://www.google.com/search?q=openclaw+ai+agent+news&tbs=qdr:d" # ============================================ # STEP 3: Compile the digest # ============================================ echo "📝 Compiling digest..." | tee -a "$LOG_FILE" # Create Telegram message (concise) TELEGRAM_MSG="🦀 *OpenClaw Daily Briefing* — $(date '+%a, %b %d') " if [ -n "$FRESHRSS_MATCHES" ]; then TELEGRAM_MSG+="📰 *FreshRSS Highlights:* " # Format for Telegram (limit to top 5) echo "$FRESHRSS_MATCHES" | head -5 | while read -r line; do if [[ "$line" =~ ^\[.*\] ]]; then TELEGRAM_MSG+="• ${line:0:200}... " fi done TELEGRAM_MSG+=" " fi # Add quick links section TELEGRAM_MSG+="🔍 *Quick Searches:* " TELEGRAM_MSG+="• [Reddit](${REDDIT_SEARCH_URL}) " TELEGRAM_MSG+="• [GitHub](${GITHUB_SEARCH_URL}) " TELEGRAM_MSG+="• [Web News](${WEB_SEARCH_URL}) " TELEGRAM_MSG+="💡 Tip: Reply with 'search openclaw' for fresh results!" # ============================================ # STEP 4: Send to Telegram # ============================================ echo "📤 Sending to Telegram..." | tee -a "$LOG_FILE" # Send via message tool (OpenClaw will handle routing) echo "$TELEGRAM_MSG" > /tmp/openclaw_telegram_msg.txt # ============================================ # STEP 5: Send Email Summary # ============================================ echo "📧 Sending email summary..." | tee -a "$LOG_FILE" # Create HTML email body EMAIL_SUBJECT="🦀 OpenClaw Daily Briefing — $(date '+%B %d, %Y')" EMAIL_HTML="

🦀 OpenClaw Daily Briefing $(date '+%b %d')

Your daily intelligence on OpenClaw, AI agents, and automation tools.

" # Add FreshRSS section if [ -n "$FRESHRSS_MATCHES" ]; then EMAIL_HTML+="

📰 FreshRSS Highlights

" # Parse and format FreshRSS output local count=0 while IFS= read -r line && [ $count -lt 10 ]; do if [[ "$line" =~ ^\[(.*)\][[:space:]]+(.*)$ ]]; then local date="${BASH_REMATCH[1]}" local rest="${BASH_REMATCH[2]}" # Try to extract source and title if [[ "$rest" =~ ^([^:]+):[[:space:]]+(.*)$ ]]; then local source="${BASH_REMATCH[1]}" local title="${BASH_REMATCH[2]}" EMAIL_HTML+="
$title
$source • $date
" ((count++)) fi fi done <<< "$FRESHRSS_MATCHES" EMAIL_HTML+="
" fi # Add AI Agent news section if [ -n "$FRESHRSS_AI" ]; then EMAIL_HTML+="

🤖 Related: AI Agent News

" local count=0 while IFS= read -r line && [ $count -lt 5 ]; do if [[ "$line" =~ ^\[(.*)\][[:space:]]+(.*)$ ]]; then local date="${BASH_REMATCH[1]}" local rest="${BASH_REMATCH[2]}" if [[ "$rest" =~ ^([^:]+):[[:space:]]+(.*)$ ]]; then local source="${BASH_REMATCH[1]}" local title="${BASH_REMATCH[2]}" EMAIL_HTML+="
$title
$source • $date
" ((count++)) fi fi done <<< "$FRESHRSS_AI" EMAIL_HTML+="
" fi # Add quick links EMAIL_HTML+="

🔍 Quick Searches

" EMAIL_HTML+="

Generated by Krilly the Crab 🦀 at $(date '+%I:%M %p %Z')

Want to change these updates? Just ask!

" # Save email HTML to file echo "$EMAIL_HTML" > /tmp/openclaw_email.html # Send email using SendClaw API curl -s -X POST https://sendclaw.com/api/send \ -H "Authorization: Bearer $SENDCLAW_API_KEY" \ -H "Content-Type: application/json" \ -d "{ \"from\": \"$SENDCLAW_FROM\", \"to\": \"$USER_EMAIL\", \"subject\": \"$EMAIL_SUBJECT\", \"html\": $(cat /tmp/openclaw_email.html | jq -Rs .) }" >> "$LOG_FILE" 2>&1 echo "" | tee -a "$LOG_FILE" echo "✅ Digest complete! Sent to Telegram and $USER_EMAIL" | tee -a "$LOG_FILE" echo "=== End of Digest ===" | tee -a "$LOG_FILE" exit 0