Closed icebergyy closed 6 years ago
Hey, sorry for the late reply. Just saw this as I noticed a similar issue in the core botmaster project.
socket.io
provides ways to send files. But this is not what you want to do in this situation.
What should be done is using file urls like all other messaging apps.
So coming from the socket.io
client; assumedly your customer, you should be uploading attachments to some server (you can even use the same server as the botmaster server) using http(s) then return the file url to your client. You'll then be able to "send an attachment" via socket.io, simply using the url. So that once your file uploading request has resolved, you'd simply be able to send the message via botmaster-socket-io
doing:
// attachment object typically looks something like this:
const attachment = {
type: 'image',
payload: {
url: "some_valid_url_of_some_image"
},
};
bot.sendAttachmentTo(attachment, update.sender.id);
where the some_valid_url_of_some_image
value would be the value returned from the request made to your servers to store the file/image.
It will also be your responsibility to make sure that if the file should only be viewed by some people, you correctly forbid anyone else from viewing/downloading the file.
HtH, closing the issue. Reopen it if that didn't work for you
Is it possible to send images with this library?