MediaUpload

Usage

Use this method to temporarily upload a media file so that it can be used by other endpoints. The uploaded file remains available for 1 hour.

client.mediaUpload(data).then(function(result){

});

Mandatory parameters

Name Type Description
name string The name of the media file to be uploaded
content integer A base64 string of the file contents

Optional parameters

This method does not have any optional parameters.

Response data format

The method returns the ID of the uploaded file. For the full response model, please see the Responses section for the POST /media endpoint on the Messenger API Routes page.

Example

client.mediaUpload(({ 
    name:'<file name>', 
    content:'<base64 string of file contents>' 
}).then(function(result){ 
console.log(result); 
});