v1.0.7: Sequence tRPC Router — Full Sequence Management API
v1.0.7: Sequence tRPC Router — Full Sequence Management API
Release: v1.0.7
Version 1.0.7 ships the complete tRPC router for nurture sequences. Every operation agents need to review, approve, reschedule, pause, or cancel a nurture sequence is now available as a typed, end-to-end procedure — ready to be consumed by the UI and dashboard widgets.
What Was Built
A new sequences tRPC router that covers the full lifecycle of an email nurture sequence, from first draft through to completion or cancellation.
Procedures Reference
sequences.list
Type: Query
Returns a list of sequences filtered by status.
Input:
{
status: 'draft' | 'active' | 'completed' | 'paused'
}
Returns: Array of sequence objects for the given status.
sequences.get
Type: Query
Fetches a single sequence by ID, including all of its associated emails.
Input:
{
sequenceId: string
}
Returns: Sequence object with a nested emails array.
sequences.approveEmail
Type: Mutation
Approves a single email within a sequence. An individual email can be approved without approving the whole sequence, allowing agents to review emails one at a time.
Input:
{
emailId: string
}
sequences.approveSequence
Type: Mutation
Approves an entire sequence for sending. All emails in the sequence are marked as approved and the sequence transitions to active status.
Input:
{
sequenceId: string
}
sequences.regenerateEmail
Type: Mutation
Triggers an asynchronous AI re-generation of a specific email. Rather than running inline, this fires an Inngest background event, keeping the API call fast. The email is updated once the event completes.
Input:
{
emailId: string
}
Background event dispatched: Inngest AI re-generation event for the given email ID.
sequences.pause
Type: Mutation
Pauses an active sequence. Scheduled emails will not be sent while the sequence is paused. The sequence can be resumed later.
Input:
{
sequenceId: string
}
sequences.cancel
Type: Mutation
Cancels a sequence permanently. Remaining scheduled emails will not be sent.
Input:
{
sequenceId: string
}
sequences.rescheduleEmail
Type: Mutation
Reschedules a specific email within a sequence to a new send time.
Input:
{
emailId: string
scheduledAt: Date
}
sequences.stats
Type: Query
Returns aggregate sequence counts grouped by status. Designed for use in dashboard summary widgets.
Returns:
{
draft: number
active: number
completed: number
paused: number
}
Sequence Status Model
| Status | Description |
|---|---|
draft | Sequence has been generated but not yet approved |
active | Sequence is approved and emails are being sent or scheduled |
paused | Sequence is temporarily halted — no emails will send |
completed | All emails in the sequence have been sent |
Async AI Re-generation via Inngest
The regenerateEmail procedure uses Inngest to handle AI re-generation as a background job. This means:
- The tRPC call returns immediately
- The AI model runs in the background without blocking the request
- Long-running generation does not cause API timeouts
- The email record is updated once the job completes
Dashboard Stats Widget
The sequences.stats query is purpose-built for dashboard widgets that need a quick status summary without fetching full sequence lists. Call it once on dashboard load to populate counts across all four statuses.
const stats = await trpc.sequences.stats.query();
// { draft: 4, active: 12, completed: 38, paused: 2 }