Link Preview Services
Build link preview services for messaging apps, social platforms, and content aggregators. Generate rich previews for any URL.
Overview
When users paste a link in Slack, Discord, or any modern chat app, they expect a rich preview. Building this unfurl functionality requires reliably rendering any URL and extracting a meaningful visual. Screenshotly handles the hard parts.
Our API captures any URL consistently, regardless of JavaScript complexity, authentication walls, or slow loading. You get a clean image that represents the page content. Combined with metadata extraction (which you'd handle separately), you have everything needed for a complete link preview.
The challenge with link previews is handling edge cases. What about single-page apps? Paywalled content? Sites that block rendering? Screenshotly handles millions of URLs daily, so we've encountered and solved these edge cases. Your preview service inherits that reliability.
Key Benefits
Results You Can Expect
How It Works
Receive URL from user input (paste, share, webhook)
Check cache for existing preview of this URL
Call Screenshotly API to generate fresh preview image
Extract page metadata (title, description) via separate parsing
Cache and serve the complete preview card
Code Example
// Generate link preview
const response = await fetch('https://api.screenshotly.app/screenshot', {
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
url: 'https://example.com/article',
device: 'desktop',
format: 'jpeg',
quality: 80,
}),
});Frequently Asked Questions
How do I build a link preview service like Slack's unfurl?
Intercept pasted URLs in your app, call the Screenshotly API with the URL and a small viewport (e.g. 1200x630), then display the resulting thumbnail alongside the page title and description extracted via Open Graph tags.
What image size is best for link previews?
1200x630 pixels (1.91:1 ratio) is the universal standard used by Facebook, Twitter, Slack, and Discord. Use JPEG at 80% quality for fast loading. For higher-density displays, capture at 2x and resize.
How do I cache link preview images efficiently?
Cache by URL hash with a TTL of 24-72 hours. Serve cached images from a CDN. Implement stale-while-revalidate to refresh previews in the background without blocking user requests.
Can I generate link previews in real time?
For user-facing inline previews, pre-generate and cache rather than calling the API in real time. Average capture takes 2-5 seconds, which is too slow for inline display. Queue captures asynchronously and show a placeholder until ready.
Want a step-by-step walkthrough?
Read: Link Preview Generation Guide →Ready to automate link previews?
Get started with 100 free screenshots. No credit card required.
Related Use Cases
Thumbnails
Generate thumbnail previews for link aggregators, directories, and bookmarking services. Create visual previews at any size.
Convert any web page or URL to a pixel-perfect PDF via API. Handles modern CSS, JavaScript rendering, and full-page capture.
Invoices & PDFs
Generate pixel-perfect PDF invoices, receipts, and billing documents from HTML templates. Automate your financial document pipeline.