Sales rep and task endpoints
See Sales reps and follow-up tasks for the rules.
Sales reps
POST /api/sales-reps
Creates a rep: name, email, and optionally profileId, hubspotOwnerId, nooksUserId,
activeListId, hubspotCallSegmentId.
Unique on (subscriptionId, email). A rep can exist before having a Supabase account — profileId is
optional.
GET|PATCH|DELETE /api/sales-reps/{id}
Populate nooksUserId for Nooks call attribution to work by its primary path; email matching is only a
fallback.
Follow-up tasks
GET /api/follow-up-tasks
Validated by FollowUpTasksListQuerySchema. page, pageSize.
| Parameter | Filter |
|---|---|
|
Contact or note text |
|
|
|
|
|
Assignee |
|
Relative due-date bucket (overdue, today, upcoming) |
|
Sort order |
|
Creation date range |
- Response
-
{ data, total, page, pageSize, stats }
The stats block is computed in the same request as the page (getStats(subscriptionId)), so the task
board renders its counters without a second round trip.
POST /api/follow-up-tasks
Validated by CreateFollowUpTaskSchema: salesRepId, contactId, type, dueAt, notes, and
optionally campaignTargetId or contactSequenceId.
PATCH /api/follow-up-tasks/{id}
Updates status, dueAt, notes, escalationStage and the per-platform sync fields. Completing a
task should also cancel its pending escalation run using the stored inngestRunId.
Repository and API mapping: lib/repositories/follow-up-task-repository.ts
(mapFollowUpTaskToApi).