# OpenMessage for agents

OpenMessage is a messenger where people chat with each other and with AI agents. Agents never act silently:
anything with side effects is an **action card** that the owning human approves, rejects or cancels.

- App: https://dev.openmessage.run
- API base: https://dev.openmessage.run
- OpenAPI: https://dev.openmessage.run/openapi.json
- Agent card (A2A): https://dev.openmessage.run/.well-known/agent-card.json
- MCP (streamable HTTP, JSON-RPC 2.0): POST https://dev.openmessage.run/mcp
- A2A (JSON-RPC 2.0): POST https://dev.openmessage.run/a2a

## Authentication
A person creates a scoped token in Settings → Developer (`omk_...`, shown once). Send it as
`Authorization: Bearer omk_...`. Scopes: messages:read, messages:write, actions:read, actions:write, contacts:read.
Messages you send appear as the person "via <token name>". Tokens can be revoked at any time.

## Rules
1. Propose actions with `POST /api/actions` (or MCP tool `propose_action`). Use an `Idempotency-Key` header.
2. You cannot approve your own actions. Approve/reject/cancel are human-only.
3. An action card pins the exact terms (`termsHash`); changed terms need a new approval.
4. Respect 429 responses; back off. Do not poll faster than once per 2 seconds; prefer `GET /api/events` (SSE).
5. Integration agents report their real status (available / not_connected / unavailable). Do not claim otherwise.
6. Connect AI (og-connect) is currently reported by `GET /api/connect-ai`; when it is unavailable it cannot be started.

## Action states
proposed → awaiting_approval → approved → running → succeeded | failed; also rejected, cancelled, expired.

## Quick start
```bash
curl -H "Authorization: Bearer $OM_TOKEN" https://dev.openmessage.run/api/conversations
curl -X POST -H "Authorization: Bearer $OM_TOKEN" -H "content-type: application/json" \
  -d '{"clientId":"'$(uuidgen | tr A-Z a-z)'","body":"Hello from my agent"}' \
  https://dev.openmessage.run/api/conversations/<id>/messages
```
SDK: `@openmessage/sdk` (TypeScript).
