WhatsApp automatically generates rich previews for links, showing the page title, description, and image thumbnail when available.
Endpoint
Headers
Device identifier for multi-device support. Required when multiple devices are registered.
Must be
application/json.Request Body
Phone number with country code and WhatsApp suffix.Format:
{country_code}{phone_number}@s.whatsapp.netExample: [email protected]The URL to send. WhatsApp will automatically fetch preview metadata from the page.Format: Must include protocol (http:// or https://)Example:
"https://google.com"Optional caption text to accompany the link. This text appears above the link preview.Example:
"Halo ini contoh caption"Mark the message as forwarded.
Disappearing message duration in seconds (optional).Common values:
86400- 24 hours604800- 7 days7776000- 90 days
Response
Response status code. Returns
"SUCCESS" on successful send.Human-readable response message.
Code Examples
Response Example
Link Preview Generation
WhatsApp automatically generates rich previews for links by fetching Open Graph metadata from the target page:What Gets Displayed
- Page Title: From
<title>orog:titlemeta tag - Description: From
og:descriptionor meta description - Thumbnail Image: From
og:imagemeta tag - Site Name: From
og:site_namemeta tag - URL: The actual link URL
Preview Generation Process
- API sends link to WhatsApp
- WhatsApp fetches the page metadata
- Preview card is generated automatically
- Message displays with rich preview
Preview generation happens on WhatsApp’s servers, not on your API server. The quality and content of previews depend on the target website’s metadata.
Use Cases
Content Sharing
Share blog posts, articles, and news:E-Commerce
Share product pages with automatic preview:Event Promotion
Share event registration or information pages:Documentation & Resources
Share documentation, guides, and resources:Video Content
Share YouTube videos or other video platforms:Social Media
Share social media posts and profiles:Optimizing Link Previews
To ensure your links display attractive previews, optimize your web pages with Open Graph meta tags:Essential Meta Tags
Image Recommendations
Dimensions:- Minimum: 200x200 pixels
- Recommended: 1200x630 pixels (Facebook/WhatsApp standard)
- Aspect ratio: 1.91:1 preferred
- JPEG or PNG
- Under 1MB file size
- High quality, clear image
- Clear, recognizable imagery
- Avoid text-heavy images
- High contrast for mobile viewing
Best Practices
-
Always Include Protocol
-
Use HTTPS When Possible
- More secure
- Better preview generation
- Builds trust with recipients
-
Add Compelling Captions
- Provide context for the link
- Use emojis to grab attention
- Include call-to-action
- Keep it concise but informative
-
Test Link Previews
- Send test messages to verify preview appearance
- Check on both mobile and desktop
- Ensure images load correctly
- Verify title and description are accurate
-
Short Links
- Use URL shorteners for long URLs
- Track clicks with shortened links
- Make links more shareable
- Examples: bit.ly, tinyurl.com
-
Track Engagement
- Use UTM parameters for analytics
- Create unique tracking links
- Monitor click-through rates
- Example:
?utm_source=whatsapp&utm_medium=api
Link Types
Website Links
Deep Links (Mobile Apps)
File Downloads
Video Platforms
Maps & Locations
UTM Tracking Example
Add tracking parameters to monitor campaign performance:utm_source=whatsapp- Traffic sourceutm_medium=api- Marketing mediumutm_campaign=summer_sale- Campaign nameutm_content=variant_a- Content variation (optional)utm_term=keyword- Keywords (optional)
Preview Troubleshooting
No Preview Shows
- Check Open Graph tags - Verify page has og:title, og:description, og:image
- HTTPS Required - Some sites require HTTPS for previews
- Page Accessible - Ensure page is publicly accessible
- WhatsApp Cache - WhatsApp may cache old previews
- Robots.txt - Check if page allows crawler access
Wrong Image Shows
- Update og:image tag - Specify correct image URL
- Image Size - Ensure image meets minimum dimensions
- Image Format - Use JPEG or PNG
- Clear Cache - Wait for WhatsApp to refresh cache
Preview Takes Long Time
- Page Load Speed - Optimize page performance
- Image Size - Compress large images
- Server Response - Improve server response time
- CDN Usage - Use CDN for faster image delivery
Limitations
- Preview Caching: WhatsApp caches link previews; updates may not appear immediately
- External Dependency: Preview quality depends on target website’s metadata
- Loading Time: Large images may cause slow preview generation
- Blocked Sites: Some domains may be blocked or restricted
- No Custom Preview: Cannot override WhatsApp’s automatic preview generation
Error Responses
Common causes:
- Invalid phone number format
- Missing link parameter
- Invalid URL format (missing protocol)
- Empty link string
Common causes:
- Device not connected
- Network connectivity issues
- WhatsApp service temporarily unavailable
Related Endpoints
- Send Text - Send plain text messages
- Send Image - Send images directly
- Send File - Send documents
- Send Location - Share location coordinates
