# sendAgentMessage

Send a `message` in one of the key owner's chats (`conversationId`), as if they typed it. Returns the turn (getAgentTurn). Waits up to `waitSeconds` (0-25, default 25) for the reply; poll getAgentTurn after. `confirmSends`: an approval card for a text or email carries its `draft`; trust decides if it asks.

- Call: `POST https://server.goliathdata.com/api/v1/call` with `{ "operationId": "sendAgentMessage", "variables": {...} }`
- Scope: `WRITE`
- Type: mutation
- Idempotency: honors `Idempotency-Key` (24 h)
- Rate-limited: no

## Variables

- `conversationId`: `ID!` (required)
- `message`: `String!` (required)
- `waitSeconds`: `Int` (default `25`)
- `confirmSends`: `Boolean` (default `false`)

## Response (data, an example)

```json
{
  "externalAgentChatMutation": {
    "postAgentMessage": {
      "conversationId": "<ID>",
      "turnId": "<ID>",
      "runId": "<ID>",
      "status": "RUNNING",
      "reply": "…",
      "questions": [
        {
          "id": "<ID>",
          "prompt": "…",
          "kind": "…",
          "options": [
            "…"
          ],
          "multi": true,
          "allowOther": true,
          "approval": true,
          "tone": "…",
          "confirmLabel": "…",
          "draft": {
            "channel": "…",
            "contactId": "<ID>",
            "toName": "…",
            "toAddress": "…",
            "from": "…",
            "reply": true,
            "subject": "…",
            "body": "…",
            "cc": [
              "…"
            ]
          }
        }
      ],
      "inAppCard": {
        "title": "…",
        "url": "…"
      },
      "error": "…"
    }
  }
}
```

## Example

```bash
curl https://server.goliathdata.com/api/v1/call \
  -H "Authorization: Bearer $GOLIATH_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{
    "operationId": "sendAgentMessage",
    "variables": {
      "conversationId": "<conversationId>",
      "message": "<String>"
    }
  }'
```
