Created
December 31, 2025 21:10
-
-
Save tim775/bbcf473460fbe786e927d8d961b23988 to your computer and use it in GitHub Desktop.
Veija slack app rule
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| // Veija slack app rule | |
| // This opens slack channel or message links in the slack app. | |
| // | |
| // 1. Log in to your slack workspace in a browser and copy | |
| // your team id (TXXXXXXXXX) from the url: e.g. "T012345679A" | |
| // from "https://app.slack.com/client/T012345679A/C0123456789" | |
| // 2. Create a new veija rule that matches url domain and | |
| // subdomain on <yourslackteam>.slack.com | |
| // 3. Enable 'Transform URL' for the rule, Edit script and paste | |
| // this code. Make sure to replace the value of TEAM_ID with | |
| // your actual id. | |
| const TEAM_ID = "T0000000000"; | |
| const m = $.url.pathname.match(/\/archives\/(C\w+)(?:\/p(\d+))?/); | |
| if (m) { | |
| const channelId = m[1]; | |
| const messageTs = m[2]; | |
| let url = `slack://channel?team=${TEAM_ID}&id=${channelId}`; | |
| // add message timestamp if present | |
| if (messageTs) { | |
| url += `&message=${messageTs}`; | |
| } | |
| // parse thread_ts from query params if present | |
| const queryParams = new URLSearchParams($.url.search); | |
| const threadTs = queryParams.get('thread_ts'); | |
| if (threadTs) { | |
| url += `&thread_ts=${threadTs}`; | |
| } | |
| $.url = url; | |
| } |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Line 15:
Will not work on DMs (which start with a
Dnot aC)But if you change it to:
Then it will work on DMs too.