Create a message.
Create a message. The request enforces thread membership and content visibility for the authenticated caller.
curl --request POST \
--url https://api.revoengine.com/api/v1/chat/threads/{threadId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "The nightly sync has completed successfully.",
"replyToMessageId": "00000000-0000-4000-8000-000000000001",
"attachments": [
{
"type": "STORAGE_UPLOAD",
"storageUploadSessionId": "00000000-0000-4000-8000-000000000001",
"chatAttachmentId": "00000000-0000-4000-8000-000000000002",
"name": "report.pdf",
"mimeType": "application/pdf"
}
],
"chatUploadBatchId": "00000000-0000-4000-8000-000000000003",
"clientDraftId": "draft-01hx3k4z7pq9",
"metadata": {
"source": "system",
"severity": "info"
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: 'The nightly sync has completed successfully.',
replyToMessageId: '00000000-0000-4000-8000-000000000001',
attachments: [
{
type: 'STORAGE_UPLOAD',
storageUploadSessionId: '00000000-0000-4000-8000-000000000001',
chatAttachmentId: '00000000-0000-4000-8000-000000000002',
name: 'report.pdf',
mimeType: 'application/pdf'
}
],
chatUploadBatchId: '00000000-0000-4000-8000-000000000003',
clientDraftId: 'draft-01hx3k4z7pq9',
metadata: {source: 'system', severity: 'info'}
})
};
fetch('https://api.revoengine.com/api/v1/chat/threads/{threadId}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.revoengine.com/api/v1/chat/threads/{threadId}/messages"
payload = {
"text": "The nightly sync has completed successfully.",
"replyToMessageId": "00000000-0000-4000-8000-000000000001",
"attachments": [
{
"type": "STORAGE_UPLOAD",
"storageUploadSessionId": "00000000-0000-4000-8000-000000000001",
"chatAttachmentId": "00000000-0000-4000-8000-000000000002",
"name": "report.pdf",
"mimeType": "application/pdf"
}
],
"chatUploadBatchId": "00000000-0000-4000-8000-000000000003",
"clientDraftId": "draft-01hx3k4z7pq9",
"metadata": {
"source": "system",
"severity": "info"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)Authorizations
Bearer JWT token or API Key (sk-*).
Path Parameters
Body
Message body. Maximum 10kB.
10000"The nightly sync has completed successfully."
Message id this message replies to. Must belong to the same thread.
"00000000-0000-4000-8000-000000000001"
Attachment descriptors included with the message. Use STORAGE_UPLOAD with storageUploadSessionId for direct uploads that may still be finalizing.
[
{
"type": "STORAGE_UPLOAD",
"storageUploadSessionId": "00000000-0000-4000-8000-000000000001",
"chatAttachmentId": "00000000-0000-4000-8000-000000000002",
"name": "report.pdf",
"mimeType": "application/pdf"
}
]
Upload batch id whose finalized files are bound to this message.
"00000000-0000-4000-8000-000000000003"
Client draft id used to bind finalized pending uploads to this message.
128"draft-01hx3k4z7pq9"
Additional application metadata persisted with the message. Values may use any JSON type. Maximum 16 KiB and 64 top-level keys. Top-level keys starting with "__" are reserved for backend use.
{ "source": "system", "severity": "info" }
Response
OK.
curl --request POST \
--url https://api.revoengine.com/api/v1/chat/threads/{threadId}/messages \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"text": "The nightly sync has completed successfully.",
"replyToMessageId": "00000000-0000-4000-8000-000000000001",
"attachments": [
{
"type": "STORAGE_UPLOAD",
"storageUploadSessionId": "00000000-0000-4000-8000-000000000001",
"chatAttachmentId": "00000000-0000-4000-8000-000000000002",
"name": "report.pdf",
"mimeType": "application/pdf"
}
],
"chatUploadBatchId": "00000000-0000-4000-8000-000000000003",
"clientDraftId": "draft-01hx3k4z7pq9",
"metadata": {
"source": "system",
"severity": "info"
}
}
'const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
text: 'The nightly sync has completed successfully.',
replyToMessageId: '00000000-0000-4000-8000-000000000001',
attachments: [
{
type: 'STORAGE_UPLOAD',
storageUploadSessionId: '00000000-0000-4000-8000-000000000001',
chatAttachmentId: '00000000-0000-4000-8000-000000000002',
name: 'report.pdf',
mimeType: 'application/pdf'
}
],
chatUploadBatchId: '00000000-0000-4000-8000-000000000003',
clientDraftId: 'draft-01hx3k4z7pq9',
metadata: {source: 'system', severity: 'info'}
})
};
fetch('https://api.revoengine.com/api/v1/chat/threads/{threadId}/messages', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));import requests
url = "https://api.revoengine.com/api/v1/chat/threads/{threadId}/messages"
payload = {
"text": "The nightly sync has completed successfully.",
"replyToMessageId": "00000000-0000-4000-8000-000000000001",
"attachments": [
{
"type": "STORAGE_UPLOAD",
"storageUploadSessionId": "00000000-0000-4000-8000-000000000001",
"chatAttachmentId": "00000000-0000-4000-8000-000000000002",
"name": "report.pdf",
"mimeType": "application/pdf"
}
],
"chatUploadBatchId": "00000000-0000-4000-8000-000000000003",
"clientDraftId": "draft-01hx3k4z7pq9",
"metadata": {
"source": "system",
"severity": "info"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)
