lumnisai 0.1.10 → 0.1.12
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 +198 -0
- package/dist/index.d.cts +249 -1
- package/dist/index.d.mts +249 -1
- package/dist/index.d.ts +249 -1
- package/dist/index.mjs +198 -0
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -757,6 +757,204 @@ class MessagingResource {
|
|
|
757
757
|
request
|
|
758
758
|
);
|
|
759
759
|
}
|
|
760
|
+
/**
|
|
761
|
+
* Delete a single conversation and all its messages.
|
|
762
|
+
*
|
|
763
|
+
* @param conversationId - UUID of the conversation to delete
|
|
764
|
+
* @param userId - User ID or email
|
|
765
|
+
* @returns DeleteConversationResponse with success status and conversation_id
|
|
766
|
+
* @throws MessagingNotFoundError if conversation not found (404)
|
|
767
|
+
* @throws MessagingValidationError if conversation_id is invalid (400)
|
|
768
|
+
*/
|
|
769
|
+
async deleteConversation(conversationId, userId) {
|
|
770
|
+
try {
|
|
771
|
+
const queryParams = new URLSearchParams();
|
|
772
|
+
queryParams.append("user_id", userId);
|
|
773
|
+
return await this.http.delete(
|
|
774
|
+
`/messaging/conversations/${encodeURIComponent(conversationId)}?${queryParams.toString()}`
|
|
775
|
+
);
|
|
776
|
+
} catch (error) {
|
|
777
|
+
if (error instanceof NotFoundError) {
|
|
778
|
+
throw new MessagingNotFoundError(
|
|
779
|
+
`Conversation ${conversationId} not found`
|
|
780
|
+
);
|
|
781
|
+
}
|
|
782
|
+
if (error instanceof ValidationError) {
|
|
783
|
+
throw new MessagingValidationError(
|
|
784
|
+
`Invalid conversation ID: ${conversationId}`
|
|
785
|
+
);
|
|
786
|
+
}
|
|
787
|
+
throw error;
|
|
788
|
+
}
|
|
789
|
+
}
|
|
790
|
+
/**
|
|
791
|
+
* Delete all conversations for a project.
|
|
792
|
+
*
|
|
793
|
+
* **Warning:** This permanently deletes conversations and messages.
|
|
794
|
+
* Consider using unlinkConversationsFromProject() instead.
|
|
795
|
+
*
|
|
796
|
+
* @param projectId - UUID of the project
|
|
797
|
+
* @param userId - User ID or email
|
|
798
|
+
* @returns DeleteConversationsByProjectResponse with deleted count
|
|
799
|
+
*/
|
|
800
|
+
async deleteConversationsByProject(projectId, userId) {
|
|
801
|
+
const queryParams = new URLSearchParams();
|
|
802
|
+
queryParams.append("project_id", projectId);
|
|
803
|
+
queryParams.append("user_id", userId);
|
|
804
|
+
return this.http.delete(
|
|
805
|
+
`/messaging/conversations?${queryParams.toString()}`
|
|
806
|
+
);
|
|
807
|
+
}
|
|
808
|
+
/**
|
|
809
|
+
* Unlink conversations from a project without deleting them.
|
|
810
|
+
*
|
|
811
|
+
* This preserves conversation history by setting project_id = NULL.
|
|
812
|
+
* Recommended approach when deleting a project.
|
|
813
|
+
*
|
|
814
|
+
* @param projectId - UUID of the project
|
|
815
|
+
* @param userId - User ID or email
|
|
816
|
+
* @returns UnlinkConversationsResponse with unlinked count
|
|
817
|
+
*/
|
|
818
|
+
async unlinkConversationsFromProject(projectId, userId) {
|
|
819
|
+
const queryParams = new URLSearchParams();
|
|
820
|
+
queryParams.append("project_id", projectId);
|
|
821
|
+
queryParams.append("user_id", userId);
|
|
822
|
+
return this.http.post(
|
|
823
|
+
`/messaging/conversations/unlink-project?${queryParams.toString()}`,
|
|
824
|
+
null
|
|
825
|
+
);
|
|
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
|
+
}
|
|
760
958
|
}
|
|
761
959
|
|
|
762
960
|
class ModelPreferencesResource {
|
package/dist/index.d.cts
CHANGED
|
@@ -1626,6 +1626,145 @@ interface BatchSendResponse {
|
|
|
1626
1626
|
failed: number;
|
|
1627
1627
|
queued: number;
|
|
1628
1628
|
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Response from deleting a single conversation
|
|
1631
|
+
*/
|
|
1632
|
+
interface DeleteConversationResponse {
|
|
1633
|
+
success: boolean;
|
|
1634
|
+
conversation_id: string;
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Response from deleting conversations by project
|
|
1638
|
+
*/
|
|
1639
|
+
interface DeleteConversationsByProjectResponse {
|
|
1640
|
+
success: boolean;
|
|
1641
|
+
project_id: string;
|
|
1642
|
+
deleted_count: number;
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1645
|
+
* Response from unlinking conversations from project
|
|
1646
|
+
*/
|
|
1647
|
+
interface UnlinkConversationsResponse {
|
|
1648
|
+
success: boolean;
|
|
1649
|
+
project_id: string;
|
|
1650
|
+
unlinked_count: number;
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* Request to check if there's been prior contact with a person
|
|
1654
|
+
*/
|
|
1655
|
+
interface CheckPriorContactRequest {
|
|
1656
|
+
/** Email address to check (for Gmail/Outlook) */
|
|
1657
|
+
email?: string | null;
|
|
1658
|
+
/** LinkedIn profile URL to check */
|
|
1659
|
+
linkedinUrl?: string | null;
|
|
1660
|
+
/** LinkedIn provider ID to check */
|
|
1661
|
+
providerId?: string | null;
|
|
1662
|
+
/** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all connected channels */
|
|
1663
|
+
channels?: string[] | null;
|
|
1664
|
+
/** Max messages to return per channel (1-20, default: 5) */
|
|
1665
|
+
messageLimit?: number | null;
|
|
1666
|
+
/** Force fresh check, bypassing cache (default: false) */
|
|
1667
|
+
skipCache?: boolean | null;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* A message from prior contact history
|
|
1671
|
+
*/
|
|
1672
|
+
interface PriorContactMessage {
|
|
1673
|
+
id: string;
|
|
1674
|
+
/** 'inbound' | 'outbound' */
|
|
1675
|
+
direction: string;
|
|
1676
|
+
content: string;
|
|
1677
|
+
subject?: string | null;
|
|
1678
|
+
senderName: string;
|
|
1679
|
+
/** ISO timestamp */
|
|
1680
|
+
sentAt: string;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Contact history for a single channel
|
|
1684
|
+
*/
|
|
1685
|
+
interface ChannelContactHistory {
|
|
1686
|
+
/** 'gmail' | 'outlook' | 'linkedin' */
|
|
1687
|
+
channel: string;
|
|
1688
|
+
hasContact: boolean;
|
|
1689
|
+
/** True if user sent first message */
|
|
1690
|
+
isUserInitiated: boolean;
|
|
1691
|
+
threadId?: string | null;
|
|
1692
|
+
/** Internal ID if we have one */
|
|
1693
|
+
conversationId?: string | null;
|
|
1694
|
+
messageCount: number;
|
|
1695
|
+
/** ISO timestamp */
|
|
1696
|
+
firstContactAt?: string | null;
|
|
1697
|
+
/** ISO timestamp */
|
|
1698
|
+
lastContactAt?: string | null;
|
|
1699
|
+
prospectName?: string | null;
|
|
1700
|
+
messages: PriorContactMessage[];
|
|
1701
|
+
}
|
|
1702
|
+
/**
|
|
1703
|
+
* Response from prior contact check
|
|
1704
|
+
*/
|
|
1705
|
+
interface CheckPriorContactResponse {
|
|
1706
|
+
/** True if ANY channel has contact */
|
|
1707
|
+
hasPriorContact: boolean;
|
|
1708
|
+
channelsChecked: string[];
|
|
1709
|
+
channelsWithContact: string[];
|
|
1710
|
+
contactHistory: ChannelContactHistory[];
|
|
1711
|
+
/** True if result was served from cache */
|
|
1712
|
+
cached?: boolean;
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* Identifier for a prospect in batch prior contact check
|
|
1716
|
+
*/
|
|
1717
|
+
interface BatchProspectIdentifier {
|
|
1718
|
+
/** Unique identifier for this prospect (for mapping results) */
|
|
1719
|
+
prospectId: string;
|
|
1720
|
+
/** Email address to check */
|
|
1721
|
+
email?: string | null;
|
|
1722
|
+
/** LinkedIn profile URL */
|
|
1723
|
+
linkedinUrl?: string | null;
|
|
1724
|
+
/** LinkedIn provider ID */
|
|
1725
|
+
providerId?: string | null;
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Request to check prior contact for multiple prospects
|
|
1729
|
+
*/
|
|
1730
|
+
interface BatchCheckPriorContactRequest {
|
|
1731
|
+
/** List of prospects to check (max 50) */
|
|
1732
|
+
prospects: BatchProspectIdentifier[];
|
|
1733
|
+
/** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all based on identifiers */
|
|
1734
|
+
channels?: string[] | null;
|
|
1735
|
+
/** Max messages per channel per prospect (1-10, default: 3) */
|
|
1736
|
+
messageLimit?: number | null;
|
|
1737
|
+
/** Force fresh check for all prospects, bypassing cache (default: false) */
|
|
1738
|
+
skipCache?: boolean | null;
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* Prior contact result for a single prospect in batch
|
|
1742
|
+
*/
|
|
1743
|
+
interface ProspectPriorContactResult {
|
|
1744
|
+
prospectId: string;
|
|
1745
|
+
hasPriorContact: boolean;
|
|
1746
|
+
channelsWithContact: string[];
|
|
1747
|
+
contactHistory: ChannelContactHistory[];
|
|
1748
|
+
/** True if this result was from cache */
|
|
1749
|
+
cached?: boolean;
|
|
1750
|
+
error?: string | null;
|
|
1751
|
+
}
|
|
1752
|
+
/**
|
|
1753
|
+
* Response from batch prior contact check
|
|
1754
|
+
*/
|
|
1755
|
+
interface BatchCheckPriorContactResponse {
|
|
1756
|
+
/** Keyed by prospect_id */
|
|
1757
|
+
results: Record<string, ProspectPriorContactResult>;
|
|
1758
|
+
/** Aggregated counts */
|
|
1759
|
+
summary: {
|
|
1760
|
+
total: number;
|
|
1761
|
+
withContact: number;
|
|
1762
|
+
withoutContact: number;
|
|
1763
|
+
errors: number;
|
|
1764
|
+
/** Number of results served from cache */
|
|
1765
|
+
cached?: number;
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1629
1768
|
|
|
1630
1769
|
declare class MessagingResource {
|
|
1631
1770
|
private readonly http;
|
|
@@ -1728,6 +1867,115 @@ declare class MessagingResource {
|
|
|
1728
1867
|
* Send multiple drafts with rate limiting
|
|
1729
1868
|
*/
|
|
1730
1869
|
sendBatchDrafts(userId: string, request: BatchSendRequest): Promise<BatchSendResponse>;
|
|
1870
|
+
/**
|
|
1871
|
+
* Delete a single conversation and all its messages.
|
|
1872
|
+
*
|
|
1873
|
+
* @param conversationId - UUID of the conversation to delete
|
|
1874
|
+
* @param userId - User ID or email
|
|
1875
|
+
* @returns DeleteConversationResponse with success status and conversation_id
|
|
1876
|
+
* @throws MessagingNotFoundError if conversation not found (404)
|
|
1877
|
+
* @throws MessagingValidationError if conversation_id is invalid (400)
|
|
1878
|
+
*/
|
|
1879
|
+
deleteConversation(conversationId: string, userId: string): Promise<DeleteConversationResponse>;
|
|
1880
|
+
/**
|
|
1881
|
+
* Delete all conversations for a project.
|
|
1882
|
+
*
|
|
1883
|
+
* **Warning:** This permanently deletes conversations and messages.
|
|
1884
|
+
* Consider using unlinkConversationsFromProject() instead.
|
|
1885
|
+
*
|
|
1886
|
+
* @param projectId - UUID of the project
|
|
1887
|
+
* @param userId - User ID or email
|
|
1888
|
+
* @returns DeleteConversationsByProjectResponse with deleted count
|
|
1889
|
+
*/
|
|
1890
|
+
deleteConversationsByProject(projectId: string, userId: string): Promise<DeleteConversationsByProjectResponse>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Unlink conversations from a project without deleting them.
|
|
1893
|
+
*
|
|
1894
|
+
* This preserves conversation history by setting project_id = NULL.
|
|
1895
|
+
* Recommended approach when deleting a project.
|
|
1896
|
+
*
|
|
1897
|
+
* @param projectId - UUID of the project
|
|
1898
|
+
* @param userId - User ID or email
|
|
1899
|
+
* @returns UnlinkConversationsResponse with unlinked count
|
|
1900
|
+
*/
|
|
1901
|
+
unlinkConversationsFromProject(projectId: string, userId: string): Promise<UnlinkConversationsResponse>;
|
|
1902
|
+
/**
|
|
1903
|
+
* Check if there has been any prior contact with a person across all channels.
|
|
1904
|
+
*
|
|
1905
|
+
* This searches your connected messaging accounts (Gmail, Outlook, LinkedIn) to find
|
|
1906
|
+
* any historical communication with a person, even if they're not in the system as a prospect.
|
|
1907
|
+
*
|
|
1908
|
+
* **Use cases:**
|
|
1909
|
+
* - Before adding a new prospect, check if you've already contacted them
|
|
1910
|
+
* - Detect duplicate outreach across different systems
|
|
1911
|
+
* - Find historical conversation context before sending a new message
|
|
1912
|
+
*
|
|
1913
|
+
* **Required:** At least one of `email`, `linkedinUrl`, or `providerId` must be provided.
|
|
1914
|
+
*
|
|
1915
|
+
* **Channels:**
|
|
1916
|
+
* - If `channels` is not specified, checks all channels based on identifiers provided:
|
|
1917
|
+
* - `email` → checks Gmail and Outlook
|
|
1918
|
+
* - `linkedinUrl` or `providerId` → checks LinkedIn
|
|
1919
|
+
* - Specify `channels` to limit which accounts to search (e.g., `["linkedin"]`)
|
|
1920
|
+
*
|
|
1921
|
+
* **Returns:**
|
|
1922
|
+
* - `hasPriorContact`: True if ANY communication exists on ANY channel
|
|
1923
|
+
* - `channelsChecked`: List of channels that were searched
|
|
1924
|
+
* - `channelsWithContact`: List of channels where contact was found
|
|
1925
|
+
* - `contactHistory`: Per-channel details including:
|
|
1926
|
+
* - `isUserInitiated`: True if you sent the first message
|
|
1927
|
+
* - `messages`: Most recent N messages (configurable via `messageLimit`)
|
|
1928
|
+
* - `firstContactAt` / `lastContactAt`: Timestamps of first and last messages
|
|
1929
|
+
* - `cached`: True if result was served from cache (results are cached for 2 hours)
|
|
1930
|
+
*
|
|
1931
|
+
* **Caching:**
|
|
1932
|
+
* - Results are cached in Redis for 2 hours to improve performance
|
|
1933
|
+
* - Set `skipCache: true` to force a fresh check
|
|
1934
|
+
*
|
|
1935
|
+
* @param userId - User ID or email
|
|
1936
|
+
* @param request - CheckPriorContactRequest with identifiers and options
|
|
1937
|
+
* @returns CheckPriorContactResponse with contact history
|
|
1938
|
+
* @throws MessagingValidationError if no identifier provided
|
|
1939
|
+
*/
|
|
1940
|
+
checkPriorContact(userId: string, request: CheckPriorContactRequest): Promise<CheckPriorContactResponse>;
|
|
1941
|
+
/**
|
|
1942
|
+
* Check prior contact for multiple prospects at once (parallelized).
|
|
1943
|
+
*
|
|
1944
|
+
* This is the batch version of `checkPriorContact` for efficiently checking
|
|
1945
|
+
* many prospects at once. Useful when importing a list of prospects and need to
|
|
1946
|
+
* identify which ones have been contacted before.
|
|
1947
|
+
*
|
|
1948
|
+
* **Limits:**
|
|
1949
|
+
* - Max 50 prospects per request
|
|
1950
|
+
* - Max 10 messages per channel per prospect (to keep response size manageable)
|
|
1951
|
+
*
|
|
1952
|
+
* **Request:**
|
|
1953
|
+
* ```typescript
|
|
1954
|
+
* {
|
|
1955
|
+
* prospects: [
|
|
1956
|
+
* { prospectId: "p1", email: "john@acme.com" },
|
|
1957
|
+
* { prospectId: "p2", linkedinUrl: "https://linkedin.com/in/jane" },
|
|
1958
|
+
* { prospectId: "p3", email: "bob@xyz.com", linkedinUrl: "https://linkedin.com/in/bob" }
|
|
1959
|
+
* ],
|
|
1960
|
+
* channels: ["gmail", "linkedin"], // Optional
|
|
1961
|
+
* messageLimit: 3 // Messages per channel (default: 3)
|
|
1962
|
+
* }
|
|
1963
|
+
* ```
|
|
1964
|
+
*
|
|
1965
|
+
* **Response:**
|
|
1966
|
+
* - `results`: Dict keyed by `prospectId` with contact history for each
|
|
1967
|
+
* - `summary`: Aggregated counts {total, withContact, withoutContact, errors, cached}
|
|
1968
|
+
*
|
|
1969
|
+
* **Caching:**
|
|
1970
|
+
* - Results are cached in Redis for 2 hours to improve performance
|
|
1971
|
+
* - Set `skipCache: true` to force fresh checks for all prospects
|
|
1972
|
+
*
|
|
1973
|
+
* @param userId - User ID or email
|
|
1974
|
+
* @param request - BatchCheckPriorContactRequest with prospects and options
|
|
1975
|
+
* @returns BatchCheckPriorContactResponse with results keyed by prospectId
|
|
1976
|
+
* @throws MessagingValidationError if any prospect lacks identifiers
|
|
1977
|
+
*/
|
|
1978
|
+
batchCheckPriorContact(userId: string, request: BatchCheckPriorContactRequest): Promise<BatchCheckPriorContactResponse>;
|
|
1731
1979
|
}
|
|
1732
1980
|
|
|
1733
1981
|
declare class ModelPreferencesResource {
|
|
@@ -2321,4 +2569,4 @@ declare class ProgressTracker {
|
|
|
2321
2569
|
declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
|
|
2322
2570
|
|
|
2323
2571
|
export = LumnisClient;
|
|
2324
|
-
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 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 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 };
|
|
2572
|
+
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
|
@@ -1626,6 +1626,145 @@ interface BatchSendResponse {
|
|
|
1626
1626
|
failed: number;
|
|
1627
1627
|
queued: number;
|
|
1628
1628
|
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Response from deleting a single conversation
|
|
1631
|
+
*/
|
|
1632
|
+
interface DeleteConversationResponse {
|
|
1633
|
+
success: boolean;
|
|
1634
|
+
conversation_id: string;
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Response from deleting conversations by project
|
|
1638
|
+
*/
|
|
1639
|
+
interface DeleteConversationsByProjectResponse {
|
|
1640
|
+
success: boolean;
|
|
1641
|
+
project_id: string;
|
|
1642
|
+
deleted_count: number;
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1645
|
+
* Response from unlinking conversations from project
|
|
1646
|
+
*/
|
|
1647
|
+
interface UnlinkConversationsResponse {
|
|
1648
|
+
success: boolean;
|
|
1649
|
+
project_id: string;
|
|
1650
|
+
unlinked_count: number;
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* Request to check if there's been prior contact with a person
|
|
1654
|
+
*/
|
|
1655
|
+
interface CheckPriorContactRequest {
|
|
1656
|
+
/** Email address to check (for Gmail/Outlook) */
|
|
1657
|
+
email?: string | null;
|
|
1658
|
+
/** LinkedIn profile URL to check */
|
|
1659
|
+
linkedinUrl?: string | null;
|
|
1660
|
+
/** LinkedIn provider ID to check */
|
|
1661
|
+
providerId?: string | null;
|
|
1662
|
+
/** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all connected channels */
|
|
1663
|
+
channels?: string[] | null;
|
|
1664
|
+
/** Max messages to return per channel (1-20, default: 5) */
|
|
1665
|
+
messageLimit?: number | null;
|
|
1666
|
+
/** Force fresh check, bypassing cache (default: false) */
|
|
1667
|
+
skipCache?: boolean | null;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* A message from prior contact history
|
|
1671
|
+
*/
|
|
1672
|
+
interface PriorContactMessage {
|
|
1673
|
+
id: string;
|
|
1674
|
+
/** 'inbound' | 'outbound' */
|
|
1675
|
+
direction: string;
|
|
1676
|
+
content: string;
|
|
1677
|
+
subject?: string | null;
|
|
1678
|
+
senderName: string;
|
|
1679
|
+
/** ISO timestamp */
|
|
1680
|
+
sentAt: string;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Contact history for a single channel
|
|
1684
|
+
*/
|
|
1685
|
+
interface ChannelContactHistory {
|
|
1686
|
+
/** 'gmail' | 'outlook' | 'linkedin' */
|
|
1687
|
+
channel: string;
|
|
1688
|
+
hasContact: boolean;
|
|
1689
|
+
/** True if user sent first message */
|
|
1690
|
+
isUserInitiated: boolean;
|
|
1691
|
+
threadId?: string | null;
|
|
1692
|
+
/** Internal ID if we have one */
|
|
1693
|
+
conversationId?: string | null;
|
|
1694
|
+
messageCount: number;
|
|
1695
|
+
/** ISO timestamp */
|
|
1696
|
+
firstContactAt?: string | null;
|
|
1697
|
+
/** ISO timestamp */
|
|
1698
|
+
lastContactAt?: string | null;
|
|
1699
|
+
prospectName?: string | null;
|
|
1700
|
+
messages: PriorContactMessage[];
|
|
1701
|
+
}
|
|
1702
|
+
/**
|
|
1703
|
+
* Response from prior contact check
|
|
1704
|
+
*/
|
|
1705
|
+
interface CheckPriorContactResponse {
|
|
1706
|
+
/** True if ANY channel has contact */
|
|
1707
|
+
hasPriorContact: boolean;
|
|
1708
|
+
channelsChecked: string[];
|
|
1709
|
+
channelsWithContact: string[];
|
|
1710
|
+
contactHistory: ChannelContactHistory[];
|
|
1711
|
+
/** True if result was served from cache */
|
|
1712
|
+
cached?: boolean;
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* Identifier for a prospect in batch prior contact check
|
|
1716
|
+
*/
|
|
1717
|
+
interface BatchProspectIdentifier {
|
|
1718
|
+
/** Unique identifier for this prospect (for mapping results) */
|
|
1719
|
+
prospectId: string;
|
|
1720
|
+
/** Email address to check */
|
|
1721
|
+
email?: string | null;
|
|
1722
|
+
/** LinkedIn profile URL */
|
|
1723
|
+
linkedinUrl?: string | null;
|
|
1724
|
+
/** LinkedIn provider ID */
|
|
1725
|
+
providerId?: string | null;
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Request to check prior contact for multiple prospects
|
|
1729
|
+
*/
|
|
1730
|
+
interface BatchCheckPriorContactRequest {
|
|
1731
|
+
/** List of prospects to check (max 50) */
|
|
1732
|
+
prospects: BatchProspectIdentifier[];
|
|
1733
|
+
/** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all based on identifiers */
|
|
1734
|
+
channels?: string[] | null;
|
|
1735
|
+
/** Max messages per channel per prospect (1-10, default: 3) */
|
|
1736
|
+
messageLimit?: number | null;
|
|
1737
|
+
/** Force fresh check for all prospects, bypassing cache (default: false) */
|
|
1738
|
+
skipCache?: boolean | null;
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* Prior contact result for a single prospect in batch
|
|
1742
|
+
*/
|
|
1743
|
+
interface ProspectPriorContactResult {
|
|
1744
|
+
prospectId: string;
|
|
1745
|
+
hasPriorContact: boolean;
|
|
1746
|
+
channelsWithContact: string[];
|
|
1747
|
+
contactHistory: ChannelContactHistory[];
|
|
1748
|
+
/** True if this result was from cache */
|
|
1749
|
+
cached?: boolean;
|
|
1750
|
+
error?: string | null;
|
|
1751
|
+
}
|
|
1752
|
+
/**
|
|
1753
|
+
* Response from batch prior contact check
|
|
1754
|
+
*/
|
|
1755
|
+
interface BatchCheckPriorContactResponse {
|
|
1756
|
+
/** Keyed by prospect_id */
|
|
1757
|
+
results: Record<string, ProspectPriorContactResult>;
|
|
1758
|
+
/** Aggregated counts */
|
|
1759
|
+
summary: {
|
|
1760
|
+
total: number;
|
|
1761
|
+
withContact: number;
|
|
1762
|
+
withoutContact: number;
|
|
1763
|
+
errors: number;
|
|
1764
|
+
/** Number of results served from cache */
|
|
1765
|
+
cached?: number;
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1629
1768
|
|
|
1630
1769
|
declare class MessagingResource {
|
|
1631
1770
|
private readonly http;
|
|
@@ -1728,6 +1867,115 @@ declare class MessagingResource {
|
|
|
1728
1867
|
* Send multiple drafts with rate limiting
|
|
1729
1868
|
*/
|
|
1730
1869
|
sendBatchDrafts(userId: string, request: BatchSendRequest): Promise<BatchSendResponse>;
|
|
1870
|
+
/**
|
|
1871
|
+
* Delete a single conversation and all its messages.
|
|
1872
|
+
*
|
|
1873
|
+
* @param conversationId - UUID of the conversation to delete
|
|
1874
|
+
* @param userId - User ID or email
|
|
1875
|
+
* @returns DeleteConversationResponse with success status and conversation_id
|
|
1876
|
+
* @throws MessagingNotFoundError if conversation not found (404)
|
|
1877
|
+
* @throws MessagingValidationError if conversation_id is invalid (400)
|
|
1878
|
+
*/
|
|
1879
|
+
deleteConversation(conversationId: string, userId: string): Promise<DeleteConversationResponse>;
|
|
1880
|
+
/**
|
|
1881
|
+
* Delete all conversations for a project.
|
|
1882
|
+
*
|
|
1883
|
+
* **Warning:** This permanently deletes conversations and messages.
|
|
1884
|
+
* Consider using unlinkConversationsFromProject() instead.
|
|
1885
|
+
*
|
|
1886
|
+
* @param projectId - UUID of the project
|
|
1887
|
+
* @param userId - User ID or email
|
|
1888
|
+
* @returns DeleteConversationsByProjectResponse with deleted count
|
|
1889
|
+
*/
|
|
1890
|
+
deleteConversationsByProject(projectId: string, userId: string): Promise<DeleteConversationsByProjectResponse>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Unlink conversations from a project without deleting them.
|
|
1893
|
+
*
|
|
1894
|
+
* This preserves conversation history by setting project_id = NULL.
|
|
1895
|
+
* Recommended approach when deleting a project.
|
|
1896
|
+
*
|
|
1897
|
+
* @param projectId - UUID of the project
|
|
1898
|
+
* @param userId - User ID or email
|
|
1899
|
+
* @returns UnlinkConversationsResponse with unlinked count
|
|
1900
|
+
*/
|
|
1901
|
+
unlinkConversationsFromProject(projectId: string, userId: string): Promise<UnlinkConversationsResponse>;
|
|
1902
|
+
/**
|
|
1903
|
+
* Check if there has been any prior contact with a person across all channels.
|
|
1904
|
+
*
|
|
1905
|
+
* This searches your connected messaging accounts (Gmail, Outlook, LinkedIn) to find
|
|
1906
|
+
* any historical communication with a person, even if they're not in the system as a prospect.
|
|
1907
|
+
*
|
|
1908
|
+
* **Use cases:**
|
|
1909
|
+
* - Before adding a new prospect, check if you've already contacted them
|
|
1910
|
+
* - Detect duplicate outreach across different systems
|
|
1911
|
+
* - Find historical conversation context before sending a new message
|
|
1912
|
+
*
|
|
1913
|
+
* **Required:** At least one of `email`, `linkedinUrl`, or `providerId` must be provided.
|
|
1914
|
+
*
|
|
1915
|
+
* **Channels:**
|
|
1916
|
+
* - If `channels` is not specified, checks all channels based on identifiers provided:
|
|
1917
|
+
* - `email` → checks Gmail and Outlook
|
|
1918
|
+
* - `linkedinUrl` or `providerId` → checks LinkedIn
|
|
1919
|
+
* - Specify `channels` to limit which accounts to search (e.g., `["linkedin"]`)
|
|
1920
|
+
*
|
|
1921
|
+
* **Returns:**
|
|
1922
|
+
* - `hasPriorContact`: True if ANY communication exists on ANY channel
|
|
1923
|
+
* - `channelsChecked`: List of channels that were searched
|
|
1924
|
+
* - `channelsWithContact`: List of channels where contact was found
|
|
1925
|
+
* - `contactHistory`: Per-channel details including:
|
|
1926
|
+
* - `isUserInitiated`: True if you sent the first message
|
|
1927
|
+
* - `messages`: Most recent N messages (configurable via `messageLimit`)
|
|
1928
|
+
* - `firstContactAt` / `lastContactAt`: Timestamps of first and last messages
|
|
1929
|
+
* - `cached`: True if result was served from cache (results are cached for 2 hours)
|
|
1930
|
+
*
|
|
1931
|
+
* **Caching:**
|
|
1932
|
+
* - Results are cached in Redis for 2 hours to improve performance
|
|
1933
|
+
* - Set `skipCache: true` to force a fresh check
|
|
1934
|
+
*
|
|
1935
|
+
* @param userId - User ID or email
|
|
1936
|
+
* @param request - CheckPriorContactRequest with identifiers and options
|
|
1937
|
+
* @returns CheckPriorContactResponse with contact history
|
|
1938
|
+
* @throws MessagingValidationError if no identifier provided
|
|
1939
|
+
*/
|
|
1940
|
+
checkPriorContact(userId: string, request: CheckPriorContactRequest): Promise<CheckPriorContactResponse>;
|
|
1941
|
+
/**
|
|
1942
|
+
* Check prior contact for multiple prospects at once (parallelized).
|
|
1943
|
+
*
|
|
1944
|
+
* This is the batch version of `checkPriorContact` for efficiently checking
|
|
1945
|
+
* many prospects at once. Useful when importing a list of prospects and need to
|
|
1946
|
+
* identify which ones have been contacted before.
|
|
1947
|
+
*
|
|
1948
|
+
* **Limits:**
|
|
1949
|
+
* - Max 50 prospects per request
|
|
1950
|
+
* - Max 10 messages per channel per prospect (to keep response size manageable)
|
|
1951
|
+
*
|
|
1952
|
+
* **Request:**
|
|
1953
|
+
* ```typescript
|
|
1954
|
+
* {
|
|
1955
|
+
* prospects: [
|
|
1956
|
+
* { prospectId: "p1", email: "john@acme.com" },
|
|
1957
|
+
* { prospectId: "p2", linkedinUrl: "https://linkedin.com/in/jane" },
|
|
1958
|
+
* { prospectId: "p3", email: "bob@xyz.com", linkedinUrl: "https://linkedin.com/in/bob" }
|
|
1959
|
+
* ],
|
|
1960
|
+
* channels: ["gmail", "linkedin"], // Optional
|
|
1961
|
+
* messageLimit: 3 // Messages per channel (default: 3)
|
|
1962
|
+
* }
|
|
1963
|
+
* ```
|
|
1964
|
+
*
|
|
1965
|
+
* **Response:**
|
|
1966
|
+
* - `results`: Dict keyed by `prospectId` with contact history for each
|
|
1967
|
+
* - `summary`: Aggregated counts {total, withContact, withoutContact, errors, cached}
|
|
1968
|
+
*
|
|
1969
|
+
* **Caching:**
|
|
1970
|
+
* - Results are cached in Redis for 2 hours to improve performance
|
|
1971
|
+
* - Set `skipCache: true` to force fresh checks for all prospects
|
|
1972
|
+
*
|
|
1973
|
+
* @param userId - User ID or email
|
|
1974
|
+
* @param request - BatchCheckPriorContactRequest with prospects and options
|
|
1975
|
+
* @returns BatchCheckPriorContactResponse with results keyed by prospectId
|
|
1976
|
+
* @throws MessagingValidationError if any prospect lacks identifiers
|
|
1977
|
+
*/
|
|
1978
|
+
batchCheckPriorContact(userId: string, request: BatchCheckPriorContactRequest): Promise<BatchCheckPriorContactResponse>;
|
|
1731
1979
|
}
|
|
1732
1980
|
|
|
1733
1981
|
declare class ModelPreferencesResource {
|
|
@@ -2320,4 +2568,4 @@ declare class ProgressTracker {
|
|
|
2320
2568
|
*/
|
|
2321
2569
|
declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
|
|
2322
2570
|
|
|
2323
|
-
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 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 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 };
|
|
2571
|
+
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
|
@@ -1626,6 +1626,145 @@ interface BatchSendResponse {
|
|
|
1626
1626
|
failed: number;
|
|
1627
1627
|
queued: number;
|
|
1628
1628
|
}
|
|
1629
|
+
/**
|
|
1630
|
+
* Response from deleting a single conversation
|
|
1631
|
+
*/
|
|
1632
|
+
interface DeleteConversationResponse {
|
|
1633
|
+
success: boolean;
|
|
1634
|
+
conversation_id: string;
|
|
1635
|
+
}
|
|
1636
|
+
/**
|
|
1637
|
+
* Response from deleting conversations by project
|
|
1638
|
+
*/
|
|
1639
|
+
interface DeleteConversationsByProjectResponse {
|
|
1640
|
+
success: boolean;
|
|
1641
|
+
project_id: string;
|
|
1642
|
+
deleted_count: number;
|
|
1643
|
+
}
|
|
1644
|
+
/**
|
|
1645
|
+
* Response from unlinking conversations from project
|
|
1646
|
+
*/
|
|
1647
|
+
interface UnlinkConversationsResponse {
|
|
1648
|
+
success: boolean;
|
|
1649
|
+
project_id: string;
|
|
1650
|
+
unlinked_count: number;
|
|
1651
|
+
}
|
|
1652
|
+
/**
|
|
1653
|
+
* Request to check if there's been prior contact with a person
|
|
1654
|
+
*/
|
|
1655
|
+
interface CheckPriorContactRequest {
|
|
1656
|
+
/** Email address to check (for Gmail/Outlook) */
|
|
1657
|
+
email?: string | null;
|
|
1658
|
+
/** LinkedIn profile URL to check */
|
|
1659
|
+
linkedinUrl?: string | null;
|
|
1660
|
+
/** LinkedIn provider ID to check */
|
|
1661
|
+
providerId?: string | null;
|
|
1662
|
+
/** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all connected channels */
|
|
1663
|
+
channels?: string[] | null;
|
|
1664
|
+
/** Max messages to return per channel (1-20, default: 5) */
|
|
1665
|
+
messageLimit?: number | null;
|
|
1666
|
+
/** Force fresh check, bypassing cache (default: false) */
|
|
1667
|
+
skipCache?: boolean | null;
|
|
1668
|
+
}
|
|
1669
|
+
/**
|
|
1670
|
+
* A message from prior contact history
|
|
1671
|
+
*/
|
|
1672
|
+
interface PriorContactMessage {
|
|
1673
|
+
id: string;
|
|
1674
|
+
/** 'inbound' | 'outbound' */
|
|
1675
|
+
direction: string;
|
|
1676
|
+
content: string;
|
|
1677
|
+
subject?: string | null;
|
|
1678
|
+
senderName: string;
|
|
1679
|
+
/** ISO timestamp */
|
|
1680
|
+
sentAt: string;
|
|
1681
|
+
}
|
|
1682
|
+
/**
|
|
1683
|
+
* Contact history for a single channel
|
|
1684
|
+
*/
|
|
1685
|
+
interface ChannelContactHistory {
|
|
1686
|
+
/** 'gmail' | 'outlook' | 'linkedin' */
|
|
1687
|
+
channel: string;
|
|
1688
|
+
hasContact: boolean;
|
|
1689
|
+
/** True if user sent first message */
|
|
1690
|
+
isUserInitiated: boolean;
|
|
1691
|
+
threadId?: string | null;
|
|
1692
|
+
/** Internal ID if we have one */
|
|
1693
|
+
conversationId?: string | null;
|
|
1694
|
+
messageCount: number;
|
|
1695
|
+
/** ISO timestamp */
|
|
1696
|
+
firstContactAt?: string | null;
|
|
1697
|
+
/** ISO timestamp */
|
|
1698
|
+
lastContactAt?: string | null;
|
|
1699
|
+
prospectName?: string | null;
|
|
1700
|
+
messages: PriorContactMessage[];
|
|
1701
|
+
}
|
|
1702
|
+
/**
|
|
1703
|
+
* Response from prior contact check
|
|
1704
|
+
*/
|
|
1705
|
+
interface CheckPriorContactResponse {
|
|
1706
|
+
/** True if ANY channel has contact */
|
|
1707
|
+
hasPriorContact: boolean;
|
|
1708
|
+
channelsChecked: string[];
|
|
1709
|
+
channelsWithContact: string[];
|
|
1710
|
+
contactHistory: ChannelContactHistory[];
|
|
1711
|
+
/** True if result was served from cache */
|
|
1712
|
+
cached?: boolean;
|
|
1713
|
+
}
|
|
1714
|
+
/**
|
|
1715
|
+
* Identifier for a prospect in batch prior contact check
|
|
1716
|
+
*/
|
|
1717
|
+
interface BatchProspectIdentifier {
|
|
1718
|
+
/** Unique identifier for this prospect (for mapping results) */
|
|
1719
|
+
prospectId: string;
|
|
1720
|
+
/** Email address to check */
|
|
1721
|
+
email?: string | null;
|
|
1722
|
+
/** LinkedIn profile URL */
|
|
1723
|
+
linkedinUrl?: string | null;
|
|
1724
|
+
/** LinkedIn provider ID */
|
|
1725
|
+
providerId?: string | null;
|
|
1726
|
+
}
|
|
1727
|
+
/**
|
|
1728
|
+
* Request to check prior contact for multiple prospects
|
|
1729
|
+
*/
|
|
1730
|
+
interface BatchCheckPriorContactRequest {
|
|
1731
|
+
/** List of prospects to check (max 50) */
|
|
1732
|
+
prospects: BatchProspectIdentifier[];
|
|
1733
|
+
/** Channels to check: 'gmail', 'outlook', 'linkedin'. Default: all based on identifiers */
|
|
1734
|
+
channels?: string[] | null;
|
|
1735
|
+
/** Max messages per channel per prospect (1-10, default: 3) */
|
|
1736
|
+
messageLimit?: number | null;
|
|
1737
|
+
/** Force fresh check for all prospects, bypassing cache (default: false) */
|
|
1738
|
+
skipCache?: boolean | null;
|
|
1739
|
+
}
|
|
1740
|
+
/**
|
|
1741
|
+
* Prior contact result for a single prospect in batch
|
|
1742
|
+
*/
|
|
1743
|
+
interface ProspectPriorContactResult {
|
|
1744
|
+
prospectId: string;
|
|
1745
|
+
hasPriorContact: boolean;
|
|
1746
|
+
channelsWithContact: string[];
|
|
1747
|
+
contactHistory: ChannelContactHistory[];
|
|
1748
|
+
/** True if this result was from cache */
|
|
1749
|
+
cached?: boolean;
|
|
1750
|
+
error?: string | null;
|
|
1751
|
+
}
|
|
1752
|
+
/**
|
|
1753
|
+
* Response from batch prior contact check
|
|
1754
|
+
*/
|
|
1755
|
+
interface BatchCheckPriorContactResponse {
|
|
1756
|
+
/** Keyed by prospect_id */
|
|
1757
|
+
results: Record<string, ProspectPriorContactResult>;
|
|
1758
|
+
/** Aggregated counts */
|
|
1759
|
+
summary: {
|
|
1760
|
+
total: number;
|
|
1761
|
+
withContact: number;
|
|
1762
|
+
withoutContact: number;
|
|
1763
|
+
errors: number;
|
|
1764
|
+
/** Number of results served from cache */
|
|
1765
|
+
cached?: number;
|
|
1766
|
+
};
|
|
1767
|
+
}
|
|
1629
1768
|
|
|
1630
1769
|
declare class MessagingResource {
|
|
1631
1770
|
private readonly http;
|
|
@@ -1728,6 +1867,115 @@ declare class MessagingResource {
|
|
|
1728
1867
|
* Send multiple drafts with rate limiting
|
|
1729
1868
|
*/
|
|
1730
1869
|
sendBatchDrafts(userId: string, request: BatchSendRequest): Promise<BatchSendResponse>;
|
|
1870
|
+
/**
|
|
1871
|
+
* Delete a single conversation and all its messages.
|
|
1872
|
+
*
|
|
1873
|
+
* @param conversationId - UUID of the conversation to delete
|
|
1874
|
+
* @param userId - User ID or email
|
|
1875
|
+
* @returns DeleteConversationResponse with success status and conversation_id
|
|
1876
|
+
* @throws MessagingNotFoundError if conversation not found (404)
|
|
1877
|
+
* @throws MessagingValidationError if conversation_id is invalid (400)
|
|
1878
|
+
*/
|
|
1879
|
+
deleteConversation(conversationId: string, userId: string): Promise<DeleteConversationResponse>;
|
|
1880
|
+
/**
|
|
1881
|
+
* Delete all conversations for a project.
|
|
1882
|
+
*
|
|
1883
|
+
* **Warning:** This permanently deletes conversations and messages.
|
|
1884
|
+
* Consider using unlinkConversationsFromProject() instead.
|
|
1885
|
+
*
|
|
1886
|
+
* @param projectId - UUID of the project
|
|
1887
|
+
* @param userId - User ID or email
|
|
1888
|
+
* @returns DeleteConversationsByProjectResponse with deleted count
|
|
1889
|
+
*/
|
|
1890
|
+
deleteConversationsByProject(projectId: string, userId: string): Promise<DeleteConversationsByProjectResponse>;
|
|
1891
|
+
/**
|
|
1892
|
+
* Unlink conversations from a project without deleting them.
|
|
1893
|
+
*
|
|
1894
|
+
* This preserves conversation history by setting project_id = NULL.
|
|
1895
|
+
* Recommended approach when deleting a project.
|
|
1896
|
+
*
|
|
1897
|
+
* @param projectId - UUID of the project
|
|
1898
|
+
* @param userId - User ID or email
|
|
1899
|
+
* @returns UnlinkConversationsResponse with unlinked count
|
|
1900
|
+
*/
|
|
1901
|
+
unlinkConversationsFromProject(projectId: string, userId: string): Promise<UnlinkConversationsResponse>;
|
|
1902
|
+
/**
|
|
1903
|
+
* Check if there has been any prior contact with a person across all channels.
|
|
1904
|
+
*
|
|
1905
|
+
* This searches your connected messaging accounts (Gmail, Outlook, LinkedIn) to find
|
|
1906
|
+
* any historical communication with a person, even if they're not in the system as a prospect.
|
|
1907
|
+
*
|
|
1908
|
+
* **Use cases:**
|
|
1909
|
+
* - Before adding a new prospect, check if you've already contacted them
|
|
1910
|
+
* - Detect duplicate outreach across different systems
|
|
1911
|
+
* - Find historical conversation context before sending a new message
|
|
1912
|
+
*
|
|
1913
|
+
* **Required:** At least one of `email`, `linkedinUrl`, or `providerId` must be provided.
|
|
1914
|
+
*
|
|
1915
|
+
* **Channels:**
|
|
1916
|
+
* - If `channels` is not specified, checks all channels based on identifiers provided:
|
|
1917
|
+
* - `email` → checks Gmail and Outlook
|
|
1918
|
+
* - `linkedinUrl` or `providerId` → checks LinkedIn
|
|
1919
|
+
* - Specify `channels` to limit which accounts to search (e.g., `["linkedin"]`)
|
|
1920
|
+
*
|
|
1921
|
+
* **Returns:**
|
|
1922
|
+
* - `hasPriorContact`: True if ANY communication exists on ANY channel
|
|
1923
|
+
* - `channelsChecked`: List of channels that were searched
|
|
1924
|
+
* - `channelsWithContact`: List of channels where contact was found
|
|
1925
|
+
* - `contactHistory`: Per-channel details including:
|
|
1926
|
+
* - `isUserInitiated`: True if you sent the first message
|
|
1927
|
+
* - `messages`: Most recent N messages (configurable via `messageLimit`)
|
|
1928
|
+
* - `firstContactAt` / `lastContactAt`: Timestamps of first and last messages
|
|
1929
|
+
* - `cached`: True if result was served from cache (results are cached for 2 hours)
|
|
1930
|
+
*
|
|
1931
|
+
* **Caching:**
|
|
1932
|
+
* - Results are cached in Redis for 2 hours to improve performance
|
|
1933
|
+
* - Set `skipCache: true` to force a fresh check
|
|
1934
|
+
*
|
|
1935
|
+
* @param userId - User ID or email
|
|
1936
|
+
* @param request - CheckPriorContactRequest with identifiers and options
|
|
1937
|
+
* @returns CheckPriorContactResponse with contact history
|
|
1938
|
+
* @throws MessagingValidationError if no identifier provided
|
|
1939
|
+
*/
|
|
1940
|
+
checkPriorContact(userId: string, request: CheckPriorContactRequest): Promise<CheckPriorContactResponse>;
|
|
1941
|
+
/**
|
|
1942
|
+
* Check prior contact for multiple prospects at once (parallelized).
|
|
1943
|
+
*
|
|
1944
|
+
* This is the batch version of `checkPriorContact` for efficiently checking
|
|
1945
|
+
* many prospects at once. Useful when importing a list of prospects and need to
|
|
1946
|
+
* identify which ones have been contacted before.
|
|
1947
|
+
*
|
|
1948
|
+
* **Limits:**
|
|
1949
|
+
* - Max 50 prospects per request
|
|
1950
|
+
* - Max 10 messages per channel per prospect (to keep response size manageable)
|
|
1951
|
+
*
|
|
1952
|
+
* **Request:**
|
|
1953
|
+
* ```typescript
|
|
1954
|
+
* {
|
|
1955
|
+
* prospects: [
|
|
1956
|
+
* { prospectId: "p1", email: "john@acme.com" },
|
|
1957
|
+
* { prospectId: "p2", linkedinUrl: "https://linkedin.com/in/jane" },
|
|
1958
|
+
* { prospectId: "p3", email: "bob@xyz.com", linkedinUrl: "https://linkedin.com/in/bob" }
|
|
1959
|
+
* ],
|
|
1960
|
+
* channels: ["gmail", "linkedin"], // Optional
|
|
1961
|
+
* messageLimit: 3 // Messages per channel (default: 3)
|
|
1962
|
+
* }
|
|
1963
|
+
* ```
|
|
1964
|
+
*
|
|
1965
|
+
* **Response:**
|
|
1966
|
+
* - `results`: Dict keyed by `prospectId` with contact history for each
|
|
1967
|
+
* - `summary`: Aggregated counts {total, withContact, withoutContact, errors, cached}
|
|
1968
|
+
*
|
|
1969
|
+
* **Caching:**
|
|
1970
|
+
* - Results are cached in Redis for 2 hours to improve performance
|
|
1971
|
+
* - Set `skipCache: true` to force fresh checks for all prospects
|
|
1972
|
+
*
|
|
1973
|
+
* @param userId - User ID or email
|
|
1974
|
+
* @param request - BatchCheckPriorContactRequest with prospects and options
|
|
1975
|
+
* @returns BatchCheckPriorContactResponse with results keyed by prospectId
|
|
1976
|
+
* @throws MessagingValidationError if any prospect lacks identifiers
|
|
1977
|
+
*/
|
|
1978
|
+
batchCheckPriorContact(userId: string, request: BatchCheckPriorContactRequest): Promise<BatchCheckPriorContactResponse>;
|
|
1731
1979
|
}
|
|
1732
1980
|
|
|
1733
1981
|
declare class ModelPreferencesResource {
|
|
@@ -2321,4 +2569,4 @@ declare class ProgressTracker {
|
|
|
2321
2569
|
declare function verifyWebhookSignature(payload: string, signature: string, secret: string): boolean;
|
|
2322
2570
|
|
|
2323
2571
|
export = LumnisClient;
|
|
2324
|
-
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 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 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 };
|
|
2572
|
+
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
|
@@ -749,6 +749,204 @@ class MessagingResource {
|
|
|
749
749
|
request
|
|
750
750
|
);
|
|
751
751
|
}
|
|
752
|
+
/**
|
|
753
|
+
* Delete a single conversation and all its messages.
|
|
754
|
+
*
|
|
755
|
+
* @param conversationId - UUID of the conversation to delete
|
|
756
|
+
* @param userId - User ID or email
|
|
757
|
+
* @returns DeleteConversationResponse with success status and conversation_id
|
|
758
|
+
* @throws MessagingNotFoundError if conversation not found (404)
|
|
759
|
+
* @throws MessagingValidationError if conversation_id is invalid (400)
|
|
760
|
+
*/
|
|
761
|
+
async deleteConversation(conversationId, userId) {
|
|
762
|
+
try {
|
|
763
|
+
const queryParams = new URLSearchParams();
|
|
764
|
+
queryParams.append("user_id", userId);
|
|
765
|
+
return await this.http.delete(
|
|
766
|
+
`/messaging/conversations/${encodeURIComponent(conversationId)}?${queryParams.toString()}`
|
|
767
|
+
);
|
|
768
|
+
} catch (error) {
|
|
769
|
+
if (error instanceof NotFoundError) {
|
|
770
|
+
throw new MessagingNotFoundError(
|
|
771
|
+
`Conversation ${conversationId} not found`
|
|
772
|
+
);
|
|
773
|
+
}
|
|
774
|
+
if (error instanceof ValidationError) {
|
|
775
|
+
throw new MessagingValidationError(
|
|
776
|
+
`Invalid conversation ID: ${conversationId}`
|
|
777
|
+
);
|
|
778
|
+
}
|
|
779
|
+
throw error;
|
|
780
|
+
}
|
|
781
|
+
}
|
|
782
|
+
/**
|
|
783
|
+
* Delete all conversations for a project.
|
|
784
|
+
*
|
|
785
|
+
* **Warning:** This permanently deletes conversations and messages.
|
|
786
|
+
* Consider using unlinkConversationsFromProject() instead.
|
|
787
|
+
*
|
|
788
|
+
* @param projectId - UUID of the project
|
|
789
|
+
* @param userId - User ID or email
|
|
790
|
+
* @returns DeleteConversationsByProjectResponse with deleted count
|
|
791
|
+
*/
|
|
792
|
+
async deleteConversationsByProject(projectId, userId) {
|
|
793
|
+
const queryParams = new URLSearchParams();
|
|
794
|
+
queryParams.append("project_id", projectId);
|
|
795
|
+
queryParams.append("user_id", userId);
|
|
796
|
+
return this.http.delete(
|
|
797
|
+
`/messaging/conversations?${queryParams.toString()}`
|
|
798
|
+
);
|
|
799
|
+
}
|
|
800
|
+
/**
|
|
801
|
+
* Unlink conversations from a project without deleting them.
|
|
802
|
+
*
|
|
803
|
+
* This preserves conversation history by setting project_id = NULL.
|
|
804
|
+
* Recommended approach when deleting a project.
|
|
805
|
+
*
|
|
806
|
+
* @param projectId - UUID of the project
|
|
807
|
+
* @param userId - User ID or email
|
|
808
|
+
* @returns UnlinkConversationsResponse with unlinked count
|
|
809
|
+
*/
|
|
810
|
+
async unlinkConversationsFromProject(projectId, userId) {
|
|
811
|
+
const queryParams = new URLSearchParams();
|
|
812
|
+
queryParams.append("project_id", projectId);
|
|
813
|
+
queryParams.append("user_id", userId);
|
|
814
|
+
return this.http.post(
|
|
815
|
+
`/messaging/conversations/unlink-project?${queryParams.toString()}`,
|
|
816
|
+
null
|
|
817
|
+
);
|
|
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
|
+
}
|
|
752
950
|
}
|
|
753
951
|
|
|
754
952
|
class ModelPreferencesResource {
|