Import Pinterest pins into moodboards with automatic material matching from the catalog.
Two-phase integration:
Phase 1 (No OAuth): Paste a pin URL → extract metadata via oEmbed → import to moodboard → auto-match with catalog materials.
Phase 2 (OAuth): Connect Pinterest account → browse boards → select pins → bulk import.
| Function | Purpose |
|---|---|
pinterest-import |
Pin URL extraction + import (oEmbed, no auth needed) |
pinterest-oauth |
OAuth flow + board/pin API proxy |
No API key required. Uses Pinterest's public oEmbed endpoint.
Actions:
extract_pin — extracts title, image URL, author from pin URLimport_pin — downloads image, uploads to storage, creates moodboard item, runs visual searchimport_pins_bulk — batch import multiple URLsAuto-matching: Each imported pin image is run through MIVAA visual search (/api/rag/search with multi_vector strategy) to find similar materials in the catalog. Top matches shown to user.
Requires Pinterest developer app registration (~1-2 weeks approval).
Actions:
get_auth_url — generates OAuth URL with CSRF statecallback — exchanges code for tokens, stores in social_accounts tableget_boards — fetches user's boards via Pinterest API v5get_board_pins — fetches pins from a board (paginated)disconnect — removes stored tokensToken Management: Access tokens valid 30 days, refresh tokens 365 days. Auto-refresh on expiry with 5-minute buffer.
| Component | Purpose |
|---|---|
PinterestImportModal |
Main UI — single URL, bulk URL, board browser |
pinterestService.ts |
Frontend service for all Pinterest operations |
Integration: "Import from Pinterest" button on MoodBoardDetailPage header (stats row).
PINTEREST_APP_ID — from developers.pinterest.com
PINTEREST_APP_SECRET — from developers.pinterest.com
PINTEREST_REDIRECT_URI — https://{supabase-url}/functions/v1/pinterest-oauth
OAuth tokens stored in existing social_accounts table with platform = 'pinterest'.
Import tracking via moodboard_items with media_type = 'image' and media_title prefixed with pin source.