messenger-cli v0.1.2
messenger-cli
Send messages from a Facebook Messenger bot account CLI
Installation
npm install messenger-cli -g
Usage
Finding your user ID
Every user ID is different per Messenger app, this means that you need to find yours before you can start sending messages. I've created a simple webhook script that you can deploy to Heroku to find your ID.
Setting the access token
messenger -t <token>
It is required that you set your access token
and default user ID
to send a message.
Setting the default recipient
messenger -r <user id>
Typing out and remembering the user ID is annoying, you can set a default user ID by using the -r
flag by itself.
Sending a message
messenger -r <user id> -m <message>
Sending a message to the default recipient
messenger -m <message>
Sending a message without the -r
flag will be sent to the default user.
Use Cases
Command line
$ dd if=image.img of=/dev/rdisk1; messenger -m "Disk write complete"
$ wget ubuntu.com/image.img; messenger -m "Ubuntu finished downloaded"
$ make; make install; messenger -m "Software compiled and installed"
In software
Because it's CLI, it can be used in all projects.
# Python script checking a server's status
while True:
if server_up() == False:
os.system('messenger -m "The server has gone down"')
time.sleep(900)
If you've found a great use case yourself, tweet me at @hstntn, I'm super interested.