createMessage
Requires an authenticated session.
Posts a message to a conversation the caller has access to, and delivers it live to the people who can see that conversation. Needs a signed-in user.
Errors: a failed call returns a GraphQL errors entry, not a field on the result, and data may be null or partial. Read the entry's extensions.code and message; every shape and code is in the Error reference.
Example:
- GraphQL
- cURL
mutation CreateMessage($input: CreateMessageInput!) {
createMessage(input: $input) {
id
createdAt
content
conversationId
metadata
role
sender {
id
postalCode
name
firstName
lastName
status
}
}
}
curl -X POST "https://<api-host>/graphql" \
-H "Content-Type: application/json" \
-H "Authorization: Bearer $ACCESS_TOKEN" \
--data @- <<'EOF'
{
"query": "mutation CreateMessage($input: CreateMessageInput!) {\n createMessage(input: $input) {\n id\n createdAt\n content\n conversationId\n metadata\n role\n sender {\n id\n postalCode\n name\n firstName\n lastName\n status\n }\n }\n}",
"variables": {
"input": {
"content": "string",
"conversationId": "string",
"role": "string"
}
}
}
EOF
Variables:
{
"input": {
"content": "string",
"conversationId": "string",
"role": "string"
}
}
Response:
{
"data": {
"createMessage": {
"id": "id",
"createdAt": "2025-01-15T00:00:00Z",
"content": "string",
"conversationId": "string",
"metadata": {},
"role": "string",
"sender": {
"id": "id",
"postalCode": "string",
"name": "string",
"firstName": "string",
"lastName": "string",
"status": "ACTIVE"
}
}
}
}
createMessage(
input: CreateMessageInput!
): ChatMessage!
Arguments
createMessage.input ● CreateMessageInput! non-null input
The conversation, the sender role, the text and optional metadata.
Type
ChatMessage object
One message in a chat conversation.