I have the a function that POST a text message alright, but I'm trying to include an image file/attachment with it but no luck:
// this function sends over the message
createMessage ( messageToSend, callback ) {
return utils.ajax( {
url: '/messages',
type: 'POST',
data: messageToSend
}, callback );
}
I include what I need to send like this
const messageToSend = {
text: this.message,
attachments: this.attachments
};
return api.createMessage( messageToSend, ( message ) => {
// some code
} );
When passing the object, the text is included but the image file /attachment was never included. What could I have missed?