Cookbook

Runnable reference apps live under examples/ in the Diurna source tree. Each recipe includes a README, environment variables, and install steps. None of the samples embed secrets. Clone access is available for Team customers; this page documents what each recipe does and how to run it on trydiurna.com.

Start from the Developers hub for OpenAPI samples, or read change webhooks when you need push delivery instead of polling.

Recipes

  • Ordinance change alerts to Slack (TypeScript SDK)

    Poll the change feed for ordinance updates and post each record to a Slack incoming webhook.

    Source path: examples/ordinance-slack-alerts

  • Webhook to Slack bridge (TypeScript SDK)

    Verify Diurna webhook signatures and forward signed change events to Slack.

    Source path: examples/webhook-slack-bridge

  • Cited legal Q&A (Python SDK)

    Search the corpus, batch-read matching sections, and print answers with official citations.

    Source path: examples/cited-qa

  • Bill tracker CLI (Python SDK)

    List bills for a jurisdiction from the terminal with cursor pagination.

    Source path: examples/bill-tracker-cli

  • Bulk export to CSV (TypeScript SDK)

    Run a jurisdiction JSONL export and flatten the download into CSV.

    Source path: examples/bulk-export-csv

  • MCP change feed CLI (MCP over HTTP)

    Call the list_changes MCP tool with your API key for a quick smoke test.

    Source path: examples/mcp-changes-cli

Before you run code

  • Create an API key in Settings unless the README notes that search is public.
  • Point scripts at production with the default base URL, or set DIURNA_API_BASE_URL for another host.
  • Install the local SDK from the monorepo path documented in each README (file:../../sdks/typescript or pip install -e ../../sdks/python).

SDK quick links