Skip to content

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

Old days many admins use sms-gates for sending important informations from their systems e.g. “Power down, UPS is working now!”, “Power Up, UPS is off!” or “CPU Temp too high!”. Today in Facebook era we use messenger instead of SMS, so I wonder if I could create a command-line bash or php script for such thing.

The idea – cron checks every 10 minutes the condition and if it is true, sends message to my messenger.

The issues:

  1. I don’t want to use my fb account for sending – I’d like to get message from “System 1”, “System 2”, because i have more than one system to admin.
  2. The bash part is easy for me, I need tips for Facebook solutions:
    • do I have to get FacebookAppId (and do I have to create AppId for each system or just one AppId)
    • how to “join/confirm/accept” “System 1” account with my Facebook Account
    • is it possible to send messages to more than one FBAccount
    • any other hints what should i look for.

I found Notification App, but i think that it doesn’t send message to messenger, so it would be useless.



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.


User contributions licensed under: CC BY-SA
1 People found this is helpful