> For the complete documentation index, see [llms.txt](https://apidocs.akinon.com/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://apidocs.akinon.com/commerce-openapis/admin/conversations/conversation-messages/append-a-message-to-a-conversation.md). Agents can also search and read this documentation through its [MCP server](https://apidocs.akinon.com/~gitbook/mcp).

# Append a message to a conversation

Appends one message to an existing conversation. It never opens a conversation — use `POST /conversations/` for that.

**Who may call it.** Staff, or the customer who owns the conversation (signed in as themselves). Any other caller posting into a conversation that is not theirs is refused with `403`; that check runs after the body and the rules below are checked, so a `400` or `406` is reported first.

**In whose name.** `content_type` and `content_id` name the author:

* `datasource` — writing as the seller. Only staff may, and `content_id` must be the conversation's own data source.
* `user` — writing as a customer. A customer must use their own user id; staff may write in any customer's name.

Anything else is refused with `400` and `{"non_field_errors": ["Users do not match."]}`. A request without credentials is answered the same way, with `400` rather than `401`.

**What the conversation accepts.** Refusals are answered with `406` and `{"non_field_errors": "<message>", "error_code": "<code>"}`.

| Kind       | Seller message                                                   | Customer message                                                             |
| ---------- | ---------------------------------------------------------------- | ---------------------------------------------------------------------------- |
| `review`   | Refused: `conversation_100_9` (`A review cannot be replied to.`) | Refused: `conversation_100_10` (`A review is written once, not added to.`)   |
| `question` | Accepted — the seller's answer                                   | Refused: `conversation_100_10` (`A question is written once, not added to.`) |
| `message`  | Accepted                                                         | Accepted                                                                     |

**Effects.** A seller message sets `is_answered` to `true` (recording `marked_answered` if it was `false`), records a `replied` event, e-mails the customer with the Conversation Replied template and emits the `conversation_replied` webhook. It is not moderated: on an approved question it appears on the storefront straight away, on a pending one as soon as the question is approved. A customer message sets `is_answered` to `false`, recording `marked_unanswered` if it was `true`.

`message_content` is limited to 500 characters, the same limit as when a conversation is opened; a longer message is refused with `400`.

Requests are rate-limited under the `send-message` scope; see **Conversation Messages**.

```json
{"openapi":"3.1.0","info":{"title":"Admin API","version":"1.0.0"},"tags":[{"name":"Conversation Messages","description":"A single endpoint for **appending a message** to an existing conversation — a seller's answer to a question, or either side's next message in a private conversation. To open a new conversation, use `POST /conversations/`.\n\nUnlike the rest of this section, it is not limited to staff. The customer who owns a conversation may call it signed in as themselves, but only in their own name. Staff write as the conversation's seller, or in a customer's name.\n\n## What Each Kind Accepts\n\n| Kind | Seller message (`content_type: datasource`) | Customer message (`content_type: user`) |\n|------|---------------------------------------------|-----------------------------------------|\n| `review` | Refused — a review cannot be replied to (`conversation_100_9`) | Refused — a review is written once (`conversation_100_10`) |\n| `question` | Accepted — the seller's answer | Refused — a question is written once (`conversation_100_10`) |\n| `message` | Accepted | Accepted |\n\nRefusals are answered with `406`; see **Errors** under **Conversations**.\n\n## Effects\n\n* **Seller message** — sets `is_answered` to `true` (recording `marked_answered` if it was `false`), records a `replied` event, e-mails the customer with the Conversation Replied template and emits the `conversation_replied` webhook. A seller reply is not moderated: a reply to an approved question appears on the storefront straight away, and a reply to a pending question appears as soon as the question is approved.\n* **Customer message** — sets `is_answered` back to `false`, recording `marked_unanswered` if it was `true`.\n\n## Dynamic Settings & Environment Variables\n\n| Key | Type | Default | Effect |\n|-----|------|---------|--------|\n| `THROTTLING_SETTINGS` | object — scope → `{\"count\": N, \"duration\": seconds}` | `send-message`: 10 requests per 60 seconds | The `send-message` scope limits how often each caller — counted per user, or per client IP when unauthenticated — may post a message. The count is shared with the storefront's `/users/conversations/` endpoint, where listing and reading conversations count too. Requests over the limit are answered with `429`, except the first one from a client not yet flagged, which is let through once. |\n\n`DISABLED_EMAIL_TEMPLATES` and `EMAIL_BCC_AND_CC` apply to the reply e-mail as described under **Conversations**."}],"servers":[{"description":"Omnitron Remote Proxy (external access — recommended)","url":"https://{omnitron_url}/api/v1/remote/{channel_id}","variables":{"omnitron_url":{"default":"sandbox.akinon.com","description":"Omnitron server URL (e.g., {omnitron.akinon.com})"},"channel_id":{"default":"1","description":"The channel identifier the remote request is routed through"}}},{"description":"Commerce API Server (internal / direct access only)","url":"https://{commerce_url}/api/v1","variables":{"commerce_url":{"default":"sandbox.akinon.com","description":"Internal commerce server URL, reachable only from within the Omnitron network"}}}],"security":[{"tokenAuth":[]}],"components":{"securitySchemes":{"tokenAuth":{"type":"apiKey","in":"header","name":"Authorization","description":"Token credential sent in the Authorization header, in the form: `Token <your-token>`. Requires a staff (admin) account."}},"schemas":{"ConversationMessageRequest":{"type":"object","description":"One message to append to an existing conversation.","required":["conversation","message_content","user_type","content_type","content_id"],"properties":{"conversation":{"type":"integer","description":"The identifier of the conversation to append to."},"message_content":{"type":"string","maxLength":500,"description":"The message text. Must not be blank."},"user_type":{"type":"string","enum":["guest","registered"],"description":"Whether the author writes as a guest or as a registered user."},"content_type":{"type":"string","enum":["user","datasource"],"description":"Who writes the message — a customer (`user`) or the seller (`datasource`, staff only)."},"content_id":{"type":"integer","minimum":1,"description":"The identifier of the author. For `datasource`, the conversation's own data source; for `user`, the caller's own user id unless the caller is staff."}}},"ConversationMessageResponse":{"type":"object","description":"The appended message, echoing the request.","properties":{"conversation":{"type":"integer","description":"The identifier of the conversation."},"message_content":{"type":"string","description":"The message text."},"user_type":{"type":"string","enum":["guest","registered"],"description":"Whether the author wrote as a guest or as a registered user."},"content_id":{"type":"integer","description":"The identifier of the author."},"content_type":{"type":"string","enum":["user","datasource"],"description":"Who wrote the message."}}},"ValidationError":{"type":"object","description":"Returned when the request contains invalid or missing data. Errors are grouped by the field they apply to: each key is the name of a field from the request and its value is a list of one or more messages describing what is wrong with that field. Messages that do not belong to any single field are grouped under `non_field_errors`.","properties":{"non_field_errors":{"type":"array","description":"Error messages that apply to the request as a whole rather than to a specific field.","items":{"type":"string"}}},"additionalProperties":{"type":"array","description":"The list of error messages for the field named by the key.","items":{"type":"string"}}},"Error":{"type":"object","description":"An error response.","properties":{"detail":{"type":"string","description":"A human-readable description of the error."}},"additionalProperties":true},"ConversationBusinessError":{"type":"object","description":"Returned with `406` when a conversation request is valid in form but breaks a rule of the conversation's kind or state. Unlike validation errors, `non_field_errors` is a single string, not a list.\n\nThe message is translated, so match on `error_code` rather than on the message text. The codes are listed under **Errors** in the **Conversations** section introduction.","properties":{"non_field_errors":{"type":"string","description":"A human-readable message describing the rule that was broken, translated to the request language."},"error_code":{"type":"string","description":"A stable code identifying the rule, `conversation_100_1` to `conversation_100_14`."}},"additionalProperties":true}}},"paths":{"/messages/":{"post":{"tags":["Conversation Messages"],"operationId":"createConversationMessage","summary":"Append a message to a conversation","description":"Appends one message to an existing conversation. It never opens a conversation — use `POST /conversations/` for that.\n\n**Who may call it.** Staff, or the customer who owns the conversation (signed in as themselves). Any other caller posting into a conversation that is not theirs is refused with `403`; that check runs after the body and the rules below are checked, so a `400` or `406` is reported first.\n\n**In whose name.** `content_type` and `content_id` name the author:\n* `datasource` — writing as the seller. Only staff may, and `content_id` must be the conversation's own data source.\n* `user` — writing as a customer. A customer must use their own user id; staff may write in any customer's name.\n\nAnything else is refused with `400` and `{\"non_field_errors\": [\"Users do not match.\"]}`. A request without credentials is answered the same way, with `400` rather than `401`.\n\n**What the conversation accepts.** Refusals are answered with `406` and `{\"non_field_errors\": \"<message>\", \"error_code\": \"<code>\"}`.\n\n| Kind | Seller message | Customer message |\n|------|----------------|------------------|\n| `review` | Refused: `conversation_100_9` (`A review cannot be replied to.`) | Refused: `conversation_100_10` (`A review is written once, not added to.`) |\n| `question` | Accepted — the seller's answer | Refused: `conversation_100_10` (`A question is written once, not added to.`) |\n| `message` | Accepted | Accepted |\n\n**Effects.** A seller message sets `is_answered` to `true` (recording `marked_answered` if it was `false`), records a `replied` event, e-mails the customer with the Conversation Replied template and emits the `conversation_replied` webhook. It is not moderated: on an approved question it appears on the storefront straight away, on a pending one as soon as the question is approved. A customer message sets `is_answered` to `false`, recording `marked_unanswered` if it was `true`.\n\n`message_content` is limited to 500 characters, the same limit as when a conversation is opened; a longer message is refused with `400`.\n\nRequests are rate-limited under the `send-message` scope; see **Conversation Messages**.","requestBody":{"required":true,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationMessageRequest"}}}},"responses":{"201":{"description":"The message was appended. The body echoes the request.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationMessageResponse"}}}},"400":{"description":"The body is invalid or names an author the caller may not use. Errors are field-keyed lists.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ValidationError"}}}},"401":{"description":"The token sent is invalid. A request with no credentials at all is not answered with `401` but with `400` (`Users do not match.`).","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"403":{"description":"The caller is neither staff nor the customer who owns the conversation.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}},"406":{"description":"The conversation's kind does not accept the message. `non_field_errors` is a single string, not a list; match on `error_code`.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ConversationBusinessError"}}}},"429":{"description":"The caller has posted too many messages in the current window of the `send-message` scope.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Error"}}}}}}}}}
```


---

# Agent Instructions
This documentation is published with GitBook. GitBook is the documentation platform designed so that both humans and AI agents can read, navigate, and reason over technical content effectively. Learn more at gitbook.com.

## Querying This Documentation
If you need additional information that is not directly available in this page, you can query the documentation by asking a question.

Perform an HTTP GET request on the following URL with the `ask` and `goal` query parameters:

```
GET https://apidocs.akinon.com/commerce-openapis/admin/conversations/conversation-messages/append-a-message-to-a-conversation.md?ask=<question>&goal=<user_goal>
```

`ask` is the immediate question: it should be specific, self-contained, and written in natural language.
`goal` is what the user is ultimately trying to achieve, the reason they need the answer. Sharing it helps GitBook give you a better, more relevant answer. A goal is most helpful when it describes the outcome the user wants rather than restating the question. For example, with `ask=how do I create an API token`, a goal like `automate deployments from our CI pipeline` lets GitBook tailor the answer to that use case.

The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
