Put Multimedia
The LikeMinds React Chat SDK provides the Put Multimedia feature, allowing you to attach multimedia files to your conversations effortlessly. By utilizing this feature, you can enrich your conversations with various types of media, such as images, videos, documents, and more.
Steps to Put Multimedia in a Conversation
- Upload your multimedia file to any cloud service of your choice.
- To add media to conversations use
putMultimedia()
method provided by the client you initialised. - Pass in the required parameters.
- Process the response as per your requirement.
const payload: any = {
conversationId: "" , // ID of the conversation
filesCount: 1 , // number of files
index: 0, // index at which you are uploading the file
meta: {
size: , //size of file
duration: , // duration of file (only pass in case of video)
},
name: "" , // name of the file
type: "", //tpe of file `image`, `video` and `pdf`
url: "", // cloud service(e.g AWS) response url
}
const response = await lmChatClient.putMultimedia(payload);
if(response.success){
// your function to process the response data
processResponse(response);
}else{
// your function to process error message
processError(response);
}
Put Multimedia Payload
List of parameters provided by putMultimedia()
.
Variable | Type | Description | Optional |
---|---|---|---|
conversationId | number | Conversation Id | |
url | string | URL of the multimedia | |
filesCount | number | Count of attachments | |
index | number | Index of the multimedia | |
type | string | Type of the multimedia | |
meta | object | Meta data of the multimedia | |
name | string | Meta data of the multimedia | |
thumbnailUrl | string | Thumbnail URL of the multimedia | ✔️ |
Put Multimedia Response
List of parameters in the response.
Variable | Type | Description |
---|---|---|
success | boolean | API success status |
error_message | string | Error message in case of failure |
conversation | object | Updated conversation, after uploading |