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 |
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 |
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
Parameter | Description |
---|---|
message_id | The 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
Parameter | Description |
---|---|
message_id | The ID of the message the document belongs to |
id | The ID of the message document to update |