# Add a message to a ticket > Reply to the customer behind a ticket as a teammate, or leave a private note for your team A QwryAI ticket belongs to a conversation, and replies go through that conversation. The `send_agent_message` tool sends your reply to the customer on the conversation's channel as a human agent. The `add_internal_note` tool adds a note only your team sees. Both act as the member who created the API key. ```http POST https://api.qwryai.com/public/v1/tools/send_agent_message ``` For a private note, call `POST https://api.qwryai.com/public/v1/tools/add_internal_note` with `note` in place of `content`. > [!WARNING] > > A reply takes the conversation over. It's assigned to the key's creator and the AI stops answering in it until the conversation is resolved, just like replying from the **Inbox**. A note changes nothing for the customer. ## Authentication Send your API key as `Authorization: Bearer YOUR_API_KEY`. The key needs **Manage conversations and helpdesk**. See [Authentication](/docs/api-reference/v2/authentication). ## Body parameters > [tab] send_agent_message > > | Name | Type | Required | Description | > | - | - | - | - | > | `chatbotId` | string | Yes | The agent's id, from `list_agents`. | > | `conversationId` | string | Yes | The ticket's conversation, as the `_id` that `query_conversations` or `search_conversations` returns. | > | `content` | string | Yes | The reply the customer receives, 1 to 10,000 characters. | > [tab] add_internal_note > > | Name | Type | Required | Description | > | - | - | - | - | > | `chatbotId` | string | Yes | The agent's id, from `list_agents`. | > | `conversationId` | string | Yes | The ticket's conversation, as the `_id` that `query_conversations` or `search_conversations` returns. | > | `note` | string | Yes | The note for your team, 1 to 5,000 characters. The customer never sees it. | ### Finding the ticket's conversation These tools take the conversation's `_id`, not the ticket number. Find it with `query_conversations`, filtering by the customer's name or email in `contact`: ```bash curl -X POST 'https://api.qwryai.com/public/v1/tools/query_conversations' \ -H 'Authorization: Bearer YOUR_API_KEY' \ -H 'Content-Type: application/json' \ -d '{ "chatbotId": "YOUR_AGENT_ID", "startDate": "2026-11-30", "endDate": "2026-11-30", "page": 1, "contact": "sam.tester@example.com" }' ``` Each item's `_id` is the value to pass as `conversationId`. See [List conversations](/docs/api-reference/v2/conversations/list-conversations). ## Request example > [tab] cURL > > ```bash > curl -X POST 'https://api.qwryai.com/public/v1/tools/send_agent_message' \ > -H 'Authorization: Bearer YOUR_API_KEY' \ > -H 'Content-Type: application/json' \ > -d '{ > "chatbotId": "YOUR_AGENT_ID", > "conversationId": "CONVERSATION_ID", > "content": "Hi Sam, the courier confirmed order 1043 arrives tomorrow. Sorry for the wait!" > }' > ``` > [tab] JavaScript > > ```javascript > const response = await fetch("https://api.qwryai.com/public/v1/tools/send_agent_message", { > method: "POST", > headers: { > Authorization: "Bearer YOUR_API_KEY", > "Content-Type": "application/json", > }, > body: JSON.stringify({ > chatbotId: "YOUR_AGENT_ID", > conversationId: "CONVERSATION_ID", > content: "Hi Sam, the courier confirmed order 1043 arrives tomorrow. Sorry for the wait!", > }), > }); > const { data } = await response.json(); > ``` > [tab] Python > > ```python > import requests > > response = requests.post( > "https://api.qwryai.com/public/v1/tools/add_internal_note", > headers={"Authorization": "Bearer YOUR_API_KEY"}, > json={ > "chatbotId": "YOUR_AGENT_ID", > "conversationId": "CONVERSATION_ID", > "note": "Courier confirmed delivery for tomorrow.", > }, > ) > data = response.json()["data"] > ``` ## Response Neither tool is reviewed: the reply or note is sent as soon as the call succeeds. > [tab] send_agent_message > > ```json > { > "success": true, > "data": { > "conversationId": "CONVERSATION_ID", > "messageId": "", > "sent": true > } > } > ``` > [tab] add_internal_note > > ```json > { > "success": true, > "data": { > "conversationId": "CONVERSATION_ID", > "noteId": "", > "added": true > } > } > ``` | Field | Type | Description | | - | - | - | | `conversationId` | string | The conversation you wrote in. | | `messageId` | string or null | The reply's message id. | | `noteId` | string | The note's message id. | | `sent`, `added` | boolean | `true` once the reply or note is saved. | To close the conversation afterwards, call `resolve_conversation` with the same `conversationId`. ## Errors | HTTP status | code | When | | - | - | - | | 400 | `INVALID_ARGUMENTS` | `conversationId` isn't a conversation `_id`, or `content` or `note` is empty or too long. | | 400 | `CHATBOT_ID_REQUIRED` | `chatbotId` is missing or isn't a valid agent id. | | 403 | `INSUFFICIENT_PERMISSION` | The key doesn't hold **Manage conversations and helpdesk**. | | 404 | `CHATBOT_NOT_FOUND` | No agent with that `chatbotId` in your workspace. | | 404 | `CONVERSATION_NOT_FOUND` | No conversation with that id belongs to this agent. | If the Inbox refuses the reply, the error carries the Inbox's own code and HTTP status. See [Error Handling](/docs/api-reference/v2/error-handling) for authentication and rate-limit errors.