Skip to content

Repository files navigation

Ticket URL Generator

A Rocket.Chat Apps-Engine app that automatically converts ticket references like #1234 in chat messages into clickable ticket URLs.

What it does

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?

How it works

The app implements the IPreMessageSentModify event handler, which runs on every message before it is sent:

  1. Check phasecheckPreMessageSentModify quickly tests whether the message contains a #<digits> pattern. If not, the app does nothing.
  2. Modify phaseexecutePreMessageSentModify rewrites each ticket reference into a URL.

Edge cases handled

  • 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.

Configuration

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.

Development

Requires the Rocket.Chat Apps CLI:

npm install -g @rocket.chat/apps-cli
npm install

Package the app

rc-apps package

The packaged .zip is written to dist/.

Deploy to a server

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).

Permissions

Permission Why
message.read Read outgoing messages to detect ticket references
message.write Rewrite the message text with the generated URL

License

See repository for license details.

About

turns hashtagged numbers into ticket urls

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Used by

Contributors

Languages