-
Notifications
You must be signed in to change notification settings - Fork 2.8k
Singular integration #2637
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Singular integration #2637
Conversation
|
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
WalkthroughA new Singular integration was implemented, including webhook endpoints, event tracking, and URL handling. Core lead and sale tracking logic was refactored into reusable functions, simplifying API route handlers. Type definitions were standardized and decoupled from Zod schemas. Middleware and utility functions were updated to support Singular-specific tracking and URL patterns. Minor improvements and adjustments were made to page caching, error logging, and integration scripts. Changes
Sequence Diagram(s)Singular Webhook Event FlowsequenceDiagram
participant Singular
participant API as /api/singular/webhook
participant DB as Database
participant Lead as trackLead
participant Sale as trackSale
Singular->>API: GET /api/singular/webhook?...
API->>API: Validate SINGULAR_WEBHOOK_TOKEN and query params
API->>DB: Lookup workspace by dub_workspace_id
API->>API: Map event_name to internal type
alt event_name == "lead"
API->>Lead: trackLead(params, workspace)
Lead-->>API: Lead tracking result
else event_name == "sale"
API->>Sale: trackSale(params, workspace)
Sale-->>API: Sale tracking result
end
API-->>Singular: JSON { "OK": true }
Lead/Sale Tracking DelegationsequenceDiagram
participant Route as /api/track/lead or /api/track/sale
participant Logic as trackLead/trackSale
participant DB as Database
participant Redis as Redis
participant Webhook as Workspace Webhook
Route->>Logic: Call with parsed params and workspace
Logic->>Redis: Deduplication (lead/sale)
Logic->>DB: Lookup or upsert customer/lead/sale
Logic->>Webhook: Send event notification
Logic-->>Route: Tracking result
Route-->>Client: JSON response
Poem
📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (3)
💤 Files with no reviewable changes (2)
🧰 Additional context used🧠 Learnings (2)📓 Common learningsapps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/[integrationSlug]/manage/page.tsx (1)🧬 Code Graph Analysis (1)apps/web/app/app.dub.co/(dashboard)/[slug]/settings/(basic-layout)/integrations/[integrationSlug]/manage/page.tsx (3)
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (1)
🔇 Additional comments (1)
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
…ic, remove deprecated functions, and enhance error handling. Introduce new trackLead and trackSale functions for improved event processing.
…nt trackSale function for sale event processing. Refactor sale tracking logic in Singular integration to enhance clarity and maintainability.
…ransformation, add metadata parameter to trackLead and trackSale functions for improved data handling.
Summary by CodeRabbit
New Features
Improvements
Bug Fixes
Chores