URL Scheme Examples: Real-world automation code snippets Real-world examples demonstrating the power and flexibility of Statuz's URL Scheme API. Copy, customize, and integrate into your workflows. Quick Examples Post with One Command open "statuz://compose?text=Hello%20World!" Schedule Tomorrow Morning #!/bin/bash TOMORROW=$(date -v+1d -u +"%Y-%m-%dT14:00:00Z") # 9 AM EST TEXT="Good morning! Have a great day ☀️" ENCODED=$(printf %s "$TEXT" | jq -sRr @uri) open "statuz://schedule?text=$ENCODED&date=$TOMORROW&status=queued" Post with Screenshot #!/bin/bash screencapture -i /tmp/screenshot.png TEXT="Check this out!" ENCODED=$(printf %s "$TEXT" | jq -sRr @uri) open "statuz://compose?text=$ENCODED&media=file:///tmp/screenshot.png" Shell Script Examples Daily Standup Automation #!/bin/bash # daily-standup.sh - Schedule daily standup post DATE=$(date -v+1d -u +"%Y-%m-%dT14:00:00Z") # Tomorrow at 9 AM EST read -r -d '' TEXT << EOM Daily Standup 🎯 Yesterday: - Shipped URL scheme API - Fixed 3 bugs - Code review Today: - Documentation - Testing - Planning Blockers: None EOM ENCODED=$(printf %s "$TEXT" | jq -sRr @uri) open "statuz://schedule?text=$ENCODED&date=$DATE&status=queued" echo "Standup scheduled for tomorrow at 9 AM EST" Weekly Recap #!/bin/bash # weekly-recap.sh - Schedule Friday recap # Find next Friday at 4 PM EST FRIDAY=$(date -v friday -u +"%Y-%m-%dT21:00:00Z") TEXT="🎉 Week in Review This week we: - Launched 3 features - Fixed 12 bugs - Improved performance by 25% - Gained 50 new users Have a great weekend! 🌴" ENCODED=$(printf %s "$TEXT" | jq -sRr @uri) open "statuz://schedule?text=$ENCODED&date=$FRIDAY&status=queued" echo "Weekly recap scheduled for Friday at 4 PM EST" Screenshot to Post #!/bin/bash # screenshot-post.sh - Take screenshot and post echo "Select area to screenshot..." screencapture -i /tmp/statuz-screenshot.png if [ ! -f /tmp/statuz-screenshot.png ]; then echo "Screenshot cancelled" exit 1 fi read -p "Enter caption: " CAPTION ENCODED=$(printf %s "$CAPTION" | jq -sRr @uri) open "statuz://compose?text=$ENCODED&media=file:///tmp/statuz-screenshot.png" rm /tmp/statuz-screenshot.png Clipboard to Post #!/bin/bash # clipboard-post.sh - Post clipboard content CONTENT=$(pbpaste) if [ -z "$CONTENT" ]; then echo "Clipboard is empty" exit 1 fi ENCODED=$(printf %s "$CONTENT" | jq -sRr @uri) open "statuz://compose?text=$ENCODED" Multi-Image Thread #!/bin/bash # multi-image-thread.sh - Create thread with multiple images IMAGES=( "$HOME/Desktop/chart1.png" "$HOME/Desktop/chart2.png" "$HOME/Desktop/chart3.png" ) # Build media parameter MEDIA="" for img in "${IMAGES[@]}"; do if [ ! -f "$img" ]; then echo "Image not found: $img" exit 1 fi MEDIA="${MEDIA}file://${img}," done MEDIA=${MEDIA%,} # Remove trailing comma TEXT="📊 Q4 Results Thread Here are the key metrics from our Q4 performance: 1. Revenue Growth 2. User Acquisition 3. Retention Rates Thread with charts below 👇" ENCODED_TEXT=$(printf %s "$TEXT" | jq -sRr @uri) ENCODED_MEDIA=$(printf %s "$MEDIA" | jq -sRr @uri) open "statuz://compose?text=$ENCODED_TEXT&media=$ENCODED_MEDIA&thread=true" Python Examples Scheduled Daily Report #!/usr/bin/env python3 """ daily-report.py - Generate and schedule daily report """ import subprocess from datetime import datetime, timedelta from urllib.parse import quote def schedule_report(): # Calculate next business day at 9 AM now = datetime.now() next_day = now + timedelta(days=1) # Skip weekends while next_day.weekday() >= 5: # 5=Saturday, 6=Sunday next_day += timedelta(days=1) schedule_time = next_day.replace(hour=9, minute=0, second=0, microsecond=0) iso_time = schedule_time.strftime('%Y-%m-%dT%H:%M:%S-05:00') # EST # Generate report report = f"""📊 Daily Report - {now.strftime('%Y-%m-%d')} ✅ Tasks completed: 8 ⏳ In progress: 3 📈 Performance: +12% 🎯 On track for Q4 goals Team is doing great! 💪""" # Build URL encoded_text = quote(report) url = f"statuz://schedule?text={encoded_text}&date={iso_time}&status=queued" # Open Statuz subprocess.run(['open', url]) print(f"Report scheduled for {schedule_time.strftime('%Y-%m-%d at %I:%M %p')}") if __name__ == "__main__": schedule_report() Bulk Scheduling #!/usr/bin/env python3 """ bulk-schedule.py - Schedule multiple posts at once """ import subprocess import time from datetime import datetime, timedelta from urllib.parse import quote posts = [ { "text": "🌅 Good morning! Starting the day with positive energy", "time": "09:00" }, { "text": "📝 Mid-day check-in: How's everyone progressing?", "time": "14:00" }, { "text": "🌙 Winding down. Great work today, team!", "time": "18:00" } ] tomorrow = datetime.now() + timedelta(days=1) for post in posts: hour, minute = map(int, post["time"].split(':')) schedule_time = tomorrow.replace(hour=hour, minute=minute, second=0) iso_time = schedule_time.strftime('%Y-%m-%dT%H:%M:%S') encoded_text = quote(post["text"]) url = f"statuz://schedule?text={encoded_text}&date={iso_time}&timezone=America/New_York&status=queued" subprocess.run(['open', url]) print(f"Scheduled: {post['text'][:30]}... at {post['time']}") time.sleep(1) # Avoid race conditions print("All posts scheduled!") Web Scraping to Post #!/usr/bin/env python3 """ news-to-post.py - Fetch news and create post """ import subprocess import requests from urllib.parse import quote def fetch_and_post(): # Fetch data (example with placeholder API) response = requests.get('https://api.example.com/news/latest') data = response.json() # Format post post_text = f"""📰 Latest News {data['title']} {data['summary'][:200]}... Read more: {data['url']}""" # Create post encoded = quote(post_text) url = f"statuz://compose?text={encoded}" subprocess.run(['open', url]) if __name__ == "__main__": fetch_and_post() JavaScript/Node.js Examples Automated Tweet Storm #!/usr/bin/env node /** * tweet-storm.js - Create scheduled tweet storm */ const { exec } = require('child_process'); const { promisify } = require('util'); const execAsync = promisify(exec); const posts = [ "1/ Thread: How we scaled to 1M users 🚀", "2/ First, we optimized our database queries...", "3/ Then we implemented caching with Redis...", "4/ Finally, we moved to a microservices architecture...", "5/ The results? 10x faster load times and happier users! 📈" ]; async function createStorm() { // Combine into thread const threadText = posts.join('\n\n'); const encoded = encodeURIComponent(threadText); // Schedule for tomorrow at 2 PM const tomorrow = new Date(); tomorrow.setDate(tomorrow.getDate() + 1); tomorrow.setHours(14, 0, 0, 0); const isoDate = tomorrow.toISOString(); const url = `statuz://schedule?text=${encoded}&thread=true&date=${isoDate}&status=queued`; await execAsync(`open "${url}"`); console.log('Tweet storm scheduled for tomorrow at 2 PM'); } createStorm().catch(console.error); RSS to Social #!/usr/bin/env node /** * rss-to-social.js - Post latest blog articles */ const { exec } = require('child_process'); const Parser = require('rss-parser'); const parser = new Parser(); async function postLatest() { const feed = await parser.parseURL('https://example.com/feed.xml'); const latest = feed.items[0]; const text = `📝 New blog post: ${latest.title} ${latest.contentSnippet.substring(0, 150)}... Read more: ${latest.link}`; const encoded = encodeURIComponent(text); exec(`open "statuz://compose?text=${encoded}"`); console.log(`Posted: ${latest.title}`); } postLatest().catch(console.error); AppleScript Examples Post Selected Text -- post-selected-text.scpt -- Get selected text and post to Statuz tell application "System Events" keystroke "c" using command down delay 0.5 end tell set selectedText to the clipboard as text if selectedText is not "" then set encodedText to do shell script "printf %s " & quoted form of selectedText & " | jq -sRr @uri" set theURL to "statuz://compose?text=" & encodedText do shell script "open " & quoted form of theURL else display dialog "No text selected" buttons {"OK"} default button 1 end if Schedule Meeting Announcement -- schedule-meeting.scpt -- Create scheduled post for upcoming meeting set meetingDate to current date set time of meetingDate to (15 * hours) -- 3 PM today -- Format as ISO 8601 set isoDate to do shell script "date -j -f '%Y-%m-%d %H:%M:%S' '" & ¬ (year of meetingDate as string) & "-" & ¬ (month of meetingDate as integer) & "-" & ¬ (day of meetingDate as string) & " 15:00:00' '+%Y-%m-%dT%H:%M:%S'" set meetingText to "📅 Reminder: Team meeting at 3 PM today Agenda: - Q4 Planning - Feature Updates - Q&A Join: https://meet.example.com/team" set encodedText to do shell script "printf %s " & quoted form of meetingText & " | jq -sRr @uri" set theURL to "statuz://schedule?text=" & encodedText & "&date=" & isoDate & "&status=queued" do shell script "open " & quoted form of theURL display notification "Meeting announcement scheduled" with title "Statuz" Integration Examples Keyboard Maestro Macro Trigger: ⌃⌥⇧P Action: Execute Shell Script #!/bin/bash # Get clipboard CLIPBOARD=$(pbpaste) if [ -z "$CLIPBOARD" ]; then osascript -e 'display notification "Clipboard is empty" with title "Statuz"' exit 1 fi # Post to Statuz ENCODED=$(printf %s "$CLIPBOARD" | jq -sRr @uri) open "statuz://compose?text=$ENCODED" Hazel Rule Rule: Any image added to ~/Desktop/To Post/ Action: Run Shell Script #!/bin/bash FILEPATH="$1" TEXT="Check out this image!" ENCODED_TEXT=$(printf %s "$TEXT" | jq -sRr @uri) ENCODED_FILE=$(printf %s "file://$FILEPATH" | jq -sRr @uri) open "statuz://compose?text=$ENCODED_TEXT&media=$ENCODED_FILE" # Move to processed folder mv "$FILEPATH" ~/Desktop/Posted/ Raycast Extension #!/usr/bin/env node // @raycast.schemaVersion 1 // @raycast.title Post to Statuz // @raycast.mode fullOutput // @raycast.packageName Statuz // @raycast.argument1 { "type": "text", "placeholder": "Your post" } const { exec } = require('child_process'); const text = process.argv[2]; if (!text) { console.log('❌ No text provided'); process.exit(1); } const encoded = encodeURIComponent(text); exec(`open "statuz://compose?text=${encoded}"`, (error) => { if (error) { console.log(`❌ Error: ${error.message}`); process.exit(1); } console.log('✅ Opened in Statuz'); }); Alfred Workflow Keyword: post {query} Script: query="{query}" encoded=$(printf %s "$query" | jq -sRr @uri) open "statuz://compose?text=$encoded" LaunchBar Action -- PostToStatuz.scpt on handle_string(theString) set encodedText to do shell script "printf %s " & quoted form of theString & " | jq -sRr @uri" set theURL to "statuz://compose?text=" & encodedText do shell script "open " & quoted form of theURL end handle_string Advanced Workflows Git Commit Announcements #!/bin/bash # post-commit - Git hook to announce commits COMMIT_MSG=$(git log -1 --pretty=%B) COMMIT_HASH=$(git log -1 --pretty=%h) BRANCH=$(git branch --show-current) TEXT="🚀 Just pushed to $BRANCH $COMMIT_MSG Commit: $COMMIT_HASH" ENCODED=$(printf %s "$TEXT" | jq -sRr @uri) open "statuz://compose?text=$ENCODED&draft=true" CI/CD Integration #!/bin/bash # announce-deploy.sh - Post deployment announcement ENVIRONMENT=$1 VERSION=$2 TIMESTAMP=$(date +"%Y-%m-%d %H:%M") TEXT="✅ Deployment Complete Environment: $ENVIRONMENT Version: $VERSION Time: $TIMESTAMP All systems operational 🎉" ENCODED=$(printf %s "$TEXT" | jq -sRr @uri) open "statuz://compose?text=$ENCODED" Automated Product Updates #!/bin/bash # announce-release.sh - Schedule product update announcement VERSION=$(cat VERSION) RELEASE_DATE=$(date -v+1d -u +"%Y-%m-%dT15:00:00Z") # Tomorrow at 10 AM EST TEXT="🎉 Announcing v${VERSION}! New features: - Feature A - Feature B - Feature C Download now: https://example.com/download" ENCODED=$(printf %s "$TEXT" | jq -sRr @uri) open "statuz://schedule?text=$ENCODED&date=$RELEASE_DATE&status=queued" echo "Release announcement scheduled for tomorrow at 10 AM EST" Tips & Best Practices URL Encoding Always encode text parameters: # ✅ Correct ENCODED=$(printf %s "$TEXT" | jq -sRr @uri) open "statuz://compose?text=$ENCODED" # ❌ Wrong open "statuz://compose?text=$TEXT" Error Handling #!/bin/bash set -e # Exit on error if ! command -v jq &> /dev/null; then echo "Error: jq is required. Install with: brew install jq" exit 1 fi if [ -z "$TEXT" ]; then echo "Error: Text is empty" exit 1 fi Rate Limiting Add delays between bulk operations: for post in "${posts[@]}"; do # ... post logic ... sleep 1 # Wait 1 second between posts done Date Formatting Use consistent ISO 8601 format: # ✅ Correct DATE=$(date -u +"%Y-%m-%dT%H:%M:%SZ") # ❌ Avoid DATE=$(date) # Non-standard format Related • URL Scheme Overview (/docs/url-scheme-overview) • Compose Action (/docs/url-scheme-compose) • Schedule Action (/docs/url-scheme-schedule) • Automation Guide (/docs/automation-guide) Try Statuz today, it's free. Download for macOS (/download)