Skip to content

Instantly share code, notes, and snippets.

View reetp's full-sized avatar
💭
Microsoft are bastards

John Crisp reetp

💭
Microsoft are bastards
View GitHub Profile
@frostbtn
frostbtn / readme.md
Last active June 28, 2023 09:38
rocket.chat web-hook to post messages silently

This is a Rocket.Chat incoming web hook. Hook gets an array of "messages" and silently creates chat messages directly in the Rocket's database without disturbing users with notifications or alerts - messages just appear in the channels. Messages appear silently even if the user has the channel openned: no refresh or re-enter is required (this is not this script's feature, it's how Rocket works).

This script can post messages to channels and groups by name (if message destination set to #name), or by api roomId (no prefixes in destination). And it can post DM to a user (if destination is set to @username). Please note, in this case DM between message author and destination user must already be created.

Note. Rocket.Chat's server version 6 has undergone significant changes. As a result, now there are two script versions: silent-post-whs-v5.js for server version 5 and silent-post-whs-v6.js for version 6. However, these scripts use an un