3-Tier Sync & Universal Ingestion Engine

Native Google OAuth2, Apple iCloud CalDAV/CardDAV open protocols, and Universal Webhook Bridges.

Tier 1 · OAuth2 REST CONNECTED

Google Workspace

Native bidirectional sync for Google Calendar events, Gmail triage, and Google Contacts.

Account:ganesh@sam.local
Scopes:Calendar, Mail, Contacts
Last Synced: 5m agoSync OK
Tier 2 · Open Protocols CONNECTED

Apple iCloud CalDAV / CardDAV

Universal RFC 4791 CalDAV client for iCloud Calendar and RFC 6352 CardDAV for Address Book.

CalDAV Host:caldav.icloud.com
User:ganesh.icloud@apple.com
Last Synced: 18m agoiCloud Synced
Tier 3 · Universal Bridge ACTIVE

Local Bridge & Webhooks

Authenticated REST ingestion endpoints for macOS JXA Apple Notes daemon, iOS Shortcuts, and SMS.

Endpoints:/api/v1/ingest/*
Active Keys:0 Authorized
Status: HealthyReady for POST

API Keys & Ingestion Secrets

Bridge Script & iOS Shortcuts Generator

/**
 * SAM OS — macOS Apple Notes Sync Daemon
 * Reads local macOS Apple Notes via ScriptingBridge/JXA and syncs to SAM OS
 * Run via: node sam-apple-notes-sync.js
 */

const { execSync } = require('child_process');
const SAM_API_URL = 'http://localhost:3000/api/v1/ingest/apple-notes';
const API_KEY = 'sam_mac_live_key_token';

function getAppleNotes() {
  const script = `
    const Notes = Application('Notes');
    const notes = Notes.notes();
    const result = [];
    for (let i = 0; i < Math.min(notes.length, 25); i++) {
      const n = notes[i];
      result.push({
        externalId: n.id(),
        title: n.name(),
        content: n.body(),
        modifiedAt: n.modificationDate()
      });
    }
    JSON.stringify(result);
  `;

  try {
    const raw = execSync(`osascript -l JavaScript -e "${script.replace(/"/g, '\\"')}"`, { encoding: 'utf8' });
    return JSON.parse(raw);
  } catch (err) {
    console.error('Failed to query Apple Notes:', err.message);
    return [];
  }
}

async function syncToSam() {
  const notes = getAppleNotes();
  if (notes.length === 0) return;

  const res = await fetch(SAM_API_URL, {
    method: 'POST',
    headers: {
      'Content-Type': 'application/json',
      'x-api-key': API_KEY
    },
    body: JSON.stringify({ notes })
  });
  console.log('Synced to SAM OS:', await res.json());
}

syncToSam();
setInterval(syncToSam, 60000); // Poll every 60s
Test Ingestion Live: