How to send facebook message from linux console (command-line)

I think for your special purpose, twitter may be a better option. Twitter accepts tweets from API. So what you need to do is to set up an account to publish your system status either regularly or event-triggingly and follow it in your own personal account. And there are already plenty of open source projects focusing on tweeting via API, and t is the one I am currently using.


So there are a couple of command line apps to do this.

There is a libpurple extension (https://github.com/dequis/purple-facebook) which works. However purple doesn't seem to support the idea of message history. This is a shame since I imagine offline messages is the default way most people use facebook.

There is an single use command tool for facebook as well: https://www.npmjs.com/package/fb-messenger-cli which does support history. Unfortunately this is a TUI rather than a command line application and doesn't seem to depend on a separate facebook library. Some hacking or terrible expect glue could work around this.


The Chat API was removed with v2.0 of the Graph API, there is no way to send messages with an API anymore. Btw, messages are for communcation between real users, they should not be used as notification system anyway. SMS is still a good option for those kind of warnings imho.

Using a Page and the /conversations endpoint would not work either:

Pages can only reply to a message - they cannot initiate a conversation. Also, a Page can only respond twice to a particular message, the other party will have to respond before they can reply again.

Source: https://developers.facebook.com/docs/graph-api/reference/v2.3/conversation/messages#publish