cat <<‘EOF’ > “$HOME/Desktop/imessage_blast.sh”
#!/bin/bash
# Default files
csv=”$HOME/Desktop/contacts.csv”
logfile=”$HOME/Desktop/imessage_blast_log.txt”
default_message=”Hi {name}, this is Ray! Just reaching out—feel free to reply here or text me back directly. Hope all is well.”
# Webhook logging (optional)
webhook_url=””
# Profile support: ./imessage_blast.sh clients [–test]
[[ -n “$1” && “$1” != “–test” ]] && csv=”$HOME/Desktop/contacts_${1}.csv”
# Test flag detection
test_mode=false
[[ “$1” == “–test” || “$2” == “–test” ]] && test_mode=true
# Check CSV
if [ ! -f “$csv” ]; then
echo “❌ CSV not found: $csv”
osascript -e ‘display notification “CSV file missing.” with title “iMessage Blast Error”‘ exit 1
fi
# Log start
echo “🚀 Launching message blast @ $(date)” > “$logfile”
# Process rows (number,name)
tail -n +2 “$csv” | while IFS=, read -r number name; do
number=$(echo “$number” | xargs)
name=$(echo “${name:-there}” | xargs)
[[ -z “$number” ]] && continue
message=$(echo “$default_message” | sed “s/{name}/$name/g”) echo “📤 Sending to $number ($name)” | tee -a “$logfile”
if [ “$test_mode” = true ]; then
echo “🧪 TEST: $message” | tee -a “$logfile”
else
osascript </dev/null fi
sleep 1
done
# Wrap-up
echo “✅ All done @ $(date)” | tee -a “$logfile”
osascript -e ‘display notification “All messages sent!” with title “iMessage Blast Complete”‘ EOF
chmod +x “$HOME/Desktop/imessage_blast.sh”
echo “🎉 Script saved to Desktop as ‘imessage_blast.sh’. Run it via Terminal or attach it to a Shortcut!” Sent from my iPhone