- Print
- DarkLight
- PDF
Upload File to a Room
- Print
- DarkLight
- PDF
Post a message with the attached file to a dedicated room.
Changelog
Version | Description |
---|---|
1.0.0 | Return Message object on file upload |
0.62.0 | Added |
The authToken
of the authenticated user.
The userId
of the authenticated user.
The room ID to which you want to upload the file.
For some file types, when uploading via curl, you may need to set the mime type.
With some file types, curl will upload the file as application/octet-stream. You can pass a custom mime type like this: -F \"[email protected];type=audio/wav\"
to specify the type.
The file to upload
A message text to be sent with the file.
A description of the file.
The thread message ID (if you want to upload a file to a thread).
You can add custom fields for messages. For example, set priorities for messages.
You must enable this option and define the validation in the workspace settings. See the Message for further information.
OK
{
"message": {
"_id": "XhqGxkXYtcYba2F9K",
"rid": "GENERAL",
"ts": "2022-06-29T07:34:33.736Z",
"msg": "This is a message with a file",
"file": {
"_id": "pw6oyrjBStWwMdeMv",
"name": "example.txt",
"type": "text/plain"
},
"files": [
{
"_id": "pw6oyrjBStWwMdeMv",
"name": "example.txt",
"type": "text/plain"
}
],
"attachments": [
{
"ts": "1970-01-01T00:00:00.000Z",
"title": "example.txt",
"title_link": "/file-upload/pw6oyrjBStWwMdeMv/example.txt",
"title_link_download": true,
"type": "file",
"description": "Simple text file"
}
],
"u": {
"_id": "g8aroJivN5R32TxCm",
"username": "rodriq",
"name": "Rodriq"
},
"_updatedAt": "2022-06-29T07:34:33.811Z",
"urls": [],
"md": [
{
"type": "PARAGRAPH",
"value": [
{
"type": "PLAIN_TEXT",
"value": "This is a message with a file"
}
]
}
]
},
"success": true
}
Bad Request
{
"success": false,
"error": "Match error: Unknown key in field dasd"
}
{
"success": false,
"error": "[invalid-field]",
"errorType": "invalid-field"
}
Unauthorized
{
"status": "error",
"message": "You must be logged in to do this."
}