A Rocket.Chat Apps-Engine app that automatically converts ticket references like #1234 in chat messages into clickable ticket URLs.
When a user sends a message containing a ticket reference (a # followed by digits, e.g. #1234), the app rewrites it into a full ticket URL before the message is posted:
Can someone look at #1234?
becomes
Can someone look at https://www.myticketurl.com/1234?
The app implements the IPreMessageSentModify event handler, which runs on every message before it is sent:
- Check phase —
checkPreMessageSentModifyquickly tests whether the message contains a#<digits>pattern. If not, the app does nothing. - Modify phase —
executePreMessageSentModifyrewrites each ticket reference into a URL.
- Code is left untouched. Fenced code blocks (
```) and inline code (`) are stashed as placeholders before rewriting and restored afterwards, so ticket-like patterns inside code are never modified. - Existing URLs are left untouched. A
#<digits>that is part of a URL path or fragment (preceded by a word character or/) is not rewritten.
The ticket base URL is currently hardcoded in TicketUrlGeneratorApp.ts:
const url = `https://www.myticketurl.com/${id}`;Change this to point at your own ticket system (e.g. Jira, GitHub Issues) and repackage the app. Making this a proper app setting is a natural next step.
Requires the Rocket.Chat Apps CLI:
npm install -g @rocket.chat/apps-cli
npm installrc-apps packageThe packaged .zip is written to dist/.
rc-apps deploy --url <your-server-url> --username <admin-user> --password <admin-password>Or upload the zip from dist/ manually via Admin → Apps → Upload App (requires development mode enabled on the server).
| Permission | Why |
|---|---|
message.read |
Read outgoing messages to detect ticket references |
message.write |
Rewrite the message text with the generated URL |
See repository for license details.