lumnisai 0.1.21 → 0.1.23

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1115,6 +1115,44 @@ class MessagingResource {
1115
1115
  throw error;
1116
1116
  }
1117
1117
  }
1118
+ /**
1119
+ * Update a draft's content, subject, status, or outreach method.
1120
+ *
1121
+ * @param userId - User ID or email
1122
+ * @param draftId - Draft UUID to update
1123
+ * @param request - Draft update parameters
1124
+ * @param request.content - Optional new content
1125
+ * @param request.subject - Optional new subject
1126
+ * @param request.status - Optional new status
1127
+ * @param request.outreachMethod - Optional new outreach method (LinkedIn only)
1128
+ * @returns Updated draft
1129
+ * @throws MessagingNotFoundError if draft not found
1130
+ *
1131
+ * @example
1132
+ * ```typescript
1133
+ * // Update draft outreach method
1134
+ * const draft = await client.messaging.updateDraft(
1135
+ * 'user@example.com',
1136
+ * 'draft-uuid',
1137
+ * { outreachMethod: OutreachMethod.INMAIL }
1138
+ * );
1139
+ * ```
1140
+ */
1141
+ async updateDraft(userId, draftId, request) {
1142
+ try {
1143
+ const queryParams = new URLSearchParams();
1144
+ queryParams.append("user_id", userId);
1145
+ return await this.http.patch(
1146
+ `/messaging/drafts/${encodeURIComponent(draftId)}?${queryParams.toString()}`,
1147
+ request
1148
+ );
1149
+ } catch (error) {
1150
+ if (error instanceof NotFoundError) {
1151
+ throw new MessagingNotFoundError(`Draft not found: ${draftId}`);
1152
+ }
1153
+ throw error;
1154
+ }
1155
+ }
1118
1156
  /**
1119
1157
  * Create drafts for multiple prospects with AI generation.
1120
1158
  *
@@ -1528,7 +1566,15 @@ class MessagingResource {
1528
1566
  );
1529
1567
  }
1530
1568
  /**
1531
- * Send multiple drafts with rate limiting
1569
+ * Send multiple drafts with rate limiting and optional per-draft overrides.
1570
+ *
1571
+ * @param userId - User ID or email
1572
+ * @param request - Batch send parameters
1573
+ * @param request.draftIds - List of draft IDs to send
1574
+ * @param request.sendRatePerDay - Optional daily send limit (1-100)
1575
+ * @param request.priority - Optional queue priority (0-10)
1576
+ * @param request.draftOverrides - Optional per-draft overrides
1577
+ * @returns Batch send response with results
1532
1578
  */
1533
1579
  async sendBatchDrafts(userId, request) {
1534
1580
  const queryParams = new URLSearchParams();
@@ -1538,6 +1584,48 @@ class MessagingResource {
1538
1584
  request
1539
1585
  );
1540
1586
  }
1587
+ /**
1588
+ * Cancel a queued draft.
1589
+ *
1590
+ * This cancels a draft that was queued for later sending (status='scheduled').
1591
+ * The draft status will be set to 'discarded' and removed from the send queue.
1592
+ *
1593
+ * Can also cancel drafts in 'pending_review' or 'approved' status.
1594
+ *
1595
+ * @param userId - User ID or email
1596
+ * @param draftId - Draft UUID to cancel
1597
+ * @returns CancelDraftResponse with success status
1598
+ * @throws MessagingValidationError if draft cannot be cancelled (already sent, etc.)
1599
+ * @throws MessagingNotFoundError if draft not found
1600
+ *
1601
+ * @example
1602
+ * ```typescript
1603
+ * // Cancel a queued draft
1604
+ * const result = await client.messaging.cancelDraft('user@example.com', 'draft-uuid');
1605
+ * if (result.success) {
1606
+ * console.log(`Draft cancelled: ${result.draftId}`);
1607
+ * }
1608
+ * ```
1609
+ */
1610
+ async cancelDraft(userId, draftId) {
1611
+ try {
1612
+ const queryParams = new URLSearchParams();
1613
+ queryParams.append("user_id", userId);
1614
+ return await this.http.post(
1615
+ `/messaging/drafts/${encodeURIComponent(draftId)}/cancel?${queryParams.toString()}`
1616
+ );
1617
+ } catch (error) {
1618
+ if (error instanceof NotFoundError) {
1619
+ throw new MessagingNotFoundError(`Draft not found: ${draftId}`);
1620
+ }
1621
+ if (error instanceof ValidationError) {
1622
+ throw new MessagingValidationError(
1623
+ error.message || `Cannot cancel draft: ${draftId}`
1624
+ );
1625
+ }
1626
+ throw error;
1627
+ }
1628
+ }
1541
1629
  /**
1542
1630
  * Delete a single conversation and all its messages.
1543
1631
  *
package/dist/index.d.cts CHANGED
@@ -1549,6 +1549,19 @@ interface CreateDraftRequest {
1549
1549
  outreachMethod?: string | null;
1550
1550
  organizationId?: string | null;
1551
1551
  }
1552
+ /**
1553
+ * Request to update a draft
1554
+ */
1555
+ interface UpdateDraftRequest {
1556
+ content?: string | null;
1557
+ subject?: string | null;
1558
+ status?: string | null;
1559
+ /**
1560
+ * Override outreach method (LinkedIn only).
1561
+ * Valid values: 'connection_request' | 'direct_message' | 'inmail' | 'inmail_escalation'
1562
+ */
1563
+ outreachMethod?: OutreachMethod | null;
1564
+ }
1552
1565
  /**
1553
1566
  * Prospect info for batch draft creation
1554
1567
  */
@@ -1578,6 +1591,11 @@ interface ProspectInfo {
1578
1591
  * Merged with batch context (prospect keys take precedence).
1579
1592
  */
1580
1593
  aiContext?: Record<string, any> | null;
1594
+ /**
1595
+ * Queue priority (0-10). Higher = processed first when rate limited.
1596
+ * @default 0
1597
+ */
1598
+ priority?: number;
1581
1599
  }
1582
1600
  /**
1583
1601
  * Request to create batch drafts
@@ -1601,11 +1619,42 @@ interface BatchDraftRequest {
1601
1619
  organizationId?: string | null;
1602
1620
  }
1603
1621
  /**
1604
- * Request to batch send drafts
1622
+ * Per-draft override options for batch send.
1623
+ */
1624
+ interface DraftSendOverride {
1625
+ /** Draft ID to apply override to */
1626
+ draftId: string;
1627
+ /**
1628
+ * If true, send connection request without personalized note (empty content).
1629
+ * Only applies to LinkedIn connection requests.
1630
+ */
1631
+ skipNote?: boolean;
1632
+ /**
1633
+ * Override the outreach method (e.g., switch to InMail).
1634
+ * Valid values: 'connection_request' | 'direct_message' | 'inmail' | 'inmail_escalation'
1635
+ * Note: Only applies to LinkedIn drafts.
1636
+ */
1637
+ outreachMethod?: OutreachMethod;
1638
+ }
1639
+ /**
1640
+ * Request to batch send drafts with optional rate limiting and queue priority.
1605
1641
  */
1606
1642
  interface BatchSendRequest {
1607
1643
  draftIds: string[];
1608
- sendRatePerDay?: number;
1644
+ /**
1645
+ * Daily send limit (1-100). If not provided, uses subscription-based limits for LinkedIn.
1646
+ */
1647
+ sendRatePerDay?: number | null;
1648
+ /**
1649
+ * Queue priority (0-10). Higher = processed first. Only applies to rate-limited items.
1650
+ * @default 0
1651
+ */
1652
+ priority?: number;
1653
+ /**
1654
+ * Optional per-draft overrides.
1655
+ * Applied before sending (updates drafts via PATCH).
1656
+ */
1657
+ draftOverrides?: DraftSendOverride[];
1609
1658
  }
