fb-messenger-cli
fb-messenger-cli copied to clipboard
Added functionality to add attachments
Original Issue: #90
Added ability to attach file in cli
you can do >/a <absolute-path-to-file>
(/attach
works too) to upload a file to a thread.
Different file types are taken care of:
- audio
- video
- image
- file
if a file is not accepted by facebook, it will log a deny message.
How does this work?
This works by first uploading the file to https://upload.messenger.com/ajax/mercury/upload.php
, if it succeeds with no errors, it will return a body with the id of the file you uploaded.
You can then append this id to the form data and POST it to https://www.messenger.com/messaging/send/
(the same endpoint where messages are sent)
Notes
- If a file is not allowed (e.g.,
.exe
files), it will log a denied message - Because of a bug with showing file attachments (even if it's sent by other people), it's harder to tell that this works, but if you open messenger in a browser, you can see that the files are uploaded correctly. #162
- This does not address image copied in clipboard
Hey @p1ho this is pretty cool! Sorry for the late reply, I'll give it a shot and hopefully FB didn't change their API too much so this still works
Awesome! Excited to hear your feedback! I've also added a screenshot of it working above.
@Alex-Rose Hello, just added a minor commit for the merge conflict. I just tested, the functionality still worked on my machine.