External Integrations

Reference for all external service integrations in the Levandor CRM.

Billingo (Invoice Platform)

Two-way integration for invoicing and vendor bill tracking.

Outbound: Invoice Sync

  • Edge function: billingo-sync-statuses
  • Purpose: Syncs invoice payment statuses from Billingo back to CRM
  • Implementation: 13.7K Deno edge function, polls Billingo API for status changes

Inbound: Vendor Bill Sync

  • Edge function: billingo-sync-inbound
  • Purpose: Imports vendor bills (expenses) from Billingo into the budget system
  • Data flow: Billingo API spendings endpoint vendor_bill table budget_transaction (for paid bills)
  • Key mapping: See Vendor Bills (Billingo Integration) for field mappings

Known Gotcha

Billingo API field names differ significantly from their documentation. Always inspect actual API responses. See Billingo Vendor Bill Sync - Null Fields (2026-03-11).

GitHub (PR Sync)

  • Agent: agents/github-pr-sync/ (Rust)
  • Shared library: agents/pr-sync-common/ (Provider trait)
  • Purpose: Syncs GitHub pull requests into CRM task sources for tracking work across repos
  • Data flow: GitHub API agent task_source table in Supabase
  • Managed by: crm_communicator_v2 daemon

GitLab (MR Sync)

  • Agent: agents/gitlab-pr-sync/ (Rust)
  • Shared library: agents/pr-sync-common/ (same Provider trait as GitHub)
  • Purpose: Syncs GitLab merge requests into CRM task sources
  • Data flow: GitLab API agent task_source table in Supabase
  • Managed by: crm_communicator_v2 daemon

Jira (CDP Sync)

  • Agent: agents/jira-cdp-sync/ (standalone TypeScript)
  • Method: Puppeteer-based CDP (Chrome DevTools Protocol) scraping
  • Purpose: Scrapes Jira data into the CRM (not using Jira’s REST API)
  • Implementation: 7 TypeScript files including intercept.ts (8.8K) for request interception and supabase.ts (16.1K) for data mapping
  • Note: Standalone TypeScript project, not part of the pnpm workspace
  • Managed by: crm_communicator_v2 daemon

Linear (Outbound Task Sync)

  • Edge function: sync-outbound
  • Purpose: Pushes task changes from CRM to Linear for external visibility
  • Sync direction: Outbound and bidirectional (configured per task_source record)
  • Implementation: Checks task_source records with sync_direction IN (OUTBOUND, BIDIRECTIONAL), compares last_synced_at with task.updated_at, and pushes title/description changes via linearAdapter.pushOutbound()
  • Adapter: web/supabase/functions/_shared/adapters/linear.ts

Apple Reminders (EventKit Sync)

  • Agent: agent/ (Swift, macOS native)
  • Purpose: Two-way sync between CRM tasks and Apple Reminders
  • Implementation: SwiftUI app with EventKit framework for Reminders access
  • Source files: main.swift, Config.swift, SupabaseClient.swift, automations/
  • Runs on: macOS only (requires EventKit permissions)
  • Managed by: crm_communicator_v2 daemon

Tailscale (Service Health)

  • Edge function: service-health
  • Purpose: Monitors device health across the Tailscale network
  • Implementation: Queries Tailscale API for device list and status, checks each device’s last-seen time
  • Credentials: TAILSCALE_API_KEY and TAILSCALE_TAILNET env vars
  • UI: Service Health page at /service-health

Cloudflare

Pages (Deployment)

  • Config: web/wrangler.jsonc
  • Project: levandor-crm
  • Mode: SPA (not_found_handling: "single-page-application")
  • Deploy command: pnpm --filter web deploy

Access ZTNA (Authentication)

  • Purpose: Edge-level authentication for the admin CRM
  • Implementation: Users authenticate via CF Access before the SPA loads
  • Token: CF_Authorization cookie parsed by web/src/lib/cf-access.ts
  • See security for full auth architecture

Workers (Email)

  • Purpose: Email ingestion with AI parsing
  • Edge function: ingest-email receives parsed emails from a CF Worker

Market Data (Yahoo Finance)

  • Edge function: market-data
  • Purpose: Commodity price tracking for the dashboard
  • Symbols: Gold (GC=F), Brent Oil (BZ=F), EU Gas TTF (TTF=F)
  • Source: Yahoo Finance v8 chart API (1-month daily candles)
  • Returns: Current price, 30-day change percentage, daily price series

Polymarket (Top-Trader Pipeline)

  • Polymarket top-trader pipeline → polymarket-fetch
  • External Rust binary writes pm_* tables in the mgmt Supabase project. CRM consumes via createTableQuery once database.types.ts is regenerated.

Agent Supervisor

All background agents (GitHub, GitLab, Jira, Apple Reminders) are managed by crm_communicator_v2/:

  • Language: Rust
  • Components: CLI + daemon + TUI
  • Source: crm_communicator_v2/src/ (cli/, daemon/, platform/, state/, supabase/, tui/)
  • Purpose: Start/stop/monitor agent processes, manage lifecycle