1610
1659
  /**
1611
1660
  * Request to update LinkedIn subscription
@@ -1804,6 +1853,7 @@ interface EmailThreadSummary {
1804
1853
  */
1805
1854
  interface DraftResponse {
1806
1855
  id: string;
1856
+ /** Draft status: 'pending_review' | 'approved' | 'scheduled' | 'sending' | 'sent' | 'failed' | 'discarded' */
1807
1857
  status: string;
1808
1858
  content: string;
1809
1859
  createdAt: string;
@@ -1813,6 +1863,10 @@ interface DraftResponse {
1813
1863
  outreachMethod?: 'direct_message' | 'connection_request' | 'inmail' | 'email' | null;
1814
1864
  /** Subject line for email drafts (optional) */
1815
1865
  subject?: string | null;
1866
+ /** ISO timestamp when queued message will be sent (if status is 'scheduled') */
1867
+ scheduledFor?: string | null;
1868
+ /** Error details if status is 'failed' */
1869
+ errorMessage?: string | null;
1816
1870
  }
1817
1871
  /**
1818
1872
  * Response from batch draft creation (legacy synchronous mode)
@@ -1961,6 +2015,15 @@ interface BatchSendResponse {
1961
2015
  failed: number;
1962
2016
  queued: number;
1963
2017
  }
2018
+ /**
2019
+ * Response from cancelling a draft
2020
+ */
2021
+ interface CancelDraftResponse {
2022
+ success: boolean;
2023
+ draftId?: string;
2024
+ prospectExternalId?: string | null;
2025
+ error?: string;
2026
+ }
1964
2027
  /**
1965
2028
  * Response from deleting a single conversation
1966
2029
  */
@@ -2264,6 +2327,30 @@ declare class MessagingResource {
2264
2327
  * ```
2265
2328
  */
2266
2329
  getDraft(userId: string, draftId: string): Promise<DraftResponse>;
2330
+ /**
2331
+ * Update a draft's content, subject, status, or outreach method.
2332
+ *
2333
+ * @param userId - User ID or email
2334
+ * @param draftId - Draft UUID to update
2335
+ * @param request - Draft update parameters
2336
+ * @param request.content - Optional new content
2337
+ * @param request.subject - Optional new subject
2338
+ * @param request.status - Optional new status
2339
+ * @param request.outreachMethod - Optional new outreach method (LinkedIn only)
2340
+ * @returns Updated draft
2341
+ * @throws MessagingNotFoundError if draft not found
2342
+ *
2343
+ * @example
2344
+ * ```typescript
2345
+ * // Update draft outreach method
2346
+ * const draft = await client.messaging.updateDraft(
2347
+ * 'user@example.com',
2348
+ * 'draft-uuid',
2349
+ * { outreachMethod: OutreachMethod.INMAIL }
2350
+ * );
2351
+ * ```
2352
+ */
2353
+ updateDraft(userId: string, draftId: string, request: UpdateDraftRequest): Promise<DraftResponse>;
2267
2354
  /**
2268
2355
  * Create drafts for multiple prospects with AI generation.
2269
2356
  *
@@ -2445,9 +2532,41 @@ declare class MessagingResource {
2445
2532
  */
2446
2533
  sendDraft(draftId: string, userId: string): Promise<SendResult>;
2447
2534
  /**
2448
- * Send multiple drafts with rate limiting
2535
+ * Send multiple drafts with rate limiting and optional per-draft overrides.
2536
+ *
2537
+ * @param userId - User ID or email
2538
+ * @param request - Batch send parameters
2539
+ * @param request.draftIds - List of draft IDs to send
2540
+ * @param request.sendRatePerDay - Optional daily send limit (1-100)
2541
+ * @param request.priority - Optional queue priority (0-10)
2542
+ * @param request.draftOverrides - Optional per-draft overrides
2543
+ * @returns Batch send response with results
2449
2544
  */
2450
2545
  sendBatchDrafts(userId: string, request: BatchSendRequest): Promise<BatchSendResponse>;
2546
+ /**
2547
+ * Cancel a queued draft.
2548
+ *
2549
+ * This cancels a draft that was queued for later sending (status='scheduled').
2550
+ * The draft status will be set to 'discarded' and removed from the send queue.
2551
+ *
2552
+ * Can also cancel drafts in 'pending_review' or 'approved' status.
2553
+ *
2554
+ * @param userId - User ID or email
2555
+ * @param draftId - Draft UUID to cancel
2556
+ * @returns CancelDraftResponse with success status
2557
+ * @throws MessagingValidationError if draft cannot be cancelled (already sent, etc.)
2558
+ * @throws MessagingNotFoundError if draft not found
2559
+ *
2560
+ * @example
2561
+ * ```typescript
2562
+ * // Cancel a queued draft
2563
+ * const result = await client.messaging.cancelDraft('user@example.com', 'draft-uuid');
2564
+ * if (result.success) {
2565
+ * console.log(`Draft cancelled: ${result.draftId}`);
2566
+ * }
2567
+ * ```
2568
+ */
2569
+ cancelDraft(userId: string, draftId: string): Promise<CancelDraftResponse>;
2451
2570
  /**
2452
2571
  * Delete a single conversation and all its messages.
2453
2572
  *
@@ -3149,4 +3268,4 @@ declare class ProgressTracker {
3149
3268
  */
3150
3269
  declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
3151
3270
 
3152
- export { ACTION_DELAYS, type AgentConfig, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppliedFilters, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BatchCheckConnectionRequest, type BatchCheckPriorContactRequest, type BatchCheckPriorContactResponse, type BatchConnectionRequest, type BatchConnectionResponse, type BatchConnectionStatus, type BatchConnectionStatusResponse, type BatchDraftCompleteData, type BatchDraftCreatedData, type BatchDraftErrorData, type BatchDraftJobProgress, type BatchDraftJobResponse, type BatchDraftJobStartedData, type BatchDraftJobStatusResponse, type BatchDraftProgressData, type BatchDraftRequest, type BatchDraftResponse, type BatchDraftStreamCallbacks, type BatchDraftStreamEvent, type BatchDraftStreamEventType, BatchJobStatus, type BatchProspectIdentifier, type BatchSendRequest, type BatchSendResponse, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, type ChannelContactHistory, ChannelType, type CheckAppEnabledParams, type CheckLinkedInConnectionRequest, type CheckPriorContactRequest, type CheckPriorContactResponse, type ChunkingStrategy, type ConnectionAcceptedData, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ConnectionSummary, type ContentType, type ConversationDetail, ConversationStatus, type ConversationSummary, type CreateDraftRequest, type CreateFeedbackRequest, type CreateFeedbackResponse, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DeleteConversationResponse, type DeleteConversationsByProjectResponse, type DisconnectRequest, type DisconnectResponse, type DraftResponse, DraftStatus, type DuplicateHandling, type Email, type EmailThreadSummary, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FeedbackListResponse, type FeedbackObject, type FeedbackType, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type FilterLogic, type FilterValue, type GetConnectionStatusParams, type GetToolsRequest, type GetToolsResponse, type GetUserConnectionsParams, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LINKEDIN_LIMITS, type LinkedInAccountInfoResponse, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInLimitSubscriptionType, type LinkedInLimits, type LinkedInSendRequest, type LinkedInSubscriptionInfo, LinkedInSubscriptionType, type ListProvidersResponse, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type MessageReceivedData, type MessageResponse, type MessageSentData, MessageType, MessagingAPIError, MessagingConnectionError, MessagingNotFoundError, MessagingResource, MessagingSendError, MessagingValidationError, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NetworkDistance, NoDataSourcesError, NotFoundError, OutreachMethod, type PaginationInfo, type PaginationParams, PeopleDataSource, PeopleResource, type PeopleSearchRequest, type PeopleSearchResponse, type PersonResult, type Plan, type PriorContactMessage, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, type ProspectConnectionCheck, type ProspectInfo, type ProspectPriorContactResult, type ProspectSyncIdentifier, type ProspectSyncResult, ProviderType, QueueItemStatus, type QuickPeopleSearchOutput, RATE_LIMIT_COOLDOWNS, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type SalaryRange, type Scope, type SelectedSkill, type SendMessageRequest, type SendMessageResponse, type SendReplyRequest, type SendResult, type SkillAnalyticsRequest, type SkillEffectivenessMetrics, type SkillGuidelineBase, type SkillGuidelineCreate, type SkillGuidelineListResponse, type SkillGuidelineResponse, type SkillGuidelineUpdate, type SkillRetrievalMetadata, type SkillUsageBase, type SkillUsageCreate, type SkillUsageListResponse, type SkillUsageResponse, type SkillUsageUpdate, SkillsResource, SourcesNotAvailableError, type SpecializedAgentParams, type SpecializedAgentType, type StoreApiKeyRequest, type SyncJobResponse, SyncJobStatus, type SyncProspectRequest, type SyncProspectResponse, type SyncRequest, type SyncStats, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, UNIPILE_RATE_LIMIT_ERRORS, UNIPILE_SAFE_LIMITS, type UUID, type UnlinkConversationsResponse, type UpdateAppStatusParams, type UpdateAppStatusResponse, type UpdateLinkedInSubscriptionRequest, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError, type WebhookEvent, type WebhookPayload, canSendInmail, displayProgress, formatProgressEntry, getBestSubscriptionForAction, getConnectionRequestLimit, getInmailAllowance, getLimits, getMessageLimit, hasOpenProfileMessages, verifyWebhookSignature };
3271
+ export { ACTION_DELAYS, type AgentConfig, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppliedFilters, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BatchCheckConnectionRequest, type BatchCheckPriorContactRequest, type BatchCheckPriorContactResponse, type BatchConnectionRequest, type BatchConnectionResponse, type BatchConnectionStatus, type BatchConnectionStatusResponse, type BatchDraftCompleteData, type BatchDraftCreatedData, type BatchDraftErrorData, type BatchDraftJobProgress, type BatchDraftJobResponse, type BatchDraftJobStartedData, type BatchDraftJobStatusResponse, type BatchDraftProgressData, type BatchDraftRequest, type BatchDraftResponse, type BatchDraftStreamCallbacks, type BatchDraftStreamEvent, type BatchDraftStreamEventType, BatchJobStatus, type BatchProspectIdentifier, type BatchSendRequest, type BatchSendResponse, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelDraftResponse, type CancelResponseResponse, type ChannelContactHistory, ChannelType, type CheckAppEnabledParams, type CheckLinkedInConnectionRequest, type CheckPriorContactRequest, type CheckPriorContactResponse, type ChunkingStrategy, type ConnectionAcceptedData, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ConnectionSummary, type ContentType, type ConversationDetail, ConversationStatus, type ConversationSummary, type CreateDraftRequest, type CreateFeedbackRequest, type CreateFeedbackResponse, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DeleteConversationResponse, type DeleteConversationsByProjectResponse, type DisconnectRequest, type DisconnectResponse, type DraftResponse, type DraftSendOverride, DraftStatus, type DuplicateHandling, type Email, type EmailThreadSummary, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FeedbackListResponse, type FeedbackObject, type FeedbackType, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type FilterLogic, type FilterValue, type GetConnectionStatusParams, type GetToolsRequest, type GetToolsResponse, type GetUserConnectionsParams, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LINKEDIN_LIMITS, type LinkedInAccountInfoResponse, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInLimitSubscriptionType, type LinkedInLimits, type LinkedInSendRequest, type LinkedInSubscriptionInfo, LinkedInSubscriptionType, type ListProvidersResponse, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type MessageReceivedData, type MessageResponse, type MessageSentData, MessageType, MessagingAPIError, MessagingConnectionError, MessagingNotFoundError, MessagingResource, MessagingSendError, MessagingValidationError, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NetworkDistance, NoDataSourcesError, NotFoundError, OutreachMethod, type PaginationInfo, type PaginationParams, PeopleDataSource, PeopleResource, type PeopleSearchRequest, type PeopleSearchResponse, type PersonResult, type Plan, type PriorContactMessage, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, type ProspectConnectionCheck, type ProspectInfo, type ProspectPriorContactResult, type ProspectSyncIdentifier, type ProspectSyncResult, ProviderType, QueueItemStatus, type QuickPeopleSearchOutput, RATE_LIMIT_COOLDOWNS, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type SalaryRange, type Scope, type SelectedSkill, type SendMessageRequest, type SendMessageResponse, type SendReplyRequest, type SendResult, type SkillAnalyticsRequest, type SkillEffectivenessMetrics, type SkillGuidelineBase, type SkillGuidelineCreate, type SkillGuidelineListResponse, type SkillGuidelineResponse, type SkillGuidelineUpdate, type SkillRetrievalMetadata, type SkillUsageBase, type SkillUsageCreate, type SkillUsageListResponse, type SkillUsageResponse, type SkillUsageUpdate, SkillsResource, SourcesNotAvailableError, type SpecializedAgentParams, type SpecializedAgentType, type StoreApiKeyRequest, type SyncJobResponse, SyncJobStatus, type SyncProspectRequest, type SyncProspectResponse, type SyncRequest, type SyncStats, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, UNIPILE_RATE_LIMIT_ERRORS, UNIPILE_SAFE_LIMITS, type UUID, type UnlinkConversationsResponse, type UpdateAppStatusParams, type UpdateAppStatusResponse, type UpdateDraftRequest, type UpdateLinkedInSubscriptionRequest, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError, type WebhookEvent, type WebhookPayload, canSendInmail, displayProgress, formatProgressEntry, getBestSubscriptionForAction, getConnectionRequestLimit, getInmailAllowance, getLimits, getMessageLimit, hasOpenProfileMessages, verifyWebhookSignature };
package/dist/index.d.mts CHANGED
@@ -1549,6 +1549,19 @@ interface CreateDraftRequest {
1549
1549
  outreachMethod?: string | null;
1550
1550
  organizationId?: string | null;
1551
1551
  }
1552
+ /**
1553
+ * Request to update a draft
1554
+ */
1555
+ interface UpdateDraftRequest {
1556
+ content?: string | null;
1557
+ subject?: string | null;
1558
+ status?: string | null;
1559
+ /**
1560
+ * Override outreach method (LinkedIn only).
1561
+ * Valid values: 'connection_request' | 'direct_message' | 'inmail' | 'inmail_escalation'
1562
+ */
1563
+ outreachMethod?: OutreachMethod | null;
1564
+ }
1552
1565
  /**
1553
1566
  * Prospect info for batch draft creation
1554
1567
  */
@@ -1578,6 +1591,11 @@ interface ProspectInfo {
1578
1591
  * Merged with batch context (prospect keys take precedence).
1579
1592
  */
1580
1593
  aiContext?: Record<string, any> | null;
1594
+ /**
1595
+ * Queue priority (0-10). Higher = processed first when rate limited.
1596
+ * @default 0
1597
+ */
1598
+ priority?: number;
1581
1599
  }
1582
1600
  /**
1583
1601
  * Request to create batch drafts
@@ -1601,11 +1619,42 @@ interface BatchDraftRequest {
1601
1619
  organizationId?: string | null;
1602
1620
  }
1603
1621
  /**
1604
- * Request to batch send drafts
1622
+ * Per-draft override options for batch send.
1623
+ */
1624
+ interface DraftSendOverride {
1625
+ /** Draft ID to apply override to */
1626
+ draftId: string;
1627
+ /**
1628
+ * If true, send connection request without personalized note (empty content).
1629
+ * Only applies to LinkedIn connection requests.
1630
+ */
1631
+ skipNote?: boolean;
1632
+ /**
1633
+ * Override the outreach method (e.g., switch to InMail).
1634
+ * Valid values: 'connection_request' | 'direct_message' | 'inmail' | 'inmail_escalation'
1635
+ * Note: Only applies to LinkedIn drafts.
1636
+ */
1637
+ outreachMethod?: OutreachMethod;
1638
+ }
1639
+ /**
1640
+ * Request to batch send drafts with optional rate limiting and queue priority.
1605
1641
  */
1606
1642
  interface BatchSendRequest {
1607
1643
  draftIds: string[];
1608
- sendRatePerDay?: number;
1644
+ /**
1645
+ * Daily send limit (1-100). If not provided, uses subscription-based limits for LinkedIn.
1646
+ */
1647
+ sendRatePerDay?: number | null;
1648
+ /**
1649
+ * Queue priority (0-10). Higher = processed first. Only applies to rate-limited items.
1650
+ * @default 0
1651
+ */
1652
+ priority?: number;
1653
+ /**
1654
+ * Optional per-draft overrides.
1655
+ * Applied before sending (updates drafts via PATCH).
1656
+ */
1657
+ draftOverrides?: DraftSendOverride[];
1609
1658
  }
1610
1659
  /**
1611
1660
  * Request to update LinkedIn subscription
@@ -1804,6 +1853,7 @@ interface EmailThreadSummary {
1804
1853
  */
1805
1854
  interface DraftResponse {
1806
1855
  id: string;
1856
+ /** Draft status: 'pending_review' | 'approved' | 'scheduled' | 'sending' | 'sent' | 'failed' | 'discarded' */
1807
1857
  status: string;
1808
1858
  content: string;
1809
1859
  createdAt: string;
@@ -1813,6 +1863,10 @@ interface DraftResponse {
1813
1863
  outreachMethod?: 'direct_message' | 'connection_request' | 'inmail' | 'email' | null;
1814
1864
  /** Subject line for email drafts (optional) */
1815
1865
  subject?: string | null;
1866
+ /** ISO timestamp when queued message will be sent (if status is 'scheduled') */
1867
+ scheduledFor?: string | null;
1868
+ /** Error details if status is 'failed' */
1869
+ errorMessage?: string | null;
1816
1870
  }
1817
1871
  /**
1818
1872
  * Response from batch draft creation (legacy synchronous mode)
@@ -1961,6 +2015,15 @@ interface BatchSendResponse {
1961
2015
  failed: number;
1962
2016
  queued: number;
1963
2017
  }
2018
+ /**
2019
+ * Response from cancelling a draft
2020
+ */
2021
+ interface CancelDraftResponse {
2022
+ success: boolean;
2023
+ draftId?: string;
2024
+ prospectExternalId?: string | null;
2025
+ error?: string;
2026
+ }
1964
2027
  /**
1965
2028
  * Response from deleting a single conversation
1966
2029
  */
@@ -2264,6 +2327,30 @@ declare class MessagingResource {
2264
2327
  * ```
2265
2328
  */
2266
2329
  getDraft(userId: string, draftId: string): Promise<DraftResponse>;
2330
+ /**
2331
+ * Update a draft's content, subject, status, or outreach method.
2332
+ *
2333
+ * @param userId - User ID or email
2334
+ * @param draftId - Draft UUID to update
2335
+ * @param request - Draft update parameters
2336
+ * @param request.content - Optional new content
2337
+ * @param request.subject - Optional new subject
2338
+ * @param request.status - Optional new status
2339
+ * @param request.outreachMethod - Optional new outreach method (LinkedIn only)
2340
+ * @returns Updated draft
2341
+ * @throws MessagingNotFoundError if draft not found
2342
+ *
2343
+ * @example
2344
+ * ```typescript
2345
+ * // Update draft outreach method
2346
+ * const draft = await client.messaging.updateDraft(
2347
+ * 'user@example.com',
2348
+ * 'draft-uuid',
2349
+ * { outreachMethod: OutreachMethod.INMAIL }
2350
+ * );
2351
+ * ```
2352
+ */
2353
+ updateDraft(userId: string, draftId: string, request: UpdateDraftRequest): Promise<DraftResponse>;
2267
2354
  /**
2268
2355
  * Create drafts for multiple prospects with AI generation.
2269
2356
  *
@@ -2445,9 +2532,41 @@ declare class MessagingResource {
2445
2532
  */
2446
2533
  sendDraft(draftId: string, userId: string): Promise<SendResult>;
2447
2534
  /**
2448
- * Send multiple drafts with rate limiting
2535
+ * Send multiple drafts with rate limiting and optional per-draft overrides.
2536
+ *
2537
+ * @param userId - User ID or email
2538
+ * @param request - Batch send parameters
2539
+ * @param request.draftIds - List of draft IDs to send
2540
+ * @param request.sendRatePerDay - Optional daily send limit (1-100)
2541
+ * @param request.priority - Optional queue priority (0-10)
2542
+ * @param request.draftOverrides - Optional per-draft overrides
2543
+ * @returns Batch send response with results
2449
2544
  */
2450
2545
  sendBatchDrafts(userId: string, request: BatchSendRequest): Promise<BatchSendResponse>;
2546
+ /**
2547
+ * Cancel a queued draft.
2548
+ *
2549
+ * This cancels a draft that was queued for later sending (status='scheduled').
2550
+ * The draft status will be set to 'discarded' and removed from the send queue.
2551
+ *
2552
+ * Can also cancel drafts in 'pending_review' or 'approved' status.
2553
+ *
2554
+ * @param userId - User ID or email
2555
+ * @param draftId - Draft UUID to cancel
2556
+ * @returns CancelDraftResponse with success status
2557
+ * @throws MessagingValidationError if draft cannot be cancelled (already sent, etc.)
2558
+ * @throws MessagingNotFoundError if draft not found
2559
+ *
2560
+ * @example
2561
+ * ```typescript
2562
+ * // Cancel a queued draft
2563
+ * const result = await client.messaging.cancelDraft('user@example.com', 'draft-uuid');
2564
+ * if (result.success) {
2565
+ * console.log(`Draft cancelled: ${result.draftId}`);
2566
+ * }
2567
+ * ```
2568
+ */
2569
+ cancelDraft(userId: string, draftId: string): Promise<CancelDraftResponse>;
2451
2570
  /**
2452
2571
  * Delete a single conversation and all its messages.
2453
2572
  *
@@ -3149,4 +3268,4 @@ declare class ProgressTracker {
3149
3268
  */
3150
3269
  declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
3151
3270
 
3152
- export { ACTION_DELAYS, type AgentConfig, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppliedFilters, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BatchCheckConnectionRequest, type BatchCheckPriorContactRequest, type BatchCheckPriorContactResponse, type BatchConnectionRequest, type BatchConnectionResponse, type BatchConnectionStatus, type BatchConnectionStatusResponse, type BatchDraftCompleteData, type BatchDraftCreatedData, type BatchDraftErrorData, type BatchDraftJobProgress, type BatchDraftJobResponse, type BatchDraftJobStartedData, type BatchDraftJobStatusResponse, type BatchDraftProgressData, type BatchDraftRequest, type BatchDraftResponse, type BatchDraftStreamCallbacks, type BatchDraftStreamEvent, type BatchDraftStreamEventType, BatchJobStatus, type BatchProspectIdentifier, type BatchSendRequest, type BatchSendResponse, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, type ChannelContactHistory, ChannelType, type CheckAppEnabledParams, type CheckLinkedInConnectionRequest, type CheckPriorContactRequest, type CheckPriorContactResponse, type ChunkingStrategy, type ConnectionAcceptedData, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ConnectionSummary, type ContentType, type ConversationDetail, ConversationStatus, type ConversationSummary, type CreateDraftRequest, type CreateFeedbackRequest, type CreateFeedbackResponse, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DeleteConversationResponse, type DeleteConversationsByProjectResponse, type DisconnectRequest, type DisconnectResponse, type DraftResponse, DraftStatus, type DuplicateHandling, type Email, type EmailThreadSummary, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FeedbackListResponse, type FeedbackObject, type FeedbackType, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type FilterLogic, type FilterValue, type GetConnectionStatusParams, type GetToolsRequest, type GetToolsResponse, type GetUserConnectionsParams, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LINKEDIN_LIMITS, type LinkedInAccountInfoResponse, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInLimitSubscriptionType, type LinkedInLimits, type LinkedInSendRequest, type LinkedInSubscriptionInfo, LinkedInSubscriptionType, type ListProvidersResponse, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type MessageReceivedData, type MessageResponse, type MessageSentData, MessageType, MessagingAPIError, MessagingConnectionError, MessagingNotFoundError, MessagingResource, MessagingSendError, MessagingValidationError, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NetworkDistance, NoDataSourcesError, NotFoundError, OutreachMethod, type PaginationInfo, type PaginationParams, PeopleDataSource, PeopleResource, type PeopleSearchRequest, type PeopleSearchResponse, type PersonResult, type Plan, type PriorContactMessage, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, type ProspectConnectionCheck, type ProspectInfo, type ProspectPriorContactResult, type ProspectSyncIdentifier, type ProspectSyncResult, ProviderType, QueueItemStatus, type QuickPeopleSearchOutput, RATE_LIMIT_COOLDOWNS, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type SalaryRange, type Scope, type SelectedSkill, type SendMessageRequest, type SendMessageResponse, type SendReplyRequest, type SendResult, type SkillAnalyticsRequest, type SkillEffectivenessMetrics, type SkillGuidelineBase, type SkillGuidelineCreate, type SkillGuidelineListResponse, type SkillGuidelineResponse, type SkillGuidelineUpdate, type SkillRetrievalMetadata, type SkillUsageBase, type SkillUsageCreate, type SkillUsageListResponse, type SkillUsageResponse, type SkillUsageUpdate, SkillsResource, SourcesNotAvailableError, type SpecializedAgentParams, type SpecializedAgentType, type StoreApiKeyRequest, type SyncJobResponse, SyncJobStatus, type SyncProspectRequest, type SyncProspectResponse, type SyncRequest, type SyncStats, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, UNIPILE_RATE_LIMIT_ERRORS, UNIPILE_SAFE_LIMITS, type UUID, type UnlinkConversationsResponse, type UpdateAppStatusParams, type UpdateAppStatusResponse, type UpdateLinkedInSubscriptionRequest, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError, type WebhookEvent, type WebhookPayload, canSendInmail, displayProgress, formatProgressEntry, getBestSubscriptionForAction, getConnectionRequestLimit, getInmailAllowance, getLimits, getMessageLimit, hasOpenProfileMessages, verifyWebhookSignature };
3271
+ export { ACTION_DELAYS, type AgentConfig, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppliedFilters, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BatchCheckConnectionRequest, type BatchCheckPriorContactRequest, type BatchCheckPriorContactResponse, type BatchConnectionRequest, type BatchConnectionResponse, type BatchConnectionStatus, type BatchConnectionStatusResponse, type BatchDraftCompleteData, type BatchDraftCreatedData, type BatchDraftErrorData, type BatchDraftJobProgress, type BatchDraftJobResponse, type BatchDraftJobStartedData, type BatchDraftJobStatusResponse, type BatchDraftProgressData, type BatchDraftRequest, type BatchDraftResponse, type BatchDraftStreamCallbacks, type BatchDraftStreamEvent, type BatchDraftStreamEventType, BatchJobStatus, type BatchProspectIdentifier, type BatchSendRequest, type BatchSendResponse, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelDraftResponse, type CancelResponseResponse, type ChannelContactHistory, ChannelType, type CheckAppEnabledParams, type CheckLinkedInConnectionRequest, type CheckPriorContactRequest, type CheckPriorContactResponse, type ChunkingStrategy, type ConnectionAcceptedData, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ConnectionSummary, type ContentType, type ConversationDetail, ConversationStatus, type ConversationSummary, type CreateDraftRequest, type CreateFeedbackRequest, type CreateFeedbackResponse, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DeleteConversationResponse, type DeleteConversationsByProjectResponse, type DisconnectRequest, type DisconnectResponse, type DraftResponse, type DraftSendOverride, DraftStatus, type DuplicateHandling, type Email, type EmailThreadSummary, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FeedbackListResponse, type FeedbackObject, type FeedbackType, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type FilterLogic, type FilterValue, type GetConnectionStatusParams, type GetToolsRequest, type GetToolsResponse, type GetUserConnectionsParams, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LINKEDIN_LIMITS, type LinkedInAccountInfoResponse, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInLimitSubscriptionType, type LinkedInLimits, type LinkedInSendRequest, type LinkedInSubscriptionInfo, LinkedInSubscriptionType, type ListProvidersResponse, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type MessageReceivedData, type MessageResponse, type MessageSentData, MessageType, MessagingAPIError, MessagingConnectionError, MessagingNotFoundError, MessagingResource, MessagingSendError, MessagingValidationError, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NetworkDistance, NoDataSourcesError, NotFoundError, OutreachMethod, type PaginationInfo, type PaginationParams, PeopleDataSource, PeopleResource, type PeopleSearchRequest, type PeopleSearchResponse, type PersonResult, type Plan, type PriorContactMessage, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, type ProspectConnectionCheck, type ProspectInfo, type ProspectPriorContactResult, type ProspectSyncIdentifier, type ProspectSyncResult, ProviderType, QueueItemStatus, type QuickPeopleSearchOutput, RATE_LIMIT_COOLDOWNS, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type SalaryRange, type Scope, type SelectedSkill, type SendMessageRequest, type SendMessageResponse, type SendReplyRequest, type SendResult, type SkillAnalyticsRequest, type SkillEffectivenessMetrics, type SkillGuidelineBase, type SkillGuidelineCreate, type SkillGuidelineListResponse, type SkillGuidelineResponse, type SkillGuidelineUpdate, type SkillRetrievalMetadata, type SkillUsageBase, type SkillUsageCreate, type SkillUsageListResponse, type SkillUsageResponse, type SkillUsageUpdate, SkillsResource, SourcesNotAvailableError, type SpecializedAgentParams, type SpecializedAgentType, type StoreApiKeyRequest, type SyncJobResponse, SyncJobStatus, type SyncProspectRequest, type SyncProspectResponse, type SyncRequest, type SyncStats, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, UNIPILE_RATE_LIMIT_ERRORS, UNIPILE_SAFE_LIMITS, type UUID, type UnlinkConversationsResponse, type UpdateAppStatusParams, type UpdateAppStatusResponse, type UpdateDraftRequest, type UpdateLinkedInSubscriptionRequest, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError, type WebhookEvent, type WebhookPayload, canSendInmail, displayProgress, formatProgressEntry, getBestSubscriptionForAction, getConnectionRequestLimit, getInmailAllowance, getLimits, getMessageLimit, hasOpenProfileMessages, verifyWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -1549,6 +1549,19 @@ interface CreateDraftRequest {
1549
1549
  outreachMethod?: string | null;
1550
1550
  organizationId?: string | null;
1551
1551
  }
1552
+ /**
1553
+ * Request to update a draft
1554
+ */
1555
+ interface UpdateDraftRequest {
1556
+ content?: string | null;
1557
+ subject?: string | null;
1558
+ status?: string | null;
1559
+ /**
1560
+ * Override outreach method (LinkedIn only).
1561
+ * Valid values: 'connection_request' | 'direct_message' | 'inmail' | 'inmail_escalation'
1562
+ */
1563
+ outreachMethod?: OutreachMethod | null;
1564
+ }
1552
1565
  /**
1553
1566
  * Prospect info for batch draft creation
1554
1567
  */
@@ -1578,6 +1591,11 @@ interface ProspectInfo {
1578
1591
  * Merged with batch context (prospect keys take precedence).
1579
1592
  */
1580
1593
  aiContext?: Record<string, any> | null;
1594
+ /**
1595
+ * Queue priority (0-10). Higher = processed first when rate limited.
1596
+ * @default 0
1597
+ */
1598
+ priority?: number;
1581
1599
  }
1582
1600
  /**
1583
1601
  * Request to create batch drafts
@@ -1601,11 +1619,42 @@ interface BatchDraftRequest {
1601
1619
  organizationId?: string | null;
1602
1620
  }
1603
1621
  /**
1604
- * Request to batch send drafts
1622
+ * Per-draft override options for batch send.
1623
+ */
1624
+ interface DraftSendOverride {
1625
+ /** Draft ID to apply override to */
1626
+ draftId: string;
1627
+ /**
1628
+ * If true, send connection request without personalized note (empty content).
1629
+ * Only applies to LinkedIn connection requests.
1630
+ */
1631
+ skipNote?: boolean;
1632
+ /**
1633
+ * Override the outreach method (e.g., switch to InMail).
1634
+ * Valid values: 'connection_request' | 'direct_message' | 'inmail' | 'inmail_escalation'
1635
+ * Note: Only applies to LinkedIn drafts.
1636
+ */
1637
+ outreachMethod?: OutreachMethod;
1638
+ }
1639
+ /**
1640
+ * Request to batch send drafts with optional rate limiting and queue priority.
1605
1641
  */
1606
1642
  interface BatchSendRequest {
1607
1643
  draftIds: string[];
1608
- sendRatePerDay?: number;
1644
+ /**
1645
+ * Daily send limit (1-100). If not provided, uses subscription-based limits for LinkedIn.
1646
+ */
1647
+ sendRatePerDay?: number | null;
1648
+ /**
1649
+ * Queue priority (0-10). Higher = processed first. Only applies to rate-limited items.
1650
+ * @default 0
1651
+ */
1652
+ priority?: number;
1653
+ /**
1654
+ * Optional per-draft overrides.
1655
+ * Applied before sending (updates drafts via PATCH).
1656
+ */
1657
+ draftOverrides?: DraftSendOverride[];
1609
1658
  }
1610
1659
  /**
1611
1660
  * Request to update LinkedIn subscription
@@ -1804,6 +1853,7 @@ interface EmailThreadSummary {
1804
1853
  */
1805
1854
  interface DraftResponse {
1806
1855
  id: string;
1856
+ /** Draft status: 'pending_review' | 'approved' | 'scheduled' | 'sending' | 'sent' | 'failed' | 'discarded' */
1807
1857
  status: string;
1808
1858
  content: string;
1809
1859
  createdAt: string;
@@ -1813,6 +1863,10 @@ interface DraftResponse {
1813
1863
  outreachMethod?: 'direct_message' | 'connection_request' | 'inmail' | 'email' | null;
1814
1864
  /** Subject line for email drafts (optional) */
1815
1865
  subject?: string | null;
1866
+ /** ISO timestamp when queued message will be sent (if status is 'scheduled') */
1867
+ scheduledFor?: string | null;
1868
+ /** Error details if status is 'failed' */
1869
+ errorMessage?: string | null;
1816
1870
  }
1817
1871
  /**
1818
1872
  * Response from batch draft creation (legacy synchronous mode)
@@ -1961,6 +2015,15 @@ interface BatchSendResponse {
1961
2015
  failed: number;
1962
2016
  queued: number;
1963
2017
  }
2018
+ /**
2019
+ * Response from cancelling a draft
2020
+ */
2021
+ interface CancelDraftResponse {
2022
+ success: boolean;
2023
+ draftId?: string;
2024
+ prospectExternalId?: string | null;
2025
+ error?: string;
2026
+ }
1964
2027
  /**
1965
2028
  * Response from deleting a single conversation
1966
2029
  */
@@ -2264,6 +2327,30 @@ declare class MessagingResource {
2264
2327
  * ```
2265
2328
  */
2266
2329
  getDraft(userId: string, draftId: string): Promise<DraftResponse>;
2330
+ /**
2331
+ * Update a draft's content, subject, status, or outreach method.
2332
+ *
2333
+ * @param userId - User ID or email
2334
+ * @param draftId - Draft UUID to update
2335
+ * @param request - Draft update parameters
2336
+ * @param request.content - Optional new content
2337
+ * @param request.subject - Optional new subject
2338
+ * @param request.status - Optional new status
2339
+ * @param request.outreachMethod - Optional new outreach method (LinkedIn only)
2340
+ * @returns Updated draft
2341
+ * @throws MessagingNotFoundError if draft not found
2342
+ *
2343
+ * @example
2344
+ * ```typescript
2345
+ * // Update draft outreach method
2346
+ * const draft = await client.messaging.updateDraft(
2347
+ * 'user@example.com',
2348
+ * 'draft-uuid',
2349
+ * { outreachMethod: OutreachMethod.INMAIL }
2350
+ * );
2351
+ * ```
2352
+ */
2353
+ updateDraft(userId: string, draftId: string, request: UpdateDraftRequest): Promise<DraftResponse>;
2267
2354
  /**
2268
2355
  * Create drafts for multiple prospects with AI generation.
2269
2356
  *
@@ -2445,9 +2532,41 @@ declare class MessagingResource {
2445
2532
  */
2446
2533
  sendDraft(draftId: string, userId: string): Promise<SendResult>;
2447
2534
  /**
2448
- * Send multiple drafts with rate limiting
2535
+ * Send multiple drafts with rate limiting and optional per-draft overrides.
2536
+ *
2537
+ * @param userId - User ID or email
2538
+ * @param request - Batch send parameters
2539
+ * @param request.draftIds - List of draft IDs to send
2540
+ * @param request.sendRatePerDay - Optional daily send limit (1-100)
2541
+ * @param request.priority - Optional queue priority (0-10)
2542
+ * @param request.draftOverrides - Optional per-draft overrides
2543
+ * @returns Batch send response with results
2449
2544
  */
2450
2545
  sendBatchDrafts(userId: string, request: BatchSendRequest): Promise<BatchSendResponse>;
2546
+ /**
2547
+ * Cancel a queued draft.
2548
+ *
2549
+ * This cancels a draft that was queued for later sending (status='scheduled').
2550
+ * The draft status will be set to 'discarded' and removed from the send queue.
2551
+ *
2552
+ * Can also cancel drafts in 'pending_review' or 'approved' status.
2553
+ *
2554
+ * @param userId - User ID or email
2555
+ * @param draftId - Draft UUID to cancel
2556
+ * @returns CancelDraftResponse with success status
2557
+ * @throws MessagingValidationError if draft cannot be cancelled (already sent, etc.)
2558
+ * @throws MessagingNotFoundError if draft not found
2559
+ *
2560
+ * @example
2561
+ * ```typescript
2562
+ * // Cancel a queued draft
2563
+ * const result = await client.messaging.cancelDraft('user@example.com', 'draft-uuid');
2564
+ * if (result.success) {
2565
+ * console.log(`Draft cancelled: ${result.draftId}`);
2566
+ * }
2567
+ * ```
2568
+ */
2569
+ cancelDraft(userId: string, draftId: string): Promise<CancelDraftResponse>;
2451
2570
  /**
2452
2571
  * Delete a single conversation and all its messages.
2453
2572
  *
@@ -3149,4 +3268,4 @@ declare class ProgressTracker {
3149
3268
  */
3150
3269
  declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
3151
3270
 
3152
- export { ACTION_DELAYS, type AgentConfig, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppliedFilters, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BatchCheckConnectionRequest, type BatchCheckPriorContactRequest, type BatchCheckPriorContactResponse, type BatchConnectionRequest, type BatchConnectionResponse, type BatchConnectionStatus, type BatchConnectionStatusResponse, type BatchDraftCompleteData, type BatchDraftCreatedData, type BatchDraftErrorData, type BatchDraftJobProgress, type BatchDraftJobResponse, type BatchDraftJobStartedData, type BatchDraftJobStatusResponse, type BatchDraftProgressData, type BatchDraftRequest, type BatchDraftResponse, type BatchDraftStreamCallbacks, type BatchDraftStreamEvent, type BatchDraftStreamEventType, BatchJobStatus, type BatchProspectIdentifier, type BatchSendRequest, type BatchSendResponse, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, type ChannelContactHistory, ChannelType, type CheckAppEnabledParams, type CheckLinkedInConnectionRequest, type CheckPriorContactRequest, type CheckPriorContactResponse, type ChunkingStrategy, type ConnectionAcceptedData, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ConnectionSummary, type ContentType, type ConversationDetail, ConversationStatus, type ConversationSummary, type CreateDraftRequest, type CreateFeedbackRequest, type CreateFeedbackResponse, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DeleteConversationResponse, type DeleteConversationsByProjectResponse, type DisconnectRequest, type DisconnectResponse, type DraftResponse, DraftStatus, type DuplicateHandling, type Email, type EmailThreadSummary, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FeedbackListResponse, type FeedbackObject, type FeedbackType, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type FilterLogic, type FilterValue, type GetConnectionStatusParams, type GetToolsRequest, type GetToolsResponse, type GetUserConnectionsParams, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LINKEDIN_LIMITS, type LinkedInAccountInfoResponse, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInLimitSubscriptionType, type LinkedInLimits, type LinkedInSendRequest, type LinkedInSubscriptionInfo, LinkedInSubscriptionType, type ListProvidersResponse, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type MessageReceivedData, type MessageResponse, type MessageSentData, MessageType, MessagingAPIError, MessagingConnectionError, MessagingNotFoundError, MessagingResource, MessagingSendError, MessagingValidationError, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NetworkDistance, NoDataSourcesError, NotFoundError, OutreachMethod, type PaginationInfo, type PaginationParams, PeopleDataSource, PeopleResource, type PeopleSearchRequest, type PeopleSearchResponse, type PersonResult, type Plan, type PriorContactMessage, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, type ProspectConnectionCheck, type ProspectInfo, type ProspectPriorContactResult, type ProspectSyncIdentifier, type ProspectSyncResult, ProviderType, QueueItemStatus, type QuickPeopleSearchOutput, RATE_LIMIT_COOLDOWNS, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type SalaryRange, type Scope, type SelectedSkill, type SendMessageRequest, type SendMessageResponse, type SendReplyRequest, type SendResult, type SkillAnalyticsRequest, type SkillEffectivenessMetrics, type SkillGuidelineBase, type SkillGuidelineCreate, type SkillGuidelineListResponse, type SkillGuidelineResponse, type SkillGuidelineUpdate, type SkillRetrievalMetadata, type SkillUsageBase, type SkillUsageCreate, type SkillUsageListResponse, type SkillUsageResponse, type SkillUsageUpdate, SkillsResource, SourcesNotAvailableError, type SpecializedAgentParams, type SpecializedAgentType, type StoreApiKeyRequest, type SyncJobResponse, SyncJobStatus, type SyncProspectRequest, type SyncProspectResponse, type SyncRequest, type SyncStats, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, UNIPILE_RATE_LIMIT_ERRORS, UNIPILE_SAFE_LIMITS, type UUID, type UnlinkConversationsResponse, type UpdateAppStatusParams, type UpdateAppStatusResponse, type UpdateLinkedInSubscriptionRequest, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError, type WebhookEvent, type WebhookPayload, canSendInmail, displayProgress, formatProgressEntry, getBestSubscriptionForAction, getConnectionRequestLimit, getInmailAllowance, getLimits, getMessageLimit, hasOpenProfileMessages, verifyWebhookSignature };
3271
+ export { ACTION_DELAYS, type AgentConfig, type ApiKeyMode, type ApiKeyModeRequest, type ApiKeyModeResponse, type ApiProvider, type AppEnabledResponse, type AppliedFilters, type AppsListResponse, type ArtifactObject, type ArtifactsListResponse, AuthenticationError, type BaseResource, type BatchCheckConnectionRequest, type BatchCheckPriorContactRequest, type BatchCheckPriorContactResponse, type BatchConnectionRequest, type BatchConnectionResponse, type BatchConnectionStatus, type BatchConnectionStatusResponse, type BatchDraftCompleteData, type BatchDraftCreatedData, type BatchDraftErrorData, type BatchDraftJobProgress, type BatchDraftJobResponse, type BatchDraftJobStartedData, type BatchDraftJobStatusResponse, type BatchDraftProgressData, type BatchDraftRequest, type BatchDraftResponse, type BatchDraftStreamCallbacks, type BatchDraftStreamEvent, type BatchDraftStreamEventType, BatchJobStatus, type BatchProspectIdentifier, type BatchSendRequest, type BatchSendResponse, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelDraftResponse, type CancelResponseResponse, type ChannelContactHistory, ChannelType, type CheckAppEnabledParams, type CheckLinkedInConnectionRequest, type CheckPriorContactRequest, type CheckPriorContactResponse, type ChunkingStrategy, type ConnectionAcceptedData, type ConnectionCallbackRequest, type ConnectionCallbackResponse, type ConnectionInfo, type ConnectionStatus, type ConnectionStatusResponse, type ConnectionSummary, type ContentType, type ConversationDetail, ConversationStatus, type ConversationSummary, type CreateDraftRequest, type CreateFeedbackRequest, type CreateFeedbackResponse, type CreateResponseRequest, type CreateResponseResponse, type CreateThreadRequest, type DatabaseStatus, type DeleteApiKeyResponse, type DeleteConversationResponse, type DeleteConversationsByProjectResponse, type DisconnectRequest, type DisconnectResponse, type DraftResponse, type DraftSendOverride, DraftStatus, type DuplicateHandling, type Email, type EmailThreadSummary, type ErrorResponse, ExternalAPIKeysResource, type ExternalApiKeyResponse, type FeedbackListResponse, type FeedbackObject, type FeedbackType, type FileAttachment, type FileChunk, type FileContentResponse, type FileListResponse, type FileMetadata, type FileScope, type FileScopeUpdateRequest, type FileSearchRequest, type FileSearchResponse, type FileSearchResult, type FileStatisticsResponse, type FileUploadResponse, FilesResource, type FilterLogic, type FilterValue, type GetConnectionStatusParams, type GetToolsRequest, type GetToolsResponse, type GetUserConnectionsParams, type InitiateConnectionRequest, type InitiateConnectionResponse, IntegrationsResource, InternalServerError, LINKEDIN_LIMITS, type LinkedInAccountInfoResponse, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInLimitSubscriptionType, type LinkedInLimits, type LinkedInSendRequest, type LinkedInSubscriptionInfo, LinkedInSubscriptionType, type ListProvidersResponse, LocalFileNotSupportedError, LumnisClient, type LumnisClientOptions, LumnisError, type LumnisErrorOptions, type MCPScope, type MCPServerCreateRequest, type MCPServerListResponse, type MCPServerResponse, type MCPServerUpdateRequest, MCPServersResource, type MCPToolListResponse, type MCPToolResponse, type MCPTransport, type Message, type MessageReceivedData, type MessageResponse, type MessageSentData, MessageType, MessagingAPIError, MessagingConnectionError, MessagingNotFoundError, MessagingResource, MessagingSendError, MessagingValidationError, type ModelAvailability, type ModelOverrides, type ModelPreferenceCreate, type ModelPreferencesBulkUpdate, ModelPreferencesResource, type ModelProvider, type ModelType, NetworkDistance, NoDataSourcesError, NotFoundError, OutreachMethod, type PaginationInfo, type PaginationParams, PeopleDataSource, PeopleResource, type PeopleSearchRequest, type PeopleSearchResponse, type PersonResult, type Plan, type PriorContactMessage, type ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, type ProspectConnectionCheck, type ProspectInfo, type ProspectPriorContactResult, type ProspectSyncIdentifier, type ProspectSyncResult, ProviderType, QueueItemStatus, type QuickPeopleSearchOutput, RATE_LIMIT_COOLDOWNS, RateLimitError, type RateLimitErrorOptions, type ResponseArtifact, type ResponseListResponse, type ResponseObject, type ResponseStatus, ResponsesResource, type SalaryRange, type Scope, type SelectedSkill, type SendMessageRequest, type SendMessageResponse, type SendReplyRequest, type SendResult, type SkillAnalyticsRequest, type SkillEffectivenessMetrics, type SkillGuidelineBase, type SkillGuidelineCreate, type SkillGuidelineListResponse, type SkillGuidelineResponse, type SkillGuidelineUpdate, type SkillRetrievalMetadata, type SkillUsageBase, type SkillUsageCreate, type SkillUsageListResponse, type SkillUsageResponse, type SkillUsageUpdate, SkillsResource, SourcesNotAvailableError, type SpecializedAgentParams, type SpecializedAgentType, type StoreApiKeyRequest, type SyncJobResponse, SyncJobStatus, type SyncProspectRequest, type SyncProspectResponse, type SyncRequest, type SyncStats, type TenantDetailsResponse, TenantInfoResource, type TenantModelPreference, type TenantModelPreferencesResponse, type TestConnectionResponse, type ThreadListResponse, type ThreadObject, type ThreadResponsesParams, ThreadsResource, type ToolInfo, UNIPILE_RATE_LIMIT_ERRORS, UNIPILE_SAFE_LIMITS, type UUID, type UnlinkConversationsResponse, type UpdateAppStatusParams, type UpdateAppStatusResponse, type UpdateDraftRequest, type UpdateLinkedInSubscriptionRequest, type UpdateThreadRequest, type UserConnectionsResponse, type UserCreateRequest, type UserDeleteResponse, type UserIdentifier, type UserListResponse, type UserResponse, type UserUpdateRequest, UsersResource, ValidationError, type WebhookEvent, type WebhookPayload, canSendInmail, displayProgress, formatProgressEntry, getBestSubscriptionForAction, getConnectionRequestLimit, getInmailAllowance, getLimits, getMessageLimit, hasOpenProfileMessages, verifyWebhookSignature };
package/dist/index.mjs CHANGED
@@ -1109,6 +1109,44 @@ class MessagingResource {
1109
1109
  throw error;
1110
1110
  }
1111
1111
  }
1112
+ /**
1113
+ * Update a draft's content, subject, status, or outreach method.
1114
+ *
1115
+ * @param userId - User ID or email
1116
+ * @param draftId - Draft UUID to update
1117
+ * @param request - Draft update parameters
1118
+ * @param request.content - Optional new content
1119
+ * @param request.subject - Optional new subject
1120
+ * @param request.status - Optional new status
1121
+ * @param request.outreachMethod - Optional new outreach method (LinkedIn only)
1122
+ * @returns Updated draft
1123
+ * @throws MessagingNotFoundError if draft not found
1124
+ *
1125
+ * @example
1126
+ * ```typescript
1127
+ * // Update draft outreach method
1128
+ * const draft = await client.messaging.updateDraft(
1129
+ * 'user@example.com',
1130
+ * 'draft-uuid',
1131
+ * { outreachMethod: OutreachMethod.INMAIL }
1132
+ * );
1133
+ * ```
1134
+ */
1135
+ async updateDraft(userId, draftId, request) {
1136
+ try {
1137
+ const queryParams = new URLSearchParams();
1138
+ queryParams.append("user_id", userId);
1139
+ return await this.http.patch(
1140
+ `/messaging/drafts/${encodeURIComponent(draftId)}?${queryParams.toString()}`,
1141
+ request
1142
+ );
1143
+ } catch (error) {
1144
+ if (error instanceof NotFoundError) {
1145
+ throw new MessagingNotFoundError(`Draft not found: ${draftId}`);
1146
+ }
1147
+ throw error;
1148
+ }
1149
+ }
1112
1150
  /**
1113
1151
  * Create drafts for multiple prospects with AI generation.
1114
1152
  *
@@ -1522,7 +1560,15 @@ class MessagingResource {
1522
1560
  );
1523
1561
  }
1524
1562
  /**
1525
- * Send multiple drafts with rate limiting
1563
+ * Send multiple drafts with rate limiting and optional per-draft overrides.
1564
+ *
1565
+ * @param userId - User ID or email
1566
+ * @param request - Batch send parameters
1567
+ * @param request.draftIds - List of draft IDs to send
1568
+ * @param request.sendRatePerDay - Optional daily send limit (1-100)
1569
+ * @param request.priority - Optional queue priority (0-10)
1570
+ * @param request.draftOverrides - Optional per-draft overrides
1571
+ * @returns Batch send response with results
1526
1572
  */
1527
1573
  async sendBatchDrafts(userId, request) {
1528
1574
  const queryParams = new URLSearchParams();
@@ -1532,6 +1578,48 @@ class MessagingResource {
1532
1578
  request
1533
1579
  );
1534
1580
  }
1581
+ /**
1582
+ * Cancel a queued draft.
1583
+ *
1584
+ * This cancels a draft that was queued for later sending (status='scheduled').
1585
+ * The draft status will be set to 'discarded' and removed from the send queue.
1586
+ *
1587
+ * Can also cancel drafts in 'pending_review' or 'approved' status.
1588
+ *
1589
+ * @param userId - User ID or email
1590
+ * @param draftId - Draft UUID to cancel
1591
+ * @returns CancelDraftResponse with success status
1592
+ * @throws MessagingValidationError if draft cannot be cancelled (already sent, etc.)
1593
+ * @throws MessagingNotFoundError if draft not found
1594
+ *
1595
+ * @example
1596
+ * ```typescript
1597
+ * // Cancel a queued draft
1598
+ * const result = await client.messaging.cancelDraft('user@example.com', 'draft-uuid');
1599
+ * if (result.success) {
1600
+ * console.log(`Draft cancelled: ${result.draftId}`);
1601
+ * }
1602
+ * ```
1603
+ */
1604
+ async cancelDraft(userId, draftId) {
1605
+ try {
1606
+ const queryParams = new URLSearchParams();
1607
+ queryParams.append("user_id", userId);
1608
+ return await this.http.post(
1609
+ `/messaging/drafts/${encodeURIComponent(draftId)}/cancel?${queryParams.toString()}`
1610
+ );
1611
+ } catch (error) {
1612
+ if (error instanceof NotFoundError) {
1613
+ throw new MessagingNotFoundError(`Draft not found: ${draftId}`);
1614
+ }
1615
+ if (error instanceof ValidationError) {
1616
+ throw new MessagingValidationError(
1617
+ error.message || `Cannot cancel draft: ${draftId}`
1618
+ );
1619
+ }
1620
+ throw error;
1621
+ }
1622
+ }
1535
1623
  /**
1536
1624
  * Delete a single conversation and all its messages.
1537
1625
  *
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lumnisai",
3
3
  "type": "module",
4
- "version": "0.1.21",
4
+ "version": "0.1.23",
5
5
  "description": "Official Node.js SDK for the Lumnis AI API",
6
6
  "author": "Lumnis AI",
7
7
  "license": "MIT",