Skip to content

Chat Message Documents

List of valid attributes:

Attribute Description Specifics
created_at Timestamp of document creation Cannot be set
extension File extension, e.g. pdf Can only be set on create. Required field. Must be either pdf, docx, csv, txt
message_id ID of the message the document belongs to Cannot be set
name Name for a document Required field. Maximum length is 250 code points
upload_status File upload status Can only be set on update. Must be either uploading, success or error

Meta data: Download/Upload URL

Parameter Allowed values Description
download_url true/false When passing true, it generates a temporary URL to use for downloading a message document
upload_url true/false When passing true, it generates a temporary URL to use for uploading a message document

Note: upload_url returns a presigned POST S3 object, which contains url and fields keys, which can be used for HTML form. Maximum file size for upload is 100MB.

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".

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

Parameter Description
message_id The ID of the message to attach the document to

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.

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

Parameter Description
message_id The ID of the message the document belongs to
id The ID of the message document to update