lumnisai 0.1.11 → 0.1.13

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
@@ -824,6 +824,137 @@ class MessagingResource {
824
824
  null
825
825
  );
826
826
  }
827
+ /**
828
+ * Check if there has been any prior contact with a person across all channels.
829
+ *
830
+ * This searches your connected messaging accounts (Gmail, Outlook, LinkedIn) to find
831
+ * any historical communication with a person, even if they're not in the system as a prospect.
832
+ *
833
+ * **Use cases:**
834
+ * - Before adding a new prospect, check if you've already contacted them
835
+ * - Detect duplicate outreach across different systems
836
+ * - Find historical conversation context before sending a new message
837
+ *
838
+ * **Required:** At least one of `email`, `linkedinUrl`, or `providerId` must be provided.
839
+ *
840
+ * **Channels:**
841
+ * - If `channels` is not specified, checks all channels based on identifiers provided:
842
+ * - `email` → checks Gmail and Outlook
843
+ * - `linkedinUrl` or `providerId` → checks LinkedIn
844
+ * - Specify `channels` to limit which accounts to search (e.g., `["linkedin"]`)
845
+ *
846
+ * **Returns:**
847
+ * - `hasPriorContact`: True if ANY communication exists on ANY channel
848
+ * - `channelsChecked`: List of channels that were searched
849
+ * - `channelsWithContact`: List of channels where contact was found
850
+ * - `contactHistory`: Per-channel details including:
851
+ * - `isUserInitiated`: True if you sent the first message
852
+ * - `messages`: Most recent N messages (configurable via `messageLimit`)
853
+ * - `firstContactAt` / `lastContactAt`: Timestamps of first and last messages
854
+ * - `cached`: True if result was served from cache (results are cached for 2 hours)
855
+ *
856
+ * **Caching:**
857
+ * - Results are cached in Redis for 2 hours to improve performance
858
+ * - Set `skipCache: true` to force a fresh check
859
+ *
860
+ * @param userId - User ID or email
861
+ * @param request - CheckPriorContactRequest with identifiers and options
862
+ * @returns CheckPriorContactResponse with contact history
863
+ * @throws MessagingValidationError if no identifier provided
864
+ */
865
+ async checkPriorContact(userId, request) {
866
+ if (!request.email && !request.linkedinUrl && !request.providerId) {
867
+ throw new MessagingValidationError(
868
+ "At least one of email, linkedinUrl, or providerId must be provided",
869
+ { code: "VALIDATION_ERROR" }
870
+ );
871
+ }
872
+ const queryParams = new URLSearchParams();
873
+ queryParams.append("user_id", userId);
874
+ const payload = {};
875
+ if (request.email) payload.email = request.email;
876
+ if (request.linkedinUrl) payload.linkedin_url = request.linkedinUrl;
877
+ if (request.providerId) payload.provider_id = request.providerId;
878
+ if (request.channels) payload.channels = request.channels;
879
+ if (request.messageLimit !== void 0 && request.messageLimit !== null) {
880
+ payload.message_limit = request.messageLimit;
881
+ }
882
+ if (request.skipCache !== void 0 && request.skipCache !== null) {
883
+ payload.skip_cache = request.skipCache;
884
+ }
885
+ return this.http.post(
886
+ `/messaging/check-prior-contact?${queryParams.toString()}`,
887
+ payload
888
+ );
889
+ }
890
+ /**
891
+ * Check prior contact for multiple prospects at once (parallelized).
892
+ *
893
+ * This is the batch version of `checkPriorContact` for efficiently checking
894
+ * many prospects at once. Useful when importing a list of prospects and need to
895
+ * identify which ones have been contacted before.
896
+ *
897
+ * **Limits:**
898
+ * - Max 50 prospects per request
899
+ * - Max 10 messages per channel per prospect (to keep response size manageable)
900
+ *
901
+ * **Request:**
902
+ * ```typescript
903
+ * {
904
+ * prospects: [
905
+ * { prospectId: "p1", email: "john@acme.com" },
906
+ * { prospectId: "p2", linkedinUrl: "https://linkedin.com/in/jane" },
907
+ * { prospectId: "p3", email: "bob@xyz.com", linkedinUrl: "https://linkedin.com/in/bob" }
908
+ * ],
909
+ * channels: ["gmail", "linkedin"], // Optional
910
+ * messageLimit: 3 // Messages per channel (default: 3)
911
+ * }
912
+ * ```
913
+ *
914
+ * **Response:**
915
+ * - `results`: Dict keyed by `prospectId` with contact history for each
916
+ * - `summary`: Aggregated counts {total, withContact, withoutContact, errors, cached}
917
+ *
918
+ * **Caching:**
919
+ * - Results are cached in Redis for 2 hours to improve performance
920
+ * - Set `skipCache: true` to force fresh checks for all prospects
921
+ *
922
+ * @param userId - User ID or email
923
+ * @param request - BatchCheckPriorContactRequest with prospects and options
924
+ * @returns BatchCheckPriorContactResponse with results keyed by prospectId
925
+ * @throws MessagingValidationError if any prospect lacks identifiers
926
+ */
927
+ async batchCheckPriorContact(userId, request) {
928
+ for (const prospect of request.prospects) {
929
+ if (!prospect.email && !prospect.linkedinUrl && !prospect.providerId) {
930
+ throw new MessagingValidationError(
931
+ `Prospect '${prospect.prospectId}' must have at least one of: email, linkedinUrl, or providerId`,
932
+ { code: "VALIDATION_ERROR" }
933
+ );
934
+ }
935
+ }
936
+ const queryParams = new URLSearchParams();
937
+ queryParams.append("user_id", userId);
938
+ const payload = {
939
+ prospects: request.prospects.map((p) => ({
940
+ prospect_id: p.prospectId,
941
+ email: p.email || void 0,
942
+ linkedin_url: p.linkedinUrl || void 0,
943
+ provider_id: p.providerId || void 0
944
+ }))
945
+ };
946
+ if (request.channels) payload.channels = request.channels;
947
+ if (request.messageLimit !== void 0 && request.messageLimit !== null) {
948
+ payload.message_limit = request.messageLimit;
949
+ }
950
+ if (request.skipCache !== void 0 && request.skipCache !== null) {
951
+ payload.skip_cache = request.skipCache;
952
+ }
953
+ return this.http.post(
954
+ `/messaging/check-prior-contact/batch?${queryParams.toString()}`,
955
+ payload
956
+ );
957
+ }
827
958
  }
