
How to build a link preview service (like Slack's URL unfurling)
How to Build a Link Preview Service (Like Slack's URL Unfurling) When you paste a URL into Slack, it expands into a card with a title, description, and thumbnail image. That's a link preview service. Building one yourself — for a chat app, a bookmarking tool, a CMS, or an internal tool — requires fetching OG metadata and capturing a screenshot. Here's the full service: one endpoint, returns metadata + screenshot thumbnail, under 50 lines of core logic. The endpoint POST /preview { "url": "https://example.com/article" } → { "url": "https://example.com/article", "title": "Article Title", "description": "Meta description...", "image": "https://your-cdn.com/previews/abc123.png", "favicon": "https://example.com/favicon.ico", "cachedAt": "2026-02-26T07:00:00Z" } Express implementation import express from " express " ; import { S3Client , PutObjectCommand } from " @aws-sdk/client-s3 " ; import crypto from " crypto " ; const app = express (); app . use ( express . json ()); const s3 = new S3Cl
Continue reading on Dev.to JavaScript
Opens in a new tab

