Reference bridge: Mattermost
bridge.mjs is a complete, ready-to-run
bridge in one file of plain Node (20 or later, no dependencies). It forwards the /hijinks slash
command, button clicks and typed answers to Hijinks, verifies incoming events, and posts, updates,
DMs and ephemeral replies through the Mattermost REST API with a bot token. It keeps its state in a
JSON file, so a restart does not break a game in progress.
Not the one setting it up? Send whoever runs your Mattermost server the email below.
Send this to IT
Copy it, fill in the two brackets, and send it as is:
Code
Before you start
About an hour, if Mattermost already sits behind a reverse proxy with automatic certificates.
- Mattermost System Console access, to create a bot account and the
/hijinkscommand. - The System Admin role for the bot: Mattermost lets only system admins post the replies one member sees. Without it those replies fail and the rest of the game works.
- A host that keeps it running: Node 20 or later, or Docker. A Dockerfile and a systemd unit are included.
- A public HTTPS address for the bridge, or polling: Hijinks pushes only to HTTPS URLs that
resolve to public addresses. For an intranet-only Mattermost, run the bridge in
polling mode instead: it needs outbound HTTPS to
api.hijinks.teamand nothing inbound from the internet. - Typed answers forward every message in the game channel to Hijinks, which ignores anything that is not an answer. Use a channel just for games. What a bridge sends us lists every field.
The setup guide has the full checklist and the steps in order: Mattermost, then connect in the dashboard, then start the bridge, then send a test event.
What each feature looks like in Mattermost is on What works over a bridge. Copy the bridge as the starting point for any other chat: the Hijinks half stays the same.
Files
Download them into one directory and the guide's commands work as written:
Code
| File | What it is |
|---|---|
| bridge.mjs | The bridge, one file |
| README.md | Setup guide: prerequisites, bot account, slash command, settings, running it as a service |
| package.json | npm start and the Node version |
| Dockerfile | Container image, state on a volume |
| hijinks-bridge.service | systemd unit |
| openapi.yaml | The contract it implements |