Warning
I slapped this togther at the peak of the TikTok hype. Now, at the end of 2023, I haven't used it in quite a while and don't know if it works. I don't plan to work on this anymore (busy with my master thesis) so I'll archive the repo. Feel free to fork it and use as you wish.
Wish you could watch TikToks in Slack? Me too. I made a Slackbot fix that by uploading TikToks to Twitter and then posting the Tweets back in a Slack thread.
- Works with short and long TikTok urls
- Can handle many concurrent requests
- Unfurls links posted in threads
I hoped to use the unfurl api to attach the video. Unforunately, that's not possible and Slack only shows previews from whitelisted apps. The good news is that Twitter is whitelisted. So we can upload a video to Twitter and then let Slack unfurl that.
I decided not to upload the MP4 directly to Slack because that would hog your Slack storage and litter the files search.
Slack -> TikTok -> Twitter -> Slack
- Recieve a
link_shared
event from Slack for a TikTok - Download the MP4 from TikTok
- Tweet the MP4
- Reply to original Slack message with Tweet
cp .env.sample .env
to make the .env
file.
- Create a Twitter developer account and put the credentials to the
.env
file. - Create a Slackbot (follow instructions in src/slackbot.js) and put the credentials in the
.env
file. - Run
npm start
- Add your server address to the Event Subscriptions page in Slack. ex:
https://example.com/slack/events
- Your bot must be running before you can add the URL
- You can use ngrok for local testing
- See Bolt docs for help setting up a Slackbot.
- Add the Slackbot to any channel you want it to respond in.
I recommend hosting for free on glitch.com. However, Google App Engine or even a Lambda function should work as well.
Feel free to open a PR or create an issue if you'd like to improve the project!