Last active
February 17, 2023 19:51
-
-
Save drye/98ef7e5cea7b71cdf803b0c88632a96e to your computer and use it in GitHub Desktop.
Push slack bookmark
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
#!/usr/bin/env node | |
// Required parameters: | |
// @raycast.schemaVersion 1 | |
// @raycast.title Push slack bookmark | |
// @raycast.mode silent | |
// Optional parameters: | |
// @raycast.icon 🧍🏻 | |
// @raycast.argument1 { "type": "text", "placeholder": "Slack link" } | |
// Documentation: | |
// @raycast.description Push a new Slack bookmark onto your personal bookmark stack | |
// @raycast.author Primož Verdnik | |
// @raycast.authorURL https://github.com/drye | |
import fs from 'fs'; | |
const file = 'slack-bookmarks.txt'; | |
const query = process.argv.slice(2)[0]; | |
const team_id='T04TH3H9J'; // To fetch this, open one of the Slack links and look for team-id in the source html | |
const [,,,,id,message] = query.split('/'); | |
console.log(id, message); | |
const message_one = message.slice(1, 11); | |
const message_two = message.slice(11); | |
const deeplink = `\nslack://channel?team=${team_id}&id=${id}&message=${message_one}.${message_two}&`; | |
fs.appendFileSync(file, deeplink); | |
console.log("Entry saved! ✅"); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Setup
team-id
and copy and paste that value into line 20.Note: this is the counterpart script to Open Slack Bookmark
Usage
slack-bookmarks.txt
file.