Build a Slack bot that downloads videos
Marketing and social teams share video links in Slack all day. A small Bolt app can unfurl them into a title, thumbnail and download button using CrawlFetch.
How it fits together
A /grab slash command resolves the URL and responds with Block Kit: title, thumbnail and a button linking to downloadUrl.
The bot code
import pkg from "@slack/bolt";const { App } = pkg;const app = new App({ token: process.env.SLACK_BOT_TOKEN, signingSecret: process.env.SLACK_SIGNING_SECRET });app.command("/grab", async ({ command, ack, respond }) => {await ack();const r = await fetch("https://api.crawlfetch.com/v1/resolve?" + new URLSearchParams({ url: command.text.trim() }), {headers: { Authorization: "Bearer " + process.env.CRAWLFETCH_KEY },});if (!r.ok) return respond("Couldn't fetch that video (" + r.status + ").");const v = await r.json();await respond({blocks: [{ type: "section", text: { type: "mrkdwn", text: "*" + v.title + "*" },accessory: v.thumbnail ? { type: "image", image_url: v.thumbnail, alt_text: "thumbnail" } : undefined },{ type: "actions", elements: [{ type: "button", text: { type: "plain_text", text: "Download" }, url: v.downloadUrl }] },],});});await app.start(3000);
Notes for Slack bot
- Remember
downloadUrlexpires after a few hours — the button is for immediate use.
FAQ
Can it upload the file to Slack?
Yes, with files.uploadV2, but linking is faster and avoids Slack storage limits.
Related
Last updated 2026-10-25