I'm trying to set a custom user greeting using the RingCentral SDK but every method I try gives me the error "unsupported media type". It would be very helpful if someone could provide an example of how to generate a request for this endpoint using the RingCentral SDK in Node.js. My current code is attempting to use another Node.js package to read file contents.
platform.on(platform.events.loginSuccess, function(e){
console.log("User logged in successfully");
set_greeting(get_file());
});
async function set_greeting(binary) {
console.log(binary);
try {
var resp = await platform.post('/restapi/v1.0/account/~/extension/~/greeting', {
'type': 'Introductory',
'binary': binary
});
var jsonObj = await resp.json();
console.log('Greeting set successfully.');
console.log(jsonObj);
} catch (e) {
console.log(e.message);
}
}
async function get_file()
let binaryData = fs.readFileSync('C:/Users/user/Desktop/RingCentralApps/project/example.mp3', "binary");
return binaryData;
}