A file message is a type of message that allows users to share files with each other within a chat or messaging app. This can include documents, images, videos, and other types of files. To send a file message, the user simply selects the file they want to share and sends it through the app.
When a user receives a file message, they can view or download the file directly within the app. This makes it easy for users to share important files and collaborate with each other without having to switch between different applications or email clients.
A File message can include any of the following:
Image
Audio
File
Custom
To send a file message, you must provide a valid local file URL
instance of the selected file and file name for the file. The default file name is file
. The SDK will check the size of the data whether it is exceeding the limit or not before sending it to the server. If the size of the data is more than the limit, the callback will return an Error
object with the error information that you can parse and then show an error message.
Here is a brief explanation of the function parameters:
text/caption
: A string that contains the text message that the user wants to send. This parameter is mandatory as it contains the actual message content.
attachment
: The local file path that the user wants to send on the device
subchannelId
: An identifier for the subchannel where the message will be sent. Subchannels are subdivisions within a channel that represent individual topics or chat threads. Messages and interactions occur within subchannels, not the main channel itself.
tags
- Arbitrary strings that can be used for defining and querying for the messages.
Version 6
Version 5 (Maintained)
Here's a small example on how to create a message with an image attached. The process is pretty simple:
Upload a file.
Create a message with the uploaded file ID.
Refer to #upload-files for the sample code on how to upload a file to get fileId.
Here's a small example on how to create a message with an image attached. The process is pretty simple:
Upload a file.
Create a message with the uploaded file ID.
Refer to #upload-files for the sample code on how to upload a file to get fileId.
Version 6
Beta (v0.0.1)