Upload media

In addition to your text contents, Dialoguewise also allows you to add media files, like images, documents and videos. In order to upload the media files, you need to prepare the UploadMediaRequest payload by importing it.

import 'package:dialogue_wise/DTOs/upload_media_request.dart';

Next, set the accessToken property and localFilePath which is the path of the file on your device that needs to be uploaded

var request = new UploadMediaRequest();
request.accessToken = '<Provide access token>';
request.localFilePath = '<Provide local file path>';

Then all you need to do is to call the uploadMedia method using this payload.

var dialogueWiseService = new DialoguewiseService();
var response = await dialogueWiseService.uploadMedia(request);

That’s it! You will now get a response which will contain the URL to the uploaded file.

Below are the list of file types that are allowed.

Type Allowed file types
Images .gif, .jpeg, .jpg, .png
Documents .pdf, .txt, .doc, .docx
Videos .mp4, .mov

For mode details on the implementation, please have a look at the examples available on Github.

Please note, file of size more than 10 MB are not allowed.