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-alertsWebhook to Slack bridge (TypeScript SDK)
Verify Diurna webhook signatures and forward signed change events to Slack.
Source path:
examples/webhook-slack-bridgeCited legal Q&A (Python SDK)
Search the corpus, batch-read matching sections, and print answers with official citations.
Source path:
examples/cited-qaBill tracker CLI (Python SDK)
List bills for a jurisdiction from the terminal with cursor pagination.
Source path:
examples/bill-tracker-cliBulk export to CSV (TypeScript SDK)
Run a jurisdiction JSONL export and flatten the download into CSV.
Source path:
examples/bulk-export-csvMCP 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_URLfor another host. - Install the local SDK from the monorepo path documented in each README (
file:../../sdks/typescriptorpip install -e ../../sdks/python).