Base URL: https://api.cornerspot.net
Authentication: requests use a bearer token, for example Authorization: Bearer YOUR_API_KEY.
Post a message into a conversation
POST /c/api/v1/chat/conversations/{conversation_id}/messages
Posts an agent message into an open live-chat conversation as the API key's user. kind controls visibility:
reply (default) — visitor-facing. If the conversation is unclaimed, the first reply also claims it for the sender. internal_note — agent-only; never shown to the visitor and never claims the conversation.
Returns 410 conversation_closed when the conversation is not open. Returns 422 validation_failed when body is blank or kind is unrecognised.
Requires the chat_write scope and the Live Chat module.
Path parameters
| FIELD | TYPE | DESCRIPTION |
|---|---|---|
conversation_id | string · required | Id of the open ChatConversation to post into. |
Request body
| FIELD | TYPE | DESCRIPTION |
|---|---|---|
message | object | |
message.body | string · required | Required. Plain-text message body. |
message.kind | string one of reply, internal_note | Message kind. Defaults to reply when omitted. |
Code samples
curl --request POST \
--url 'https://api.cornerspot.net/c/api/v1/chat/conversations/1f2e3d4c-5b6a-4789-9c0d-1e2f3a4b5c6d/messages' \
--header 'Content-Type: application/json' \
--header 'Authorization: Bearer YOUR_API_KEY' \
--data '{
"message": {
"body": "string",
"kind": "reply"
}
}'
const response = await fetch('https://api.cornerspot.net/c/api/v1/chat/conversations/1f2e3d4c-5b6a-4789-9c0d-1e2f3a4b5c6d/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
"message": {
"body": "string",
"kind": "reply"
}
})
});
const data = await response.json();
console.log(data);
// Node.js 18+ (native fetch)
const response = await fetch('https://api.cornerspot.net/c/api/v1/chat/conversations/1f2e3d4c-5b6a-4789-9c0d-1e2f3a4b5c6d/messages', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
'Authorization': 'Bearer YOUR_API_KEY'
},
body: JSON.stringify({
"message": {
"body": "string",
"kind": "reply"
}
})
});
if (!response.ok) {
throw new Error(`Request failed: ${response.status}`);
}
const data = await response.json();
console.log(data);
import json
import urllib.request
url = "https://api.cornerspot.net/c/api/v1/chat/conversations/1f2e3d4c-5b6a-4789-9c0d-1e2f3a4b5c6d/messages"
payload = json.dumps({
"message": {
"body": "string",
"kind": "reply"
}
}).encode("utf-8")
headers = {
"Content-Type": "application/json",
"Authorization": "Bearer YOUR_API_KEY",
}
request = urllib.request.Request(url, data=payload, headers=headers, method="POST")
with urllib.request.urlopen(request) as response:
data = json.loads(response.read().decode("utf-8"))
print(data)
require "json"
require "net/http"
uri = URI("https://api.cornerspot.net/c/api/v1/chat/conversations/1f2e3d4c-5b6a-4789-9c0d-1e2f3a4b5c6d/messages")
request = Net::HTTP::Post.new(uri)
request["Content-Type"] = "application/json"
request["Authorization"] = "Bearer YOUR_API_KEY"
request.body = JSON.generate({
"message": {
"body": "string",
"kind": "reply"
}
})
response = Net::HTTP.start(uri.hostname, uri.port, use_ssl: uri.scheme == "https") do |http|
http.request(request)
end
puts JSON.parse(response.body)
<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.cornerspot.net/c/api/v1/chat/conversations/1f2e3d4c-5b6a-4789-9c0d-1e2f3a4b5c6d/messages',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_HTTPHEADER => [
'Content-Type: application/json',
'Authorization: Bearer YOUR_API_KEY',
],
CURLOPT_POSTFIELDS => json_encode([
'message' => [
'body' => 'string',
'kind' => 'reply',
],
]),
]);
$response = curl_exec($curl);
curl_close($curl);
$data = json_decode($response, true);
print_r($data);
Responses
| STATUS | DESCRIPTION |
|---|---|
201 Created | message created |
401 Unauthorized | missing or invalid API key |
402 Payment Required | the team's plan does not include live chat |
403 Forbidden | the key lacks the chat_write scope |
404 Not Found | no conversation with this id in the team |
410 Gone | the conversation is already closed |
422 Unprocessable Content | validation failed — body is blank or kind is unrecognised |
