2/6/2015 - 11:55 PM

Post to

Bookmarklet to Post to Slack

Please note that this has a little problem: It posts the links as Slack Bot and not as yourself. You could add your name to the message but doesn't look right.

I've created a little bookmarklet that posts the url of the current webpage to a Slack channel. You have to set your token and the channel name manually but it's all fun and profit from there.

The readable code:

xhr = new XMLHttpRequest();
//                         ---v---                                          --v--            --v--"POST", "", true);
xhr.setRequestHeader("Content-Type", "application/x-www-form-urlencoded; charset=UTF-8");

To get your url/token, go to the Add Slack Integration page, scroll to the bottom and select the Slackbot integration, then change to the tab Remote Controls. Copy the url (or the team name and token) and replace in the code.

Replace general with the channel you want to post to.

I used Bookmarkleter to neatly convert the code to a bookmarklet. Just copy and paste the code there, change it and generate your link.

I have a couple of these on my bookmarks bar, one for each channel I regularly post links to.