828
959
 
829
960
  class ModelPreferencesResource {
package/dist/index.d.cts CHANGED
@@ -1344,6 +1344,7 @@ interface LinkedInSendRequest {
1344
1344
  escalationDays?: number;
1345
1345
  projectId?: string | null;
1346
1346
  prospectExternalId?: string | null;
1347
+ organizationId?: string | null;
1347
1348
  }
1348
1349
  /**
1349
1350
  * Request to send a message
@@ -1357,12 +1358,14 @@ interface SendMessageRequest {
1357
1358
  recipientName?: string | null;
1358
1359
  projectId?: string | null;
1359
1360
  prospectExternalId?: string | null;
1361
+ organizationId?: string | null;
1360
1362
  }
1361
1363
  /**
1362
1364
  * Request to reply to a conversation
1363
1365
  */
1364
1366
  interface SendReplyRequest {
1365
1367
  content: string;
1368
+ organizationId?: string | null;
1366
1369
  }
1367
1370
  /**
1368
1371
  * Prospect connection check for batch operations
@@ -1394,6 +1397,7 @@ interface CreateDraftRequest {
1394
1397
  subject?: string | null;
1395
1398
  isPriority?: boolean;
1396
1399
  outreachMethod?: string | null;
1400
+ organizationId?: string | null;
1397
1401
  }
1398
1402
  /**
1399
1403
  * Prospect info for batch draft creation
@@ -1424,6 +1428,7 @@ interface BatchDraftRequest {
1424
1428
  contentTemplate?: string | null;
1425
1429
  useAiGeneration?: boolean;
1426
1430
  aiContext?: Record<string, any> | null;
1431
+ organizationId?: string | null;
1427
1432
  }
1428
1433
  /**
1429
1434
  * Request to batch send drafts
@@ -1649,6 +1654,122 @@ interface UnlinkConversationsResponse {
1649
1654
  project_id: string;
1650
1655
  unlinked_count: number;
1651
1656
  }
1657
+ /**
1658
+ * Request to check if there's been prior contact with a person
1659
+ */
1660
+ interface CheckPriorContactRequest {
1661
+ /** Email address to check (for Gmail/Outlook) */
1662
+ email?: string | null;
1663
+ /** LinkedIn profile URL to check */
1664
+ linkedinUrl?: string | null;
1665
+ /** LinkedIn provider ID to check */
1666
+ providerId?: string | null;
1667
+ /** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all connected channels */
1668
+ channels?: string[] | null;
1669
+ /** Max messages to return per channel (1-20, default: 5) */
1670
+ messageLimit?: number | null;
1671
+ /** Force fresh check, bypassing cache (default: false) */
1672
+ skipCache?: boolean | null;
1673
+ }
1674
+ /**
1675
+ * A message from prior contact history
1676
+ */
1677
+ interface PriorContactMessage {
1678
+ id: string;
1679
+ /** 'inbound' | 'outbound' */
1680
+ direction: string;
1681
+ content: string;
1682
+ subject?: string | null;
1683
+ senderName: string;
1684
+ /** ISO timestamp */
1685
+ sentAt: string;
1686
+ }
1687
+ /**
1688
+ * Contact history for a single channel
1689
+ */
1690
+ interface ChannelContactHistory {
1691
+ /** 'gmail' | 'outlook' | 'linkedin' */
1692
+ channel: string;
1693
+ hasContact: boolean;
1694
+ /** True if user sent first message */
1695
+ isUserInitiated: boolean;
1696
+ threadId?: string | null;
1697
+ /** Internal ID if we have one */
1698
+ conversationId?: string | null;
1699
+ messageCount: number;
1700
+ /** ISO timestamp */
1701
+ firstContactAt?: string | null;
1702
+ /** ISO timestamp */
1703
+ lastContactAt?: string | null;
1704
+ prospectName?: string | null;
1705
+ messages: PriorContactMessage[];
1706
+ }
1707
+ /**
1708
+ * Response from prior contact check
1709
+ */
1710
+ interface CheckPriorContactResponse {
1711
+ /** True if ANY channel has contact */
1712
+ hasPriorContact: boolean;
1713
+ channelsChecked: string[];
1714
+ channelsWithContact: string[];
1715
+ contactHistory: ChannelContactHistory[];
1716
+ /** True if result was served from cache */
1717
+ cached?: boolean;
1718
+ }
1719
+ /**
1720
+ * Identifier for a prospect in batch prior contact check
1721
+ */
1722
+ interface BatchProspectIdentifier {
1723
+ /** Unique identifier for this prospect (for mapping results) */
1724
+ prospectId: string;
1725
+ /** Email address to check */
1726
+ email?: string | null;
1727
+ /** LinkedIn profile URL */
1728
+ linkedinUrl?: string | null;
1729
+ /** LinkedIn provider ID */
1730
+ providerId?: string | null;
1731
+ }
1732
+ /**
1733
+ * Request to check prior contact for multiple prospects
1734
+ */
1735
+ interface BatchCheckPriorContactRequest {
1736
+ /** List of prospects to check (max 50) */
1737
+ prospects: BatchProspectIdentifier[];
1738
+ /** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all based on identifiers */
1739
+ channels?: string[] | null;
1740
+ /** Max messages per channel per prospect (1-10, default: 3) */
1741
+ messageLimit?: number | null;
1742
+ /** Force fresh check for all prospects, bypassing cache (default: false) */
1743
+ skipCache?: boolean | null;
1744
+ }
1745
+ /**
1746
+ * Prior contact result for a single prospect in batch
1747
+ */
1748
+ interface ProspectPriorContactResult {
1749
+ prospectId: string;
1750
+ hasPriorContact: boolean;
1751
+ channelsWithContact: string[];
1752
+ contactHistory: ChannelContactHistory[];
1753
+ /** True if this result was from cache */
1754
+ cached?: boolean;
1755
+ error?: string | null;
1756
+ }
1757
+ /**
1758
+ * Response from batch prior contact check
1759
+ */
1760
+ interface BatchCheckPriorContactResponse {
1761
+ /** Keyed by prospect_id */
1762
+ results: Record<string, ProspectPriorContactResult>;
1763
+ /** Aggregated counts */
1764
+ summary: {
1765
+ total: number;
1766
+ withContact: number;
1767
+ withoutContact: number;
1768
+ errors: number;
1769
+ /** Number of results served from cache */
1770
+ cached?: number;
1771
+ };
1772
+ }
1652
1773
 
1653
1774
  declare class MessagingResource {
1654
1775
  private readonly http;
@@ -1783,6 +1904,83 @@ declare class MessagingResource {
1783
1904
  * @returns UnlinkConversationsResponse with unlinked count
1784
1905
  */
1785
1906
  unlinkConversationsFromProject(projectId: string, userId: string): Promise<UnlinkConversationsResponse>;
1907
+ /**
1908
+ * Check if there has been any prior contact with a person across all channels.
1909
+ *
1910
+ * This searches your connected messaging accounts (Gmail, Outlook, LinkedIn) to find
1911
+ * any historical communication with a person, even if they're not in the system as a prospect.
1912
+ *
1913
+ * **Use cases:**
1914
+ * - Before adding a new prospect, check if you've already contacted them
1915
+ * - Detect duplicate outreach across different systems
1916
+ * - Find historical conversation context before sending a new message
1917
+ *
1918
+ * **Required:** At least one of `email`, `linkedinUrl`, or `providerId` must be provided.
1919
+ *
1920
+ * **Channels:**
1921
+ * - If `channels` is not specified, checks all channels based on identifiers provided:
1922
+ * - `email` → checks Gmail and Outlook
1923
+ * - `linkedinUrl` or `providerId` → checks LinkedIn
1924
+ * - Specify `channels` to limit which accounts to search (e.g., `["linkedin"]`)
1925
+ *
1926
+ * **Returns:**
1927
+ * - `hasPriorContact`: True if ANY communication exists on ANY channel
1928
+ * - `channelsChecked`: List of channels that were searched
1929
+ * - `channelsWithContact`: List of channels where contact was found
1930
+ * - `contactHistory`: Per-channel details including:
1931
+ * - `isUserInitiated`: True if you sent the first message
1932
+ * - `messages`: Most recent N messages (configurable via `messageLimit`)
1933
+ * - `firstContactAt` / `lastContactAt`: Timestamps of first and last messages
1934
+ * - `cached`: True if result was served from cache (results are cached for 2 hours)
1935
+ *
1936
+ * **Caching:**
1937
+ * - Results are cached in Redis for 2 hours to improve performance
1938
+ * - Set `skipCache: true` to force a fresh check
1939
+ *
1940
+ * @param userId - User ID or email
1941
+ * @param request - CheckPriorContactRequest with identifiers and options
1942
+ * @returns CheckPriorContactResponse with contact history
1943
+ * @throws MessagingValidationError if no identifier provided
1944
+ */
1945
+ checkPriorContact(userId: string, request: CheckPriorContactRequest): Promise<CheckPriorContactResponse>;
1946
+ /**
1947
+ * Check prior contact for multiple prospects at once (parallelized).
1948
+ *
1949
+ * This is the batch version of `checkPriorContact` for efficiently checking
1950
+ * many prospects at once. Useful when importing a list of prospects and need to
1951
+ * identify which ones have been contacted before.
1952
+ *
1953
+ * **Limits:**
1954
+ * - Max 50 prospects per request
1955
+ * - Max 10 messages per channel per prospect (to keep response size manageable)
1956
+ *
1957
+ * **Request:**
1958
+ * ```typescript
1959
+ * {
1960
+ * prospects: [
1961
+ * { prospectId: "p1", email: "john@acme.com" },
1962
+ * { prospectId: "p2", linkedinUrl: "https://linkedin.com/in/jane" },
1963
+ * { prospectId: "p3", email: "bob@xyz.com", linkedinUrl: "https://linkedin.com/in/bob" }
1964
+ * ],
1965
+ * channels: ["gmail", "linkedin"], // Optional
1966
+ * messageLimit: 3 // Messages per channel (default: 3)
1967
+ * }
1968
+ * ```
1969
+ *
1970
+ * **Response:**
1971
+ * - `results`: Dict keyed by `prospectId` with contact history for each
1972
+ * - `summary`: Aggregated counts {total, withContact, withoutContact, errors, cached}
1973
+ *
1974
+ * **Caching:**
1975
+ * - Results are cached in Redis for 2 hours to improve performance
1976
+ * - Set `skipCache: true` to force fresh checks for all prospects
1977
+ *
1978
+ * @param userId - User ID or email
1979
+ * @param request - BatchCheckPriorContactRequest with prospects and options
1980
+ * @returns BatchCheckPriorContactResponse with results keyed by prospectId
1981
+ * @throws MessagingValidationError if any prospect lacks identifiers
1982
+ */
1983
+ batchCheckPriorContact(userId: string, request: BatchCheckPriorContactRequest): Promise<BatchCheckPriorContactResponse>;
1786
1984
  }
1787
1985
 
1788
1986
  declare class ModelPreferencesResource {
@@ -2376,4 +2574,4 @@ declare class ProgressTracker {
2376
2574
  declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
2377
2575
 
2378
2576
  export = LumnisClient;
2379
- export { 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 BatchConnectionRequest, type BatchConnectionResponse, type BatchConnectionStatus, type BatchConnectionStatusResponse, type BatchDraftRequest, type BatchDraftResponse, type BatchSendRequest, type BatchSendResponse, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, ChannelType, type CheckAppEnabledParams, type CheckLinkedInConnectionRequest, 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, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInSendRequest, 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 ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, type ProspectConnectionCheck, type ProspectInfo, type ProspectSyncIdentifier, type ProspectSyncResult, ProviderType, QueueItemStatus, type QuickPeopleSearchOutput, 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, 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, displayProgress, formatProgressEntry, verifyWebhookSignature };
2577
+ export { 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 BatchDraftRequest, type BatchDraftResponse, 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, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInSendRequest, 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, 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, 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, displayProgress, formatProgressEntry, verifyWebhookSignature };
package/dist/index.d.mts CHANGED
@@ -1344,6 +1344,7 @@ interface LinkedInSendRequest {
1344
1344
  escalationDays?: number;
1345
1345
  projectId?: string | null;
1346
1346
  prospectExternalId?: string | null;
1347
+ organizationId?: string | null;
1347
1348
  }
1348
1349
  /**
1349
1350
  * Request to send a message
@@ -1357,12 +1358,14 @@ interface SendMessageRequest {
1357
1358
  recipientName?: string | null;
1358
1359
  projectId?: string | null;
1359
1360
  prospectExternalId?: string | null;
1361
+ organizationId?: string | null;
1360
1362
  }
1361
1363
  /**
1362
1364
  * Request to reply to a conversation
1363
1365
  */
1364
1366
  interface SendReplyRequest {
1365
1367
  content: string;
1368
+ organizationId?: string | null;
1366
1369
  }
1367
1370
  /**
1368
1371
  * Prospect connection check for batch operations
@@ -1394,6 +1397,7 @@ interface CreateDraftRequest {
1394
1397
  subject?: string | null;
1395
1398
  isPriority?: boolean;
1396
1399
  outreachMethod?: string | null;
1400
+ organizationId?: string | null;
1397
1401
  }
1398
1402
  /**
1399
1403
  * Prospect info for batch draft creation
@@ -1424,6 +1428,7 @@ interface BatchDraftRequest {
1424
1428
  contentTemplate?: string | null;
1425
1429
  useAiGeneration?: boolean;
1426
1430
  aiContext?: Record<string, any> | null;
1431
+ organizationId?: string | null;
1427
1432
  }
1428
1433
  /**
1429
1434
  * Request to batch send drafts
@@ -1649,6 +1654,122 @@ interface UnlinkConversationsResponse {
1649
1654
  project_id: string;
1650
1655
  unlinked_count: number;
1651
1656
  }
1657
+ /**
1658
+ * Request to check if there's been prior contact with a person
1659
+ */
1660
+ interface CheckPriorContactRequest {
1661
+ /** Email address to check (for Gmail/Outlook) */
1662
+ email?: string | null;
1663
+ /** LinkedIn profile URL to check */
1664
+ linkedinUrl?: string | null;
1665
+ /** LinkedIn provider ID to check */
1666
+ providerId?: string | null;
1667
+ /** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all connected channels */
1668
+ channels?: string[] | null;
1669
+ /** Max messages to return per channel (1-20, default: 5) */
1670
+ messageLimit?: number | null;
1671
+ /** Force fresh check, bypassing cache (default: false) */
1672
+ skipCache?: boolean | null;
1673
+ }
1674
+ /**
1675
+ * A message from prior contact history
1676
+ */
1677
+ interface PriorContactMessage {
1678
+ id: string;
1679
+ /** 'inbound' | 'outbound' */
1680
+ direction: string;
1681
+ content: string;
1682
+ subject?: string | null;
1683
+ senderName: string;
1684
+ /** ISO timestamp */
1685
+ sentAt: string;
1686
+ }
1687
+ /**
1688
+ * Contact history for a single channel
1689
+ */
1690
+ interface ChannelContactHistory {
1691
+ /** 'gmail' | 'outlook' | 'linkedin' */
1692
+ channel: string;
1693
+ hasContact: boolean;
1694
+ /** True if user sent first message */
1695
+ isUserInitiated: boolean;
1696
+ threadId?: string | null;
1697
+ /** Internal ID if we have one */
1698
+ conversationId?: string | null;
1699
+ messageCount: number;
1700
+ /** ISO timestamp */
1701
+ firstContactAt?: string | null;
1702
+ /** ISO timestamp */
1703
+ lastContactAt?: string | null;
1704
+ prospectName?: string | null;
1705
+ messages: PriorContactMessage[];
1706
+ }
1707
+ /**
1708
+ * Response from prior contact check
1709
+ */
1710
+ interface CheckPriorContactResponse {
1711
+ /** True if ANY channel has contact */
1712
+ hasPriorContact: boolean;
1713
+ channelsChecked: string[];
1714
+ channelsWithContact: string[];
1715
+ contactHistory: ChannelContactHistory[];
1716
+ /** True if result was served from cache */
1717
+ cached?: boolean;
1718
+ }
1719
+ /**
1720
+ * Identifier for a prospect in batch prior contact check
1721
+ */
1722
+ interface BatchProspectIdentifier {
1723
+ /** Unique identifier for this prospect (for mapping results) */
1724
+ prospectId: string;
1725
+ /** Email address to check */
1726
+ email?: string | null;
1727
+ /** LinkedIn profile URL */
1728
+ linkedinUrl?: string | null;
1729
+ /** LinkedIn provider ID */
1730
+ providerId?: string | null;
1731
+ }
1732
+ /**
1733
+ * Request to check prior contact for multiple prospects
1734
+ */
1735
+ interface BatchCheckPriorContactRequest {
1736
+ /** List of prospects to check (max 50) */
1737
+ prospects: BatchProspectIdentifier[];
1738
+ /** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all based on identifiers */
1739
+ channels?: string[] | null;
1740
+ /** Max messages per channel per prospect (1-10, default: 3) */
1741
+ messageLimit?: number | null;
1742
+ /** Force fresh check for all prospects, bypassing cache (default: false) */
1743
+ skipCache?: boolean | null;
1744
+ }
1745
+ /**
1746
+ * Prior contact result for a single prospect in batch
1747
+ */
1748
+ interface ProspectPriorContactResult {
1749
+ prospectId: string;
1750
+ hasPriorContact: boolean;
1751
+ channelsWithContact: string[];
1752
+ contactHistory: ChannelContactHistory[];
1753
+ /** True if this result was from cache */
1754
+ cached?: boolean;
1755
+ error?: string | null;
1756
+ }
1757
+ /**
1758
+ * Response from batch prior contact check
1759
+ */
1760
+ interface BatchCheckPriorContactResponse {
1761
+ /** Keyed by prospect_id */
1762
+ results: Record<string, ProspectPriorContactResult>;
1763
+ /** Aggregated counts */
1764
+ summary: {
1765
+ total: number;
1766
+ withContact: number;
1767
+ withoutContact: number;
1768
+ errors: number;
1769
+ /** Number of results served from cache */
1770
+ cached?: number;
1771
+ };
1772
+ }
1652
1773
 
1653
1774
  declare class MessagingResource {
1654
1775
  private readonly http;
@@ -1783,6 +1904,83 @@ declare class MessagingResource {
1783
1904
  * @returns UnlinkConversationsResponse with unlinked count
1784
1905
  */
1785
1906
  unlinkConversationsFromProject(projectId: string, userId: string): Promise<UnlinkConversationsResponse>;
1907
+ /**
1908
+ * Check if there has been any prior contact with a person across all channels.
1909
+ *
1910
+ * This searches your connected messaging accounts (Gmail, Outlook, LinkedIn) to find
1911
+ * any historical communication with a person, even if they're not in the system as a prospect.
1912
+ *
1913
+ * **Use cases:**
1914
+ * - Before adding a new prospect, check if you've already contacted them
1915
+ * - Detect duplicate outreach across different systems
1916
+ * - Find historical conversation context before sending a new message
1917
+ *
1918
+ * **Required:** At least one of `email`, `linkedinUrl`, or `providerId` must be provided.
1919
+ *
1920
+ * **Channels:**
1921
+ * - If `channels` is not specified, checks all channels based on identifiers provided:
1922
+ * - `email` → checks Gmail and Outlook
1923
+ * - `linkedinUrl` or `providerId` → checks LinkedIn
1924
+ * - Specify `channels` to limit which accounts to search (e.g., `["linkedin"]`)
1925
+ *
1926
+ * **Returns:**
1927
+ * - `hasPriorContact`: True if ANY communication exists on ANY channel
1928
+ * - `channelsChecked`: List of channels that were searched
1929
+ * - `channelsWithContact`: List of channels where contact was found
1930
+ * - `contactHistory`: Per-channel details including:
1931
+ * - `isUserInitiated`: True if you sent the first message
1932
+ * - `messages`: Most recent N messages (configurable via `messageLimit`)
1933
+ * - `firstContactAt` / `lastContactAt`: Timestamps of first and last messages
1934
+ * - `cached`: True if result was served from cache (results are cached for 2 hours)
1935
+ *
1936
+ * **Caching:**
1937
+ * - Results are cached in Redis for 2 hours to improve performance
1938
+ * - Set `skipCache: true` to force a fresh check
1939
+ *
1940
+ * @param userId - User ID or email
1941
+ * @param request - CheckPriorContactRequest with identifiers and options
1942
+ * @returns CheckPriorContactResponse with contact history
1943
+ * @throws MessagingValidationError if no identifier provided
1944
+ */
1945
+ checkPriorContact(userId: string, request: CheckPriorContactRequest): Promise<CheckPriorContactResponse>;
1946
+ /**
1947
+ * Check prior contact for multiple prospects at once (parallelized).
1948
+ *
1949
+ * This is the batch version of `checkPriorContact` for efficiently checking
1950
+ * many prospects at once. Useful when importing a list of prospects and need to
1951
+ * identify which ones have been contacted before.
1952
+ *
1953
+ * **Limits:**
1954
+ * - Max 50 prospects per request
1955
+ * - Max 10 messages per channel per prospect (to keep response size manageable)
1956
+ *
1957
+ * **Request:**
1958
+ * ```typescript
1959
+ * {
1960
+ * prospects: [
1961
+ * { prospectId: "p1", email: "john@acme.com" },
1962
+ * { prospectId: "p2", linkedinUrl: "https://linkedin.com/in/jane" },
1963
+ * { prospectId: "p3", email: "bob@xyz.com", linkedinUrl: "https://linkedin.com/in/bob" }
1964
+ * ],
1965
+ * channels: ["gmail", "linkedin"], // Optional
1966
+ * messageLimit: 3 // Messages per channel (default: 3)
1967
+ * }
1968
+ * ```
1969
+ *
1970
+ * **Response:**
1971
+ * - `results`: Dict keyed by `prospectId` with contact history for each
1972
+ * - `summary`: Aggregated counts {total, withContact, withoutContact, errors, cached}
1973
+ *
1974
+ * **Caching:**
1975
+ * - Results are cached in Redis for 2 hours to improve performance
1976
+ * - Set `skipCache: true` to force fresh checks for all prospects
1977
+ *
1978
+ * @param userId - User ID or email
1979
+ * @param request - BatchCheckPriorContactRequest with prospects and options
1980
+ * @returns BatchCheckPriorContactResponse with results keyed by prospectId
1981
+ * @throws MessagingValidationError if any prospect lacks identifiers
1982
+ */
1983
+ batchCheckPriorContact(userId: string, request: BatchCheckPriorContactRequest): Promise<BatchCheckPriorContactResponse>;
1786
1984
  }
1787
1985
 
1788
1986
  declare class ModelPreferencesResource {
@@ -2375,4 +2573,4 @@ declare class ProgressTracker {
2375
2573
  */
2376
2574
  declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
2377
2575
 
2378
- export { 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 BatchConnectionRequest, type BatchConnectionResponse, type BatchConnectionStatus, type BatchConnectionStatusResponse, type BatchDraftRequest, type BatchDraftResponse, type BatchSendRequest, type BatchSendResponse, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, ChannelType, type CheckAppEnabledParams, type CheckLinkedInConnectionRequest, 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, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInSendRequest, 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 ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, type ProspectConnectionCheck, type ProspectInfo, type ProspectSyncIdentifier, type ProspectSyncResult, ProviderType, QueueItemStatus, type QuickPeopleSearchOutput, 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, 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, LumnisClient as default, displayProgress, formatProgressEntry, verifyWebhookSignature };
2576
+ export { 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 BatchDraftRequest, type BatchDraftResponse, 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, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInSendRequest, 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, 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, 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, LumnisClient as default, displayProgress, formatProgressEntry, verifyWebhookSignature };
package/dist/index.d.ts CHANGED
@@ -1344,6 +1344,7 @@ interface LinkedInSendRequest {
1344
1344
  escalationDays?: number;
1345
1345
  projectId?: string | null;
1346
1346
  prospectExternalId?: string | null;
1347
+ organizationId?: string | null;
1347
1348
  }
1348
1349
  /**
1349
1350
  * Request to send a message
@@ -1357,12 +1358,14 @@ interface SendMessageRequest {
1357
1358
  recipientName?: string | null;
1358
1359
  projectId?: string | null;
1359
1360
  prospectExternalId?: string | null;
1361
+ organizationId?: string | null;
1360
1362
  }
1361
1363
  /**
1362
1364
  * Request to reply to a conversation
1363
1365
  */
1364
1366
  interface SendReplyRequest {
1365
1367
  content: string;
1368
+ organizationId?: string | null;
1366
1369
  }
1367
1370
  /**
1368
1371
  * Prospect connection check for batch operations
@@ -1394,6 +1397,7 @@ interface CreateDraftRequest {
1394
1397
  subject?: string | null;
1395
1398
  isPriority?: boolean;
1396
1399
  outreachMethod?: string | null;
1400
+ organizationId?: string | null;
1397
1401
  }
1398
1402
  /**
1399
1403
  * Prospect info for batch draft creation
@@ -1424,6 +1428,7 @@ interface BatchDraftRequest {
1424
1428
  contentTemplate?: string | null;
1425
1429
  useAiGeneration?: boolean;
1426
1430
  aiContext?: Record<string, any> | null;
1431
+ organizationId?: string | null;
1427
1432
  }
1428
1433
  /**
1429
1434
  * Request to batch send drafts
@@ -1649,6 +1654,122 @@ interface UnlinkConversationsResponse {
1649
1654
  project_id: string;
1650
1655
  unlinked_count: number;
1651
1656
  }
1657
+ /**
1658
+ * Request to check if there's been prior contact with a person
1659
+ */
1660
+ interface CheckPriorContactRequest {
1661
+ /** Email address to check (for Gmail/Outlook) */
1662
+ email?: string | null;
1663
+ /** LinkedIn profile URL to check */
1664
+ linkedinUrl?: string | null;
1665
+ /** LinkedIn provider ID to check */
1666
+ providerId?: string | null;
1667
+ /** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all connected channels */
1668
+ channels?: string[] | null;
1669
+ /** Max messages to return per channel (1-20, default: 5) */
1670
+ messageLimit?: number | null;
1671
+ /** Force fresh check, bypassing cache (default: false) */
1672
+ skipCache?: boolean | null;
1673
+ }
1674
+ /**
1675
+ * A message from prior contact history
1676
+ */
1677
+ interface PriorContactMessage {
1678
+ id: string;
1679
+ /** 'inbound' | 'outbound' */
1680
+ direction: string;
1681
+ content: string;
1682
+ subject?: string | null;
1683
+ senderName: string;
1684
+ /** ISO timestamp */
1685
+ sentAt: string;
1686
+ }
1687
+ /**
1688
+ * Contact history for a single channel
1689
+ */
1690
+ interface ChannelContactHistory {
1691
+ /** 'gmail' | 'outlook' | 'linkedin' */
1692
+ channel: string;
1693
+ hasContact: boolean;
1694
+ /** True if user sent first message */
1695
+ isUserInitiated: boolean;
1696
+ threadId?: string | null;
1697
+ /** Internal ID if we have one */
1698
+ conversationId?: string | null;
1699
+ messageCount: number;
1700
+ /** ISO timestamp */
1701
+ firstContactAt?: string | null;
1702
+ /** ISO timestamp */
1703
+ lastContactAt?: string | null;
1704
+ prospectName?: string | null;
1705
+ messages: PriorContactMessage[];
1706
+ }
1707
+ /**
1708
+ * Response from prior contact check
1709
+ */
1710
+ interface CheckPriorContactResponse {
1711
+ /** True if ANY channel has contact */
1712
+ hasPriorContact: boolean;
1713
+ channelsChecked: string[];
1714
+ channelsWithContact: string[];
1715
+ contactHistory: ChannelContactHistory[];
1716
+ /** True if result was served from cache */
1717
+ cached?: boolean;
1718
+ }
1719
+ /**
1720
+ * Identifier for a prospect in batch prior contact check
1721
+ */
1722
+ interface BatchProspectIdentifier {
1723
+ /** Unique identifier for this prospect (for mapping results) */
1724
+ prospectId: string;
1725
+ /** Email address to check */
1726
+ email?: string | null;
1727
+ /** LinkedIn profile URL */
1728
+ linkedinUrl?: string | null;
1729
+ /** LinkedIn provider ID */
1730
+ providerId?: string | null;
1731
+ }
1732
+ /**
1733
+ * Request to check prior contact for multiple prospects
1734
+ */
1735
+ interface BatchCheckPriorContactRequest {
1736
+ /** List of prospects to check (max 50) */
1737
+ prospects: BatchProspectIdentifier[];
1738
+ /** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all based on identifiers */
1739
+ channels?: string[] | null;
1740
+ /** Max messages per channel per prospect (1-10, default: 3) */
1741
+ messageLimit?: number | null;
1742
+ /** Force fresh check for all prospects, bypassing cache (default: false) */
1743
+ skipCache?: boolean | null;
1744
+ }
1745
+ /**
1746
+ * Prior contact result for a single prospect in batch
1747
+ */
1748
+ interface ProspectPriorContactResult {
1749
+ prospectId: string;
1750
+ hasPriorContact: boolean;
1751
+ channelsWithContact: string[];
1752
+ contactHistory: ChannelContactHistory[];
1753
+ /** True if this result was from cache */
1754
+ cached?: boolean;
1755
+ error?: string | null;
1756
+ }
1757
+ /**
1758
+ * Response from batch prior contact check
1759
+ */
1760
+ interface BatchCheckPriorContactResponse {
1761
+ /** Keyed by prospect_id */
1762
+ results: Record<string, ProspectPriorContactResult>;
1763
+ /** Aggregated counts */
1764
+ summary: {
1765
+ total: number;
1766
+ withContact: number;
1767
+ withoutContact: number;
1768
+ errors: number;
1769
+ /** Number of results served from cache */
1770
+ cached?: number;
1771
+ };
1772
+ }
1652
1773
 
1653
1774
  declare class MessagingResource {
1654
1775
  private readonly http;
@@ -1783,6 +1904,83 @@ declare class MessagingResource {
1783
1904
  * @returns UnlinkConversationsResponse with unlinked count
1784
1905
  */
1785
1906
  unlinkConversationsFromProject(projectId: string, userId: string): Promise<UnlinkConversationsResponse>;
1907
+ /**
1908
+ * Check if there has been any prior contact with a person across all channels.
1909
+ *
1910
+ * This searches your connected messaging accounts (Gmail, Outlook, LinkedIn) to find
1911
+ * any historical communication with a person, even if they're not in the system as a prospect.
1912
+ *
1913
+ * **Use cases:**
1914
+ * - Before adding a new prospect, check if you've already contacted them
1915
+ * - Detect duplicate outreach across different systems
1916
+ * - Find historical conversation context before sending a new message
1917
+ *
1918
+ * **Required:** At least one of `email`, `linkedinUrl`, or `providerId` must be provided.
1919
+ *
1920
+ * **Channels:**
1921
+ * - If `channels` is not specified, checks all channels based on identifiers provided:
1922
+ * - `email` → checks Gmail and Outlook
1923
+ * - `linkedinUrl` or `providerId` → checks LinkedIn
1924
+ * - Specify `channels` to limit which accounts to search (e.g., `["linkedin"]`)
1925
+ *
1926
+ * **Returns:**
1927
+ * - `hasPriorContact`: True if ANY communication exists on ANY channel
1928
+ * - `channelsChecked`: List of channels that were searched
1929
+ * - `channelsWithContact`: List of channels where contact was found
1930
+ * - `contactHistory`: Per-channel details including:
1931
+ * - `isUserInitiated`: True if you sent the first message
1932
+ * - `messages`: Most recent N messages (configurable via `messageLimit`)
1933
+ * - `firstContactAt` / `lastContactAt`: Timestamps of first and last messages
1934
+ * - `cached`: True if result was served from cache (results are cached for 2 hours)
1935
+ *
1936
+ * **Caching:**
1937
+ * - Results are cached in Redis for 2 hours to improve performance
1938
+ * - Set `skipCache: true` to force a fresh check
1939
+ *
1940
+ * @param userId - User ID or email
1941
+ * @param request - CheckPriorContactRequest with identifiers and options
1942
+ * @returns CheckPriorContactResponse with contact history
1943
+ * @throws MessagingValidationError if no identifier provided
1944
+ */
1945
+ checkPriorContact(userId: string, request: CheckPriorContactRequest): Promise<CheckPriorContactResponse>;
1946
+ /**
1947
+ * Check prior contact for multiple prospects at once (parallelized).
1948
+ *
1949
+ * This is the batch version of `checkPriorContact` for efficiently checking
1950
+ * many prospects at once. Useful when importing a list of prospects and need to
1951
+ * identify which ones have been contacted before.
1952
+ *
1953
+ * **Limits:**
1954
+ * - Max 50 prospects per request
1955
+ * - Max 10 messages per channel per prospect (to keep response size manageable)
1956
+ *
1957
+ * **Request:**
1958
+ * ```typescript
1959
+ * {
1960
+ * prospects: [
1961
+ * { prospectId: "p1", email: "john@acme.com" },
1962
+ * { prospectId: "p2", linkedinUrl: "https://linkedin.com/in/jane" },
1963
+ * { prospectId: "p3", email: "bob@xyz.com", linkedinUrl: "https://linkedin.com/in/bob" }
1964
+ * ],
1965
+ * channels: ["gmail", "linkedin"], // Optional
1966
+ * messageLimit: 3 // Messages per channel (default: 3)
1967
+ * }
1968
+ * ```
1969
+ *
1970
+ * **Response:**
1971
+ * - `results`: Dict keyed by `prospectId` with contact history for each
1972
+ * - `summary`: Aggregated counts {total, withContact, withoutContact, errors, cached}
1973
+ *
1974
+ * **Caching:**
1975
+ * - Results are cached in Redis for 2 hours to improve performance
1976
+ * - Set `skipCache: true` to force fresh checks for all prospects
1977
+ *
1978
+ * @param userId - User ID or email
1979
+ * @param request - BatchCheckPriorContactRequest with prospects and options
1980
+ * @returns BatchCheckPriorContactResponse with results keyed by prospectId
1981
+ * @throws MessagingValidationError if any prospect lacks identifiers
1982
+ */
1983
+ batchCheckPriorContact(userId: string, request: BatchCheckPriorContactRequest): Promise<BatchCheckPriorContactResponse>;
1786
1984
  }
1787
1985
 
1788
1986
  declare class ModelPreferencesResource {
@@ -2376,4 +2574,4 @@ declare class ProgressTracker {
2376
2574
  declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
2377
2575
 
2378
2576
  export = LumnisClient;
2379
- export { 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 BatchConnectionRequest, type BatchConnectionResponse, type BatchConnectionStatus, type BatchConnectionStatusResponse, type BatchDraftRequest, type BatchDraftResponse, type BatchSendRequest, type BatchSendResponse, type BillingStatus, type BulkDeleteRequest, type BulkDeleteResponse, type BulkUploadResponse, type CancelResponseResponse, ChannelType, type CheckAppEnabledParams, type CheckLinkedInConnectionRequest, 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, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInSendRequest, 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 ProcessingStatus, type ProcessingStatusResponse, type ProgressEntry, ProgressTracker, type ProspectConnectionCheck, type ProspectInfo, type ProspectSyncIdentifier, type ProspectSyncResult, ProviderType, QueueItemStatus, type QuickPeopleSearchOutput, 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, 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, displayProgress, formatProgressEntry, verifyWebhookSignature };
2577
+ export { 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 BatchDraftRequest, type BatchDraftResponse, 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, type LinkedInConnectionStatus, type LinkedInCreditsResponse, type LinkedInSendRequest, 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, 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, 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, displayProgress, formatProgressEntry, verifyWebhookSignature };
package/dist/index.mjs CHANGED
@@ -816,6 +816,137 @@ class MessagingResource {
816
816
  null
817
817
  );
818
818
  }
819
+ /**
820
+ * Check if there has been any prior contact with a person across all channels.
821
+ *
822
+ * This searches your connected messaging accounts (Gmail, Outlook, LinkedIn) to find
823
+ * any historical communication with a person, even if they're not in the system as a prospect.
824
+ *
825
+ * **Use cases:**
826
+ * - Before adding a new prospect, check if you've already contacted them
827
+ * - Detect duplicate outreach across different systems
828
+ * - Find historical conversation context before sending a new message
829
+ *
830
+ * **Required:** At least one of `email`, `linkedinUrl`, or `providerId` must be provided.
831
+ *
832
+ * **Channels:**
833
+ * - If `channels` is not specified, checks all channels based on identifiers provided:
834
+ * - `email` → checks Gmail and Outlook
835
+ * - `linkedinUrl` or `providerId` → checks LinkedIn
836
+ * - Specify `channels` to limit which accounts to search (e.g., `["linkedin"]`)
837
+ *
838
+ * **Returns:**
839
+ * - `hasPriorContact`: True if ANY communication exists on ANY channel
840
+ * - `channelsChecked`: List of channels that were searched
841
+ * - `channelsWithContact`: List of channels where contact was found
842
+ * - `contactHistory`: Per-channel details including:
843
+ * - `isUserInitiated`: True if you sent the first message
844
+ * - `messages`: Most recent N messages (configurable via `messageLimit`)
845
+ * - `firstContactAt` / `lastContactAt`: Timestamps of first and last messages
846
+ * - `cached`: True if result was served from cache (results are cached for 2 hours)
847
+ *
848
+ * **Caching:**
849
+ * - Results are cached in Redis for 2 hours to improve performance
850
+ * - Set `skipCache: true` to force a fresh check
851
+ *
852
+ * @param userId - User ID or email
853
+ * @param request - CheckPriorContactRequest with identifiers and options
854
+ * @returns CheckPriorContactResponse with contact history
855
+ * @throws MessagingValidationError if no identifier provided
856
+ */
857
+ async checkPriorContact(userId, request) {
858
+ if (!request.email && !request.linkedinUrl && !request.providerId) {
859
+ throw new MessagingValidationError(
860
+ "At least one of email, linkedinUrl, or providerId must be provided",
861
+ { code: "VALIDATION_ERROR" }
862
+ );
863
+ }
864
+ const queryParams = new URLSearchParams();
865
+ queryParams.append("user_id", userId);
866
+ const payload = {};
867
+ if (request.email) payload.email = request.email;
868
+ if (request.linkedinUrl) payload.linkedin_url = request.linkedinUrl;
869
+ if (request.providerId) payload.provider_id = request.providerId;
870
+ if (request.channels) payload.channels = request.channels;
871
+ if (request.messageLimit !== void 0 && request.messageLimit !== null) {
872
+ payload.message_limit = request.messageLimit;
873
+ }
874
+ if (request.skipCache !== void 0 && request.skipCache !== null) {
875
+ payload.skip_cache = request.skipCache;
876
+ }
877
+ return this.http.post(
878
+ `/messaging/check-prior-contact?${queryParams.toString()}`,
879
+ payload
880
+ );
881
+ }
882
+ /**
883
+ * Check prior contact for multiple prospects at once (parallelized).
884
+ *
885
+ * This is the batch version of `checkPriorContact` for efficiently checking
886
+ * many prospects at once. Useful when importing a list of prospects and need to
887
+ * identify which ones have been contacted before.
888
+ *
889
+ * **Limits:**
890
+ * - Max 50 prospects per request
891
+ * - Max 10 messages per channel per prospect (to keep response size manageable)
892
+ *
893
+ * **Request:**
894
+ * ```typescript
895
+ * {
896
+ * prospects: [
897
+ * { prospectId: "p1", email: "john@acme.com" },
898
+ * { prospectId: "p2", linkedinUrl: "https://linkedin.com/in/jane" },
899
+ * { prospectId: "p3", email: "bob@xyz.com", linkedinUrl: "https://linkedin.com/in/bob" }
900
+ * ],
901
+ * channels: ["gmail", "linkedin"], // Optional
902
+ * messageLimit: 3 // Messages per channel (default: 3)
903
+ * }
904
+ * ```
905
+ *
906
+ * **Response:**
907
+ * - `results`: Dict keyed by `prospectId` with contact history for each
908
+ * - `summary`: Aggregated counts {total, withContact, withoutContact, errors, cached}
909
+ *
910
+ * **Caching:**
911
+ * - Results are cached in Redis for 2 hours to improve performance
912
+ * - Set `skipCache: true` to force fresh checks for all prospects
913
+ *
914
+ * @param userId - User ID or email
915
+ * @param request - BatchCheckPriorContactRequest with prospects and options
916
+ * @returns BatchCheckPriorContactResponse with results keyed by prospectId
917
+ * @throws MessagingValidationError if any prospect lacks identifiers
918
+ */
919
+ async batchCheckPriorContact(userId, request) {
920
+ for (const prospect of request.prospects) {
921
+ if (!prospect.email && !prospect.linkedinUrl && !prospect.providerId) {
922
+ throw new MessagingValidationError(
923
+ `Prospect '${prospect.prospectId}' must have at least one of: email, linkedinUrl, or providerId`,
924
+ { code: "VALIDATION_ERROR" }
925
+ );
926
+ }
927
+ }
928
+ const queryParams = new URLSearchParams();
929
+ queryParams.append("user_id", userId);
930
+ const payload = {
931
+ prospects: request.prospects.map((p) => ({
932
+ prospect_id: p.prospectId,
933
+ email: p.email || void 0,
934
+ linkedin_url: p.linkedinUrl || void 0,
935
+ provider_id: p.providerId || void 0
936
+ }))
937
+ };
938
+ if (request.channels) payload.channels = request.channels;
939
+ if (request.messageLimit !== void 0 && request.messageLimit !== null) {
940
+ payload.message_limit = request.messageLimit;
941
+ }
942
+ if (request.skipCache !== void 0 && request.skipCache !== null) {
943
+ payload.skip_cache = request.skipCache;
944
+ }
945
+ return this.http.post(
946
+ `/messaging/check-prior-contact/batch?${queryParams.toString()}`,
947
+ payload
948
+ );
949
+ }
819
950
  }
820
951
 
821
952
  class ModelPreferencesResource {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "lumnisai",
3
3
  "type": "module",
4
- "version": "0.1.11",
4
+ "version": "0.1.13",
5
5
  "description": "Official Node.js SDK for the Lumnis AI API",
6
6
  "author": "Lumnis AI",
7
7
  "license": "MIT",