Skip to main content
Synced from the repo — do not edit here

Canonical source: docs/claude/atlas-api-webhooks.md. This page is generated by docs/scripts/sync-handbook.mjs. Edit the source file in the repo; changes appear here on the next build.

Atlas API, Webhooks & MCP Testing

Atlas API

Test the Atlas REST API for external agent access:

ATLAS_URL="https://atlas-api-kfibb7ltgq-uc.a.run.app"
API_KEY="basis_YOUR_KEY_HERE"
CLINIC_ID="axuk-khwf-prkr"

# Simple query
curl -s -X POST "$ATLAS_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"query\": \"What services do we offer?\", \"clinic_id\": \"$CLINIC_ID\"}" | jq

# Query about clients
curl -s -X POST "$ATLAS_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"query\": \"List our active clients\", \"clinic_id\": \"$CLINIC_ID\"}" | jq

# Query about staff
curl -s -X POST "$ATLAS_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d "{\"query\": \"Who is on our team?\", \"clinic_id\": \"$CLINIC_ID\"}" | jq

Atlas API Usage Notes

# CORRECT - always pass clinic_id
curl -X POST ... -d '{"query": "...", "clinic_id": "axuk-khwf-prkr"}'

# WRONG - missing clinic_id -> 400 error for clinical queries
curl -X POST ... -d '{"query": "..."}'

If clinic_id is omitted: The API checks key_config.clinicId (from Firestore key doc) as fallback. If neither exists, returns 400 for non-support queries.

MCP Server

Test the Model Context Protocol server for AI agent integrations:

MCP_URL="https://mcp-server-kfibb7ltgq-uc.a.run.app"
API_KEY="basis_YOUR_KEY_HERE"

# Get server capabilities
curl -s -X POST "$MCP_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "mcp/capabilities", "params": {}, "id": 1}' | jq

# List available tools
curl -s -X POST "$MCP_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 2}' | jq

# List tool names only
curl -s -X POST "$MCP_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{"jsonrpc": "2.0", "method": "tools/list", "params": {}, "id": 2}' | jq '.result.tools[] | .name'

# Call Atlas via MCP
curl -s -X POST "$MCP_URL" \
-H "X-API-Key: $API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"toolName": "atlas_query",
"toolArguments": {
"query": "What memberships do we have?",
"clinic_id": "axuk-khwf-prkr"
}
},
"id": 3
}' | jq

Webhooks

Test webhook configuration and delivery:

WEBHOOK_URL="https://configure-webhooks-kfibb7ltgq-uc.a.run.app"
CLINIC_ID="axuk-khwf-prkr"

# Configure webhook endpoint
curl -s -X POST "$WEBHOOK_URL" \
-H "Content-Type: application/json" \
-d '{
"clinic_id": "'"$CLINIC_ID"'",
"webhook_url": "https://your-endpoint.com/webhook",
"webhook_secret": "your-secret-key",
"events": ["note.created", "appointment.created", "lab.created"],
"slack_channel": "C02LERK1X9P"
}' | jq

Webhook Event Types

EventTrigger
note.createdNew clinical note
lab.createdNew lab results
appointment.createdNew appointment booked
appointment.updatedAppointment modified/cancelled
client.createdNew client registered

API Key Management

# Create a new API key (requires ADMIN_API_SECRET)
curl -s -X POST "https://create-atlas-api-key-kfibb7ltgq-uc.a.run.app" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer YOUR_ADMIN_SECRET" \
-d '{
"name": "OpenClaw Agent",
"permissions": ["atlas", "read"],
"rate_limit": 100
}' | jq

Available permissions: atlas (full query access), read (read clinic data), support (support tickets), code_analysis (codebase analysis), admin (full access)

Slack Support Bot

Test Slack bot event handling:

# Backfill historical messages
curl -s -X POST "https://backfill-slack-history-kfibb7ltgq-uc.a.run.app" \
-H "Content-Type: application/json" \
-d '{
"channel_id": "C07FQKWN2AD",
"start_date": "2025-08-01",
"end_date": "2026-02-18"
}' | jq

Support ticket Firestore location: clinicsv2/{clinicId}/support_tickets/{ticketId}

Ticket statuses: pending -> clarificationNeeded -> ready -> scoped -> resolved