Feat/pinterest
Summary
Adds Pinterest integration to enable creating pins on Pinterest boards directly from workflows. The integration includes OAuth authentication, dynamic board selection from authenticated accounts, and support for posting images with titles, descriptions, links, and alt text.
Changes:
- Added Pinterest OAuth provider with required scopes (boards:read, boards:write, pins:read, pins:write)
- Created Pinterest block with fields for board selection, title, description, image URL, link, and alt text
- Implemented pinterest_create_pin and pinterest_list_boards tools
- Added dynamic board selector that fetches boards from authenticated Pinterest account
- Created API route /api/tools/pinterest/boards for board selection
Type of Change
- New feature
Testing
Manual Testing Performed:
- Pinterest OAuth connection flow
- Dynamic board selection after authentication
- Pin creation with all supported fields (title, description, media_url, link, alt_text)
- Board list retrieval via API endpoint
What reviewers should focus on:
- To test you'd need a approved pinterest production keys (takes 2 days to approve), i can send this to save time.
- Pinterest OAuth flow and token handling (apps/sim/lib/auth/auth.ts:1-72, apps/sim/lib/oauth/oauth.ts)
- Board selector implementation and dependency on credential (apps/sim/blocks/blocks/pinterest.ts:27-34)
- Pin creation tool parameters and validation (apps/sim/tools/pinterest/create_pin.ts)
- API route for fetching boards (apps/sim/app/api/tools/pinterest/boards/route.ts)
- Error handling for Pinterest API calls
Checklist
- Code follows project style guidelines
- Self-reviewed my changes
- Tests added/updated and passing
- No new warnings introduced
- I confirm that I have read and agree to the terms outlined in the ./CONTRIBUTING.md#contributor-license-agreement-cla
Screenshots/Videos
@Shubhamxshah is attempting to deploy a commit to the Sim Team on Vercel.
A member of the Team first needs to authorize it.
@waleedlatif1 @icecrasher321 @emir-karabeg please review this
Greptile Summary
This PR adds a complete Pinterest integration enabling users to create pins on their Pinterest boards directly from workflows. The implementation follows established OAuth patterns in the codebase with proper token refresh support, board selection via dynamic selectors, and comprehensive error handling.
Key Changes:
- OAuth provider configuration with
boards:read,boards:write,pins:read,pins:writescopes - Pinterest block with dynamic board selector dependent on credential
- Tools for creating pins (
pinterest_create_pin) and listing boards (pinterest_list_boards) - API endpoint
/api/tools/pinterest/boardsfor board selection with proper authorization - Board selector integrated into the selector registry and resolution system
Implementation Quality:
- OAuth implementation includes fallback user info handling when Pinterest API calls fail
- Token refresh properly configured with
supportsRefreshTokenRotation: true - Error handling implemented at all layers (OAuth, tools, API routes)
- Dynamic board selector properly depends on credential selection
- All Pinterest API calls use v5 endpoints
- Network policy updated to support custom egress rules
Confidence Score: 5/5
- This PR is safe to merge - clean implementation following existing patterns
- The implementation is thorough and follows established patterns consistently. OAuth setup mirrors other providers (Spotify, LinkedIn), error handling is comprehensive, and the dynamic selector integration is properly configured. No security issues, logic errors, or architectural concerns identified.
- No files require special attention
Important Files Changed
| Filename | Overview |
|---|---|
| apps/sim/lib/auth/auth.ts | added Pinterest OAuth provider with fallback user info handling for failed API calls |
| apps/sim/lib/oauth/oauth.ts | registered Pinterest OAuth configuration with correct scopes and token refresh support |
| apps/sim/blocks/blocks/pinterest.ts | created Pinterest block with board selector and pin creation fields |
| apps/sim/tools/pinterest/create_pin.ts | implemented pin creation tool with proper error handling and optional fields |
| apps/sim/app/api/tools/pinterest/boards/route.ts | created API endpoint for board selection with proper auth and token refresh |
| apps/sim/hooks/selectors/registry.ts | registered pinterest.boards selector with proper data fetching and mapping |
Sequence Diagram
sequenceDiagram
participant User
participant UI as Workflow UI
participant Auth as OAuth Service
participant Pinterest as Pinterest API
participant DB as Database
participant Selector as Board Selector
participant Tool as Create Pin Tool
User->>UI: Configure Pinterest block
UI->>Auth: Start Pinterest OAuth
Auth->>Pinterest: OAuth handshake
Pinterest->>Auth: OAuth complete
Auth->>DB: Store OAuth info
Auth->>UI: Connected successfully
User->>UI: Open board selector
UI->>Selector: Request boards (credentialId, workflowId)
Selector->>Auth: Check access rights
Auth->>Selector: Approved
Selector->>Auth: Request API access
Auth->>Pinterest: Verify and update
Pinterest->>Auth: Ready for use
Selector->>Pinterest: GET /v5/boards
Pinterest->>Selector: List of boards
Selector->>UI: Show boards in dropdown
User->>UI: Create pin with details
UI->>Tool: pinterest_create_pin(board_id, title, media_url, etc)
Tool->>Auth: Request API access
Auth->>Tool: Ready for API call
Tool->>Pinterest: POST /v5/pins with data
Pinterest->>Tool: Pin created
Tool->>UI: Return pin_id, pin_url, success
@Shubhamxshah please rebase and acknowledge the comments
@waleedlatif1 thanks for pointing out, i've fixed them.
@greptile
The latest updates on your projects. Learn more about Vercel for GitHub.
| Project | Deployment | Review | Updated (UTC) |
|---|---|---|---|
| docs | Dec 30, 2025 7:20am |
@greptile
@waleedlatif1 please review.