Frequently Asked Question
RocketMSG
Version 1.008 and later
RocketMSG is a linux command line tool for sending messages via Rocket.Chat in shell scripts. This is available as a binary for RHEL/CentoOS/MacOS from GEN for a nominal charge (https://www.gen.uk for more information, use contact us). It is fully supported and you can use the HelpDesk for any issues.
The source code for the tool is available HERE
The syntax is:
Usage: ./rocketmsg [-h] -r room/team/channel [-m message] [-a attachment_path] [-q] [-d] [message...]
-d : Debug mode (will disclose sensitive information, don't use in production)
-q : Quoted mode
-r : Target, such as @Fred, #General or MyTeam
-a : Attachment (text, image, video or audio file)
-m : Message OR if not used, STDIN
And you will need to create a configuration file in ~/.rocketmsg.conf containing:
serverurl = http://10.1.1.100:3001
username = mrbashy
password = 234asertg345463rsth
The server URL is your local (or remote) rocket chat instance including protocol and port.
username is the user who will be sending the message, and password is that user's password.
If you don't want to, or can't put the config file in ~/.rocketmsg.conf then you can use the -c parameter and specify the full path of the config file. e.g. -c /root/rocket.conf
The user will need to have permissions to use the API, and to post messages into the required channels/rooms/teams.
Examples:
./rocketmsg -r "@Fred" -m "You are fired!"
Will send a message to the user Fred.
./rocketmsg -r "#General" -q
Will send the contents of test.txt to the #General room, and make it quoted.
./rocketmsg -r "#Funny" -m "A funny Picture" -a ./funny.jpg
Will send a message into #Funny with the image funny.jpg attached.