Skip to content

Chat Message Documents

List of valid attributes:

AttributeDescriptionSpecifics
created_atTimestamp of document creationCannot be set
extensionFile extension, e.g. pdfCan only be set on create. Required field. Must be either pdf, docx, csv, txt
message_idID of the message the document belongs toCannot be set
nameName for a documentRequired field
upload_statusFile upload statusCan only be set on update. Must be either uploading, success or error

Meta data: Download/Upload URL

ParameterAllowed valuesDescription
download_urltrue/falseWhen passing true, it generates a temporary URL to use for downloading a message document
upload_urltrue/falseWhen passing true, it generates a temporary URL to use for uploading a message document

Create

Example request:

{
"data": {
"type": "message_document",
"attributes": {
"extension": "pdf",
"name": "example_attachment"
}
}
}

Example response:

{
"data": {
"id": "66370ab1-8d08-4a03-b0ac-4ba83c8f101d",
"type": "message_document",
"attributes": {
...
}
}
}

On success, this endpoint creates a new message document with upload_status = "uploading".

HTTP Request

POST /api/v1/messages/:message_id/documents

URL Parameters

ParameterDescription
message_idThe ID of the message to attach the document to

Update

Example request:

{
"data": {
"type": "message_document",
"attributes": {
"name": "updated_attachment",
"upload_status": "success"
}
}
}

Example response:

{
"data": {
"id": "66370ab1-8d08-4a03-b0ac-4ba83c8f101d",
"type": "message_document",
"attributes": {
...
}
}
}

Updates allowed fields of a message document.

HTTP Request

PUT /api/v1/messages/:message_id/documents/:id

URL Parameters

ParameterDescription
message_idThe ID of the message the document belongs to
idThe ID of the message document to update