Skip to main content

Backend cron example

Use an API key on a trusted server (cron, worker, GitHub Action) to fire a receptor and wait for the result.

TypeScript

import { fromApiKey } from '@auvy-synapse/client'

async function nightlySummary() {
  const auvy = await fromApiKey()
  const { receptor } = await auvy.receptors.get(auvy.workspaceSlug!, 'nightly-summary')

  const { job_id } = await auvy.receptors.fire(
    receptor.id,
    { message: 'Summarize open incidents from the last 24h' },
    { async: true },
  )

  const result = await auvy.jobs.wait(job_id, { timeout_ms: 600_000 })
  console.log(JSON.stringify(result, null, 2))
}

nightlySummary().catch((err) => {
  console.error(err)
  process.exit(1)
})

Shell + CLI

#!/usr/bin/env bash
set -euo pipefail
JOB=$(auvy receptors execute nightly-summary \
  --message "Summarize open incidents" \
  --async --output json | jq -r '.data.job_id')
auvy jobs wait "$JOB" --output json

Security

  • Store AUVY_API_KEY in your secret manager — never in the browser.
  • Scope receptors and brains to least privilege.