@graph8/sdk 0.251.0 → 0.260.0
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/README.md +9 -2
- package/dist/cli.js +216 -0
- package/dist/index.d.mts +104 -7
- package/dist/index.d.ts +104 -7
- package/dist/index.js +44 -3
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +44 -3
- package/dist/index.mjs.map +1 -1
- package/dist/react.d.mts +102 -7
- package/dist/react.d.ts +102 -7
- package/dist/react.js +62 -11
- package/dist/react.js.map +1 -1
- package/dist/react.mjs +53 -12
- package/dist/react.mjs.map +1 -1
- package/dist/types/README.md +7 -0
- package/dist/types/agency.d.ts +20 -0
- package/dist/types/agentSetup.d.ts +57 -0
- package/dist/types/api.d.ts +127 -0
- package/dist/types/appClient.d.ts +99 -0
- package/dist/types/appPlatform.d.ts +269 -0
- package/dist/types/appTokens.d.ts +125 -0
- package/dist/types/apps.d.ts +130 -0
- package/dist/types/audiences.d.ts +88 -0
- package/dist/types/calendar.d.ts +55 -0
- package/dist/types/campaigns.d.ts +61 -0
- package/dist/types/chat.d.ts +35 -0
- package/dist/types/cli.d.ts +14 -0
- package/dist/types/companies.d.ts +123 -0
- package/dist/types/contacts.d.ts +200 -0
- package/dist/types/copilot.d.ts +31 -0
- package/dist/types/core.d.ts +1052 -0
- package/dist/types/deals.d.ts +215 -0
- package/dist/types/enrich.d.ts +51 -0
- package/dist/types/fields.d.ts +84 -0
- package/dist/types/forms.d.ts +16 -0
- package/dist/types/http.d.ts +141 -0
- package/dist/types/inbox.d.ts +123 -0
- package/dist/types/index.d.ts +63 -0
- package/dist/types/intent.d.ts +196 -0
- package/dist/types/lists.d.ts +44 -0
- package/dist/types/mailboxes.d.ts +240 -0
- package/dist/types/marketplace.d.ts +62 -0
- package/dist/types/meetings.d.ts +70 -0
- package/dist/types/newsletter.d.ts +212 -0
- package/dist/types/notes.d.ts +57 -0
- package/dist/types/objects.d.ts +281 -0
- package/dist/types/pipelines.d.ts +135 -0
- package/dist/types/quotes.d.ts +143 -0
- package/dist/types/react.d.ts +978 -0
- package/dist/types/search.d.ts +99 -0
- package/dist/types/sequences.d.ts +255 -0
- package/dist/types/signals.d.ts +28 -0
- package/dist/types/skills.d.ts +176 -0
- package/dist/types/snippet.d.ts +24 -0
- package/dist/types/studio.d.ts +161 -0
- package/dist/types/tasks.d.ts +101 -0
- package/dist/types/types.d.ts +45 -0
- package/dist/types/utils.d.ts +21 -0
- package/dist/types/version.d.ts +10 -0
- package/dist/types/visitors.d.ts +29 -0
- package/dist/types/voice.d.ts +304 -0
- package/dist/types/webhooks.d.ts +71 -0
- package/dist/types/workflows.d.ts +229 -0
- package/docs/agents.md +748 -0
- package/docs/api/README.md +165 -0
- package/docs/api/accounts.d.ts +396 -0
- package/docs/api/accounts.md +644 -0
- package/docs/api/adCampaigns.d.ts +707 -0
- package/docs/api/adCampaigns.md +1091 -0
- package/docs/api/adCreatives.d.ts +996 -0
- package/docs/api/adCreatives.md +1708 -0
- package/docs/api/agency.d.ts +556 -0
- package/docs/api/agency.md +845 -0
- package/docs/api/agent.d.ts +330 -0
- package/docs/api/agent.md +514 -0
- package/docs/api/agents.d.ts +1622 -0
- package/docs/api/agents.md +2860 -0
- package/docs/api/aiInbox.d.ts +1984 -0
- package/docs/api/aiInbox.md +3490 -0
- package/docs/api/analytics.d.ts +1273 -0
- package/docs/api/analytics.md +2095 -0
- package/docs/api/apiKeys.d.ts +252 -0
- package/docs/api/apiKeys.md +318 -0
- package/docs/api/appDeployments.d.ts +236 -0
- package/docs/api/appDeployments.md +471 -0
- package/docs/api/appDomains.d.ts +171 -0
- package/docs/api/appDomains.md +281 -0
- package/docs/api/appLogs.d.ts +120 -0
- package/docs/api/appLogs.md +159 -0
- package/docs/api/appObjects.d.ts +415 -0
- package/docs/api/appObjects.md +568 -0
- package/docs/api/appPages.d.ts +557 -0
- package/docs/api/appPages.md +796 -0
- package/docs/api/appPlatformTokens.d.ts +123 -0
- package/docs/api/appPlatformTokens.md +172 -0
- package/docs/api/appointments.d.ts +2361 -0
- package/docs/api/appointments.md +3917 -0
- package/docs/api/apps.d.ts +822 -0
- package/docs/api/apps.md +1342 -0
- package/docs/api/assertUpsert.d.ts +286 -0
- package/docs/api/assertUpsert.md +370 -0
- package/docs/api/audienceSyncs.d.ts +259 -0
- package/docs/api/audienceSyncs.md +395 -0
- package/docs/api/brandKit.d.ts +686 -0
- package/docs/api/brandKit.md +1133 -0
- package/docs/api/bugReports.d.ts +181 -0
- package/docs/api/bugReports.md +268 -0
- package/docs/api/by-path.md +3260 -0
- package/docs/api/calendarInvites.d.ts +117 -0
- package/docs/api/calendarInvites.md +148 -0
- package/docs/api/campaignWorkflows.d.ts +152 -0
- package/docs/api/campaignWorkflows.md +200 -0
- package/docs/api/campaigns.d.ts +721 -0
- package/docs/api/campaigns.md +1236 -0
- package/docs/api/channels.d.ts +171 -0
- package/docs/api/channels.md +235 -0
- package/docs/api/cliCampaigns.d.ts +205 -0
- package/docs/api/cliCampaigns.md +256 -0
- package/docs/api/cliPipelines.d.ts +324 -0
- package/docs/api/cliPipelines.md +562 -0
- package/docs/api/clickHouse.d.ts +115 -0
- package/docs/api/clickHouse.md +138 -0
- package/docs/api/companies.d.ts +1636 -0
- package/docs/api/companies.md +2211 -0
- package/docs/api/companyIntelligence.d.ts +299 -0
- package/docs/api/companyIntelligence.md +488 -0
- package/docs/api/contacts.d.ts +2173 -0
- package/docs/api/contacts.md +3143 -0
- package/docs/api/content.d.ts +968 -0
- package/docs/api/content.md +1667 -0
- package/docs/api/contentGridSkills.d.ts +177 -0
- package/docs/api/contentGridSkills.md +271 -0
- package/docs/api/copilot.d.ts +1017 -0
- package/docs/api/copilot.md +1765 -0
- package/docs/api/crmSyncs.d.ts +215 -0
- package/docs/api/crmSyncs.md +301 -0
- package/docs/api/customerSuccess.d.ts +491 -0
- package/docs/api/customerSuccess.md +776 -0
- package/docs/api/deals.d.ts +1696 -0
- package/docs/api/deals.md +2432 -0
- package/docs/api/deliverability.d.ts +418 -0
- package/docs/api/deliverability.md +677 -0
- package/docs/api/desk.d.ts +1765 -0
- package/docs/api/desk.md +3007 -0
- package/docs/api/dialer.d.ts +1185 -0
- package/docs/api/dialer.md +2166 -0
- package/docs/api/dialerAnalytics.d.ts +187 -0
- package/docs/api/dialerAnalytics.md +257 -0
- package/docs/api/documents.d.ts +895 -0
- package/docs/api/documents.md +1440 -0
- package/docs/api/duplicates.d.ts +195 -0
- package/docs/api/duplicates.md +315 -0
- package/docs/api/eSign.d.ts +38 -0
- package/docs/api/eSign.md +54 -0
- package/docs/api/eSignature.d.ts +242 -0
- package/docs/api/eSignature.md +341 -0
- package/docs/api/enrichment.d.ts +3207 -0
- package/docs/api/enrichment.md +5225 -0
- package/docs/api/events.d.ts +115 -0
- package/docs/api/events.md +105 -0
- package/docs/api/fields.d.ts +482 -0
- package/docs/api/fields.md +566 -0
- package/docs/api/forms.d.ts +1012 -0
- package/docs/api/forms.md +1542 -0
- package/docs/api/gtmCampaigns.d.ts +662 -0
- package/docs/api/gtmCampaigns.md +1044 -0
- package/docs/api/gtmContext.d.ts +1187 -0
- package/docs/api/gtmContext.md +2112 -0
- package/docs/api/gtmDeliverability.d.ts +60 -0
- package/docs/api/gtmDeliverability.md +63 -0
- package/docs/api/gtmKnowledgeBase.d.ts +76 -0
- package/docs/api/gtmKnowledgeBase.md +91 -0
- package/docs/api/gtmLaunchHelpers.d.ts +123 -0
- package/docs/api/gtmLaunchHelpers.md +148 -0
- package/docs/api/gtmLibrary.d.ts +448 -0
- package/docs/api/gtmLibrary.md +780 -0
- package/docs/api/health.d.ts +39 -0
- package/docs/api/health.md +58 -0
- package/docs/api/imageLibrary.d.ts +341 -0
- package/docs/api/imageLibrary.md +569 -0
- package/docs/api/imports.d.ts +157 -0
- package/docs/api/imports.md +174 -0
- package/docs/api/inbox.d.ts +709 -0
- package/docs/api/inbox.md +1067 -0
- package/docs/api/install.d.ts +213 -0
- package/docs/api/install.md +317 -0
- package/docs/api/installedApps.d.ts +131 -0
- package/docs/api/installedApps.md +241 -0
- package/docs/api/integrationStatus.d.ts +142 -0
- package/docs/api/integrationStatus.md +205 -0
- package/docs/api/integrations.d.ts +2327 -0
- package/docs/api/integrations.md +3791 -0
- package/docs/api/intent.d.ts +482 -0
- package/docs/api/intent.md +858 -0
- package/docs/api/knowledge.d.ts +501 -0
- package/docs/api/knowledge.md +843 -0
- package/docs/api/knowledgeBase.d.ts +84 -0
- package/docs/api/knowledgeBase.md +96 -0
- package/docs/api/landingPages.d.ts +1411 -0
- package/docs/api/landingPages.md +2488 -0
- package/docs/api/leads.d.ts +133 -0
- package/docs/api/leads.md +180 -0
- package/docs/api/library.d.ts +217 -0
- package/docs/api/library.md +338 -0
- package/docs/api/linkedIn.d.ts +227 -0
- package/docs/api/linkedIn.md +289 -0
- package/docs/api/linkedInOutreach.d.ts +727 -0
- package/docs/api/linkedInOutreach.md +990 -0
- package/docs/api/lists.d.ts +1106 -0
- package/docs/api/lists.md +1609 -0
- package/docs/api/logs.d.ts +71 -0
- package/docs/api/logs.md +70 -0
- package/docs/api/mailboxes.d.ts +1050 -0
- package/docs/api/mailboxes.md +1690 -0
- package/docs/api/marketingIntelligence.d.ts +256 -0
- package/docs/api/marketingIntelligence.md +454 -0
- package/docs/api/marketplace.d.ts +3173 -0
- package/docs/api/marketplace.md +5953 -0
- package/docs/api/mcp.d.ts +69 -0
- package/docs/api/mcp.md +69 -0
- package/docs/api/me.d.ts +54 -0
- package/docs/api/me.md +56 -0
- package/docs/api/meetings.d.ts +539 -0
- package/docs/api/meetings.md +747 -0
- package/docs/api/newsletter.d.ts +1613 -0
- package/docs/api/newsletter.md +2746 -0
- package/docs/api/notes.d.ts +517 -0
- package/docs/api/notes.md +888 -0
- package/docs/api/notifications.d.ts +94 -0
- package/docs/api/notifications.md +105 -0
- package/docs/api/objects.d.ts +621 -0
- package/docs/api/objects.md +1098 -0
- package/docs/api/openSearch.d.ts +234 -0
- package/docs/api/openSearch.md +297 -0
- package/docs/api/ops.d.ts +299 -0
- package/docs/api/ops.md +339 -0
- package/docs/api/orgGovernance.d.ts +393 -0
- package/docs/api/orgGovernance.md +623 -0
- package/docs/api/orgVideos.d.ts +184 -0
- package/docs/api/orgVideos.md +252 -0
- package/docs/api/organizationSettings.d.ts +626 -0
- package/docs/api/organizationSettings.md +911 -0
- package/docs/api/phoneNumbers.d.ts +484 -0
- package/docs/api/phoneNumbers.md +777 -0
- package/docs/api/profile.d.ts +329 -0
- package/docs/api/profile.md +540 -0
- package/docs/api/programmaticPages.d.ts +400 -0
- package/docs/api/programmaticPages.md +626 -0
- package/docs/api/providerDomains.d.ts +866 -0
- package/docs/api/providerDomains.md +1446 -0
- package/docs/api/providerUsage.d.ts +129 -0
- package/docs/api/providerUsage.md +186 -0
- package/docs/api/public.d.ts +69 -0
- package/docs/api/public.md +78 -0
- package/docs/api/publicCopilot.d.ts +67 -0
- package/docs/api/publicCopilot.md +80 -0
- package/docs/api/publicSignals.d.ts +66 -0
- package/docs/api/publicSignals.md +71 -0
- package/docs/api/publicVisitors.d.ts +97 -0
- package/docs/api/publicVisitors.md +118 -0
- package/docs/api/quotes.d.ts +1564 -0
- package/docs/api/quotes.md +2553 -0
- package/docs/api/radar.d.ts +808 -0
- package/docs/api/radar.md +1431 -0
- package/docs/api/radarReports.d.ts +208 -0
- package/docs/api/radarReports.md +306 -0
- package/docs/api/recordRoles.d.ts +143 -0
- package/docs/api/recordRoles.md +175 -0
- package/docs/api/repos.d.ts +146 -0
- package/docs/api/repos.md +211 -0
- package/docs/api/research.d.ts +295 -0
- package/docs/api/research.md +534 -0
- package/docs/api/revenue.d.ts +402 -0
- package/docs/api/revenue.md +608 -0
- package/docs/api/revenueAnalytics.d.ts +147 -0
- package/docs/api/revenueAnalytics.md +212 -0
- package/docs/api/revenueLifecycle.d.ts +207 -0
- package/docs/api/revenueLifecycle.md +274 -0
- package/docs/api/revenueRecords.d.ts +372 -0
- package/docs/api/revenueRecords.md +563 -0
- package/docs/api/roles.d.ts +431 -0
- package/docs/api/roles.md +812 -0
- package/docs/api/salesCoach.d.ts +877 -0
- package/docs/api/salesCoach.md +1540 -0
- package/docs/api/sandbox.d.ts +210 -0
- package/docs/api/sandbox.md +380 -0
- package/docs/api/scans.d.ts +104 -0
- package/docs/api/scans.md +136 -0
- package/docs/api/scheduleBuy.d.ts +293 -0
- package/docs/api/scheduleBuy.md +431 -0
- package/docs/api/scraping.d.ts +266 -0
- package/docs/api/scraping.md +383 -0
- package/docs/api/sdrAnalytics.d.ts +138 -0
- package/docs/api/sdrAnalytics.md +246 -0
- package/docs/api/search.d.ts +598 -0
- package/docs/api/search.md +866 -0
- package/docs/api/seo.d.ts +447 -0
- package/docs/api/seo.md +660 -0
- package/docs/api/sequenceLifecycle.d.ts +439 -0
- package/docs/api/sequenceLifecycle.md +513 -0
- package/docs/api/sequences.d.ts +1936 -0
- package/docs/api/sequences.md +3232 -0
- package/docs/api/settings.d.ts +448 -0
- package/docs/api/settings.md +731 -0
- package/docs/api/signals.d.ts +1441 -0
- package/docs/api/signals.md +2526 -0
- package/docs/api/signatures.d.ts +719 -0
- package/docs/api/signatures.md +1247 -0
- package/docs/api/skills.d.ts +230 -0
- package/docs/api/skills.md +466 -0
- package/docs/api/snippet.d.ts +85 -0
- package/docs/api/snippet.md +106 -0
- package/docs/api/socialPublishing.d.ts +824 -0
- package/docs/api/socialPublishing.md +1245 -0
- package/docs/api/studioDocuments.d.ts +244 -0
- package/docs/api/studioDocuments.md +348 -0
- package/docs/api/support.d.ts +90 -0
- package/docs/api/support.md +76 -0
- package/docs/api/suppressions.d.ts +241 -0
- package/docs/api/suppressions.md +343 -0
- package/docs/api/surveys.d.ts +847 -0
- package/docs/api/surveys.md +1223 -0
- package/docs/api/tasks.d.ts +813 -0
- package/docs/api/tasks.md +1344 -0
- package/docs/api/teamMembers.d.ts +668 -0
- package/docs/api/teamMembers.md +1040 -0
- package/docs/api/teams.d.ts +784 -0
- package/docs/api/teams.md +1395 -0
- package/docs/api/usage.d.ts +277 -0
- package/docs/api/usage.md +389 -0
- package/docs/api/visitors.d.ts +690 -0
- package/docs/api/visitors.md +1075 -0
- package/docs/api/voice.d.ts +4661 -0
- package/docs/api/voice.md +7905 -0
- package/docs/api/webAnalytics.d.ts +964 -0
- package/docs/api/webAnalytics.md +1452 -0
- package/docs/api/webChat.d.ts +1704 -0
- package/docs/api/webChat.md +2048 -0
- package/docs/api/webhooks.d.ts +251 -0
- package/docs/api/webhooks.md +386 -0
- package/docs/api/websiteEditor.d.ts +324 -0
- package/docs/api/websiteEditor.md +517 -0
- package/docs/api/work.d.ts +2298 -0
- package/docs/api/work.md +3096 -0
- package/docs/api/workbench.d.ts +2962 -0
- package/docs/api/workbench.md +4884 -0
- package/docs/api/workflows.d.ts +1218 -0
- package/docs/api/workflows.md +2302 -0
- package/docs/sdk-clients.md +4339 -0
- package/package.json +10 -3
|
@@ -0,0 +1,215 @@
|
|
|
1
|
+
export interface Deal {
|
|
2
|
+
/** Canonical CRM revision returned by a conditional update. */
|
|
3
|
+
revision?: number | null;
|
|
4
|
+
id: string | null;
|
|
5
|
+
name: string | null;
|
|
6
|
+
description: string | null;
|
|
7
|
+
amount: number | null;
|
|
8
|
+
currency: string | null;
|
|
9
|
+
stage_id: string | null;
|
|
10
|
+
stage_name: string | null;
|
|
11
|
+
pipeline_id: string | null;
|
|
12
|
+
/** Linked company ID (mashup_company_id), if any. */
|
|
13
|
+
company_id: number | string | null;
|
|
14
|
+
owner_id: string | null;
|
|
15
|
+
/** ISO 8601 date. */
|
|
16
|
+
close_date: string | null;
|
|
17
|
+
created_at: string | null;
|
|
18
|
+
updated_at: string | null;
|
|
19
|
+
}
|
|
20
|
+
export interface DealCreateParams {
|
|
21
|
+
name: string;
|
|
22
|
+
/**
|
|
23
|
+
* Deal owner (user id or email). Required.
|
|
24
|
+
*/
|
|
25
|
+
owner_id: string;
|
|
26
|
+
/**
|
|
27
|
+
* mashup_contact_ids to attach. Required, at least one. Every contact must
|
|
28
|
+
* belong to the same company, and that company becomes the deal's company.
|
|
29
|
+
* Same id space as the contacts API. Attach is idempotent.
|
|
30
|
+
*/
|
|
31
|
+
contact_ids: number[];
|
|
32
|
+
/**
|
|
33
|
+
* Deprecated: the company is derived from `contact_ids`. If supplied it must
|
|
34
|
+
* match the contacts' company, otherwise omit it.
|
|
35
|
+
*/
|
|
36
|
+
company_id?: number;
|
|
37
|
+
description?: string;
|
|
38
|
+
/**
|
|
39
|
+
* Monetary value. Required (HTTP 400, marker `amount_required_for_won_stage`)
|
|
40
|
+
* when creating directly in a Closed Won stage; 0 is a valid amount.
|
|
41
|
+
*/
|
|
42
|
+
amount?: number;
|
|
43
|
+
/** Default: "USD". */
|
|
44
|
+
currency?: string;
|
|
45
|
+
/**
|
|
46
|
+
* Stage ID from the org's pipelines. Must exist and belong to `pipeline_id`
|
|
47
|
+
* when both are sent (HTTP 422 otherwise). Defaults to the default
|
|
48
|
+
* pipeline's first non-closed stage if omitted. Creating directly in a
|
|
49
|
+
* closed stage triggers the closed-stage rules (HTTP 400 with marker
|
|
50
|
+
* `close_date_required_for_won_stage` / `close_date_required_for_lost_stage`
|
|
51
|
+
* / `amount_required_for_won_stage` / `owner_required_for_closed_stage`).
|
|
52
|
+
*/
|
|
53
|
+
stage_id?: string;
|
|
54
|
+
/** Pipeline ID. Must exist (HTTP 422 otherwise). Defaults to org's default pipeline if omitted. */
|
|
55
|
+
pipeline_id?: string;
|
|
56
|
+
/**
|
|
57
|
+
* ISO 8601 close date. Required when creating directly in a Closed Won or
|
|
58
|
+
* Closed Lost stage; past dates are allowed (backdating is supported).
|
|
59
|
+
*/
|
|
60
|
+
close_date?: string;
|
|
61
|
+
/**
|
|
62
|
+
* Set true to create a deal even if one already exists for the company.
|
|
63
|
+
* By default the API rejects a duplicate with HTTP 409.
|
|
64
|
+
*/
|
|
65
|
+
allow_duplicate?: boolean;
|
|
66
|
+
}
|
|
67
|
+
export interface DealUpdateParams {
|
|
68
|
+
/** Require this current CRM revision; a stale edit returns HTTP 409. */
|
|
69
|
+
expected_revision?: number;
|
|
70
|
+
name?: string;
|
|
71
|
+
description?: string;
|
|
72
|
+
amount?: number;
|
|
73
|
+
currency?: string;
|
|
74
|
+
/**
|
|
75
|
+
* New stage ID. Must be an existing stage in the deal's pipeline (HTTP 422
|
|
76
|
+
* otherwise). Moving a deal INTO a Closed Won stage requires an effective
|
|
77
|
+
* close_date AND amount; Closed Lost requires an effective close_date;
|
|
78
|
+
* either requires an owner ("effective" = the value in this call, else the
|
|
79
|
+
* deal's existing value). Violations return HTTP 400 with a marker-prefixed
|
|
80
|
+
* detail: `close_date_required_for_won_stage`,
|
|
81
|
+
* `close_date_required_for_lost_stage`, `amount_required_for_won_stage`,
|
|
82
|
+
* `owner_required_for_closed_stage`. Re-submitting the deal's current stage
|
|
83
|
+
* is never gated.
|
|
84
|
+
*/
|
|
85
|
+
stage_id?: string;
|
|
86
|
+
/**
|
|
87
|
+
* ISO 8601 close date. Explicit null clears it, except on a deal sitting in
|
|
88
|
+
* a closed stage (HTTP 400, closed-stage markers above).
|
|
89
|
+
*/
|
|
90
|
+
close_date?: string | null;
|
|
91
|
+
/**
|
|
92
|
+
* Reassign the deal owner. Pass a member id, email, or provider uid — it is
|
|
93
|
+
* resolved to a real team member (HTTP 422 if it matches none). Omit to
|
|
94
|
+
* leave the owner unchanged. Ownership is reassign-only and CANNOT be
|
|
95
|
+
* cleared: passing `null` is rejected with HTTP 422 (#18469). A deal's owner
|
|
96
|
+
* is a required invariant. (The closed-stage gate still applies when moving
|
|
97
|
+
* into Closed Won/Lost — see `stage_id`.)
|
|
98
|
+
*/
|
|
99
|
+
owner_id?: string;
|
|
100
|
+
/**
|
|
101
|
+
* mashup_contact_ids to link. Must belong to the deal's company (if the deal
|
|
102
|
+
* has none yet, the added contacts' company is adopted); a cross-company add
|
|
103
|
+
* is rejected. Idempotent.
|
|
104
|
+
*/
|
|
105
|
+
add_contact_ids?: number[];
|
|
106
|
+
/** mashup_contact_ids to unlink. Idempotent. */
|
|
107
|
+
remove_contact_ids?: number[];
|
|
108
|
+
/**
|
|
109
|
+
* Buying-committee role per contact on this deal, keyed by
|
|
110
|
+
* mashup_contact_id. JSON object keys are strings, so the key type is
|
|
111
|
+
* `string` even though the id is numeric: `{ "5500429": "champion" }`.
|
|
112
|
+
* `null` clears a contact's role.
|
|
113
|
+
*
|
|
114
|
+
* Applies to contacts already linked to the deal, and to contacts linked by
|
|
115
|
+
* `add_contact_ids` in the same call (roles are applied after the link). An
|
|
116
|
+
* id that is neither already linked nor being added is rejected with HTTP
|
|
117
|
+
* 422 naming the id, and the whole update is rolled back. A role outside the
|
|
118
|
+
* vocabulary is HTTP 422.
|
|
119
|
+
*/
|
|
120
|
+
contact_roles?: Record<string, DealContactRole | null>;
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Role a contact plays in a deal's buying committee
|
|
124
|
+
* (`cb_deal_contacts.role`). The same person can hold different roles on
|
|
125
|
+
* different deals, so this lives on the deal-contact link, not the contact.
|
|
126
|
+
*/
|
|
127
|
+
export type DealContactRole = "champion" | "decision_maker" | "influencer" | "blocker" | "coach" | "end_user";
|
|
128
|
+
export interface DealListParams {
|
|
129
|
+
page?: number;
|
|
130
|
+
limit?: number;
|
|
131
|
+
stage_id?: string;
|
|
132
|
+
pipeline_id?: string;
|
|
133
|
+
/** Substring search on deal name. */
|
|
134
|
+
search?: string;
|
|
135
|
+
}
|
|
136
|
+
export interface PipelineStage {
|
|
137
|
+
id: string;
|
|
138
|
+
name: string;
|
|
139
|
+
probability: number | null;
|
|
140
|
+
position: number | null;
|
|
141
|
+
stage_type: string | null;
|
|
142
|
+
color: string | null;
|
|
143
|
+
required_elements: string[];
|
|
144
|
+
recommended_elements: string[];
|
|
145
|
+
channel_scripts: Record<string, string>;
|
|
146
|
+
}
|
|
147
|
+
export interface Pipeline {
|
|
148
|
+
id: string;
|
|
149
|
+
name: string;
|
|
150
|
+
is_default: boolean;
|
|
151
|
+
stages: PipelineStage[];
|
|
152
|
+
}
|
|
153
|
+
/** Trimmed deal shape returned by /contacts/{id}/deals and /companies/{id}/deals. */
|
|
154
|
+
export interface ContactDeal {
|
|
155
|
+
deal_id: string | null;
|
|
156
|
+
name: string | null;
|
|
157
|
+
stage: string | null;
|
|
158
|
+
value: number | null;
|
|
159
|
+
currency: string | null;
|
|
160
|
+
role: string | null;
|
|
161
|
+
pipeline_id: string | null;
|
|
162
|
+
close_date: string | null;
|
|
163
|
+
owner_id: string | null;
|
|
164
|
+
created_at: string | null;
|
|
165
|
+
}
|
|
166
|
+
export interface PaginationMeta {
|
|
167
|
+
page: number;
|
|
168
|
+
limit: number;
|
|
169
|
+
total: number;
|
|
170
|
+
has_next: boolean;
|
|
171
|
+
}
|
|
172
|
+
/**
|
|
173
|
+
* Deals API - CRUD for deals + pipelines. Requires API key (server-side).
|
|
174
|
+
*
|
|
175
|
+
* Backed by:
|
|
176
|
+
* GET /api/v1/deals/pipelines
|
|
177
|
+
* GET /api/v1/deals
|
|
178
|
+
* POST /api/v1/deals
|
|
179
|
+
* GET /api/v1/deals/{deal_id}
|
|
180
|
+
* PATCH /api/v1/deals/{deal_id}
|
|
181
|
+
* DELETE /api/v1/deals/{deal_id}
|
|
182
|
+
* GET /api/v1/contacts/{contact_id}/deals
|
|
183
|
+
* GET /api/v1/companies/{company_id}/deals
|
|
184
|
+
*/
|
|
185
|
+
export declare const createDealsClient: (apiKey: string, apiUrl?: string) => {
|
|
186
|
+
/** List all deal pipelines and their stages. */
|
|
187
|
+
pipelines(): Promise<{
|
|
188
|
+
data: Pipeline[];
|
|
189
|
+
}>;
|
|
190
|
+
/** List deals org-wide with optional filters and pagination. */
|
|
191
|
+
list(params?: DealListParams): Promise<{
|
|
192
|
+
data: Deal[];
|
|
193
|
+
pagination?: PaginationMeta;
|
|
194
|
+
}>;
|
|
195
|
+
/** Create a new deal. */
|
|
196
|
+
create(deal: DealCreateParams): Promise<Deal>;
|
|
197
|
+
/** Get a single deal by ID. */
|
|
198
|
+
get(dealId: string): Promise<Deal>;
|
|
199
|
+
/** Update a deal (partial). */
|
|
200
|
+
update(dealId: string, fields: DealUpdateParams): Promise<Deal>;
|
|
201
|
+
/** Delete a deal. */
|
|
202
|
+
delete(dealId: string): Promise<{
|
|
203
|
+
data: {
|
|
204
|
+
deleted: boolean;
|
|
205
|
+
};
|
|
206
|
+
}>;
|
|
207
|
+
/** Get all deals associated with a contact. */
|
|
208
|
+
forContact(contactId: number): Promise<{
|
|
209
|
+
data: ContactDeal[];
|
|
210
|
+
}>;
|
|
211
|
+
/** Get all deals associated with a company. */
|
|
212
|
+
forCompany(companyId: number): Promise<{
|
|
213
|
+
data: ContactDeal[];
|
|
214
|
+
}>;
|
|
215
|
+
};
|
|
@@ -0,0 +1,51 @@
|
|
|
1
|
+
export interface PersonEnrichment {
|
|
2
|
+
found: boolean;
|
|
3
|
+
confidence: number;
|
|
4
|
+
data: Record<string, unknown>;
|
|
5
|
+
}
|
|
6
|
+
export interface CompanyEnrichment {
|
|
7
|
+
found: boolean;
|
|
8
|
+
confidence: number;
|
|
9
|
+
data: Record<string, unknown>;
|
|
10
|
+
}
|
|
11
|
+
export interface EmailVerification {
|
|
12
|
+
email: string;
|
|
13
|
+
valid: boolean;
|
|
14
|
+
deliverable: boolean;
|
|
15
|
+
catch_all: boolean;
|
|
16
|
+
}
|
|
17
|
+
export interface SearchFilter {
|
|
18
|
+
field: string;
|
|
19
|
+
operator: "any_of" | "contains" | "all_of" | "none_of" | "is_empty" | "is_not_empty" | "between" | "exists";
|
|
20
|
+
value: unknown;
|
|
21
|
+
}
|
|
22
|
+
export interface SearchResults {
|
|
23
|
+
contacts: Record<string, unknown>[];
|
|
24
|
+
total: number;
|
|
25
|
+
page: number;
|
|
26
|
+
}
|
|
27
|
+
/**
|
|
28
|
+
* Enrichment API - person/company lookup, email verification, prospecting search.
|
|
29
|
+
*
|
|
30
|
+
* Requires API key (server-side only). Credits charged per call. On the hardened
|
|
31
|
+
* HTTP core: throws a typed `G8Error` on failure and retries transient errors.
|
|
32
|
+
*/
|
|
33
|
+
export declare const createEnrichClient: (apiKey: string, apiUrl?: string) => {
|
|
34
|
+
/** Look up a person by email, LinkedIn, or name + company. Costs 1 credit. */
|
|
35
|
+
person(params: {
|
|
36
|
+
email?: string;
|
|
37
|
+
linkedin_url?: string;
|
|
38
|
+
first_name?: string;
|
|
39
|
+
last_name?: string;
|
|
40
|
+
company_domain?: string;
|
|
41
|
+
}): Promise<PersonEnrichment>;
|
|
42
|
+
/** Look up a company by domain or name. Costs 1 credit. */
|
|
43
|
+
company(params: {
|
|
44
|
+
domain?: string;
|
|
45
|
+
name?: string;
|
|
46
|
+
}): Promise<CompanyEnrichment>;
|
|
47
|
+
/** Verify an email address. Costs 1 credit. */
|
|
48
|
+
verifyEmail(email: string): Promise<EmailVerification>;
|
|
49
|
+
/** Search 700M+ contacts with filters. Credits charged per result. */
|
|
50
|
+
search(filters: SearchFilter[], page?: number, limit?: number): Promise<SearchResults>;
|
|
51
|
+
};
|
|
@@ -0,0 +1,84 @@
|
|
|
1
|
+
/** A field (column) definition on contacts or companies — base or custom. */
|
|
2
|
+
export interface Field {
|
|
3
|
+
id: number | null;
|
|
4
|
+
title: string;
|
|
5
|
+
/** Internal column name (slug). */
|
|
6
|
+
name: string | null;
|
|
7
|
+
/** Currently only "text" is supported; other types may be added later. */
|
|
8
|
+
data_type: string;
|
|
9
|
+
/** True if available org-wide, false if list-specific. */
|
|
10
|
+
is_global: boolean;
|
|
11
|
+
}
|
|
12
|
+
/** Created custom field (column). */
|
|
13
|
+
export interface CreatedField {
|
|
14
|
+
id: number;
|
|
15
|
+
title: string;
|
|
16
|
+
data_type: string;
|
|
17
|
+
name: string;
|
|
18
|
+
list_id: number | null;
|
|
19
|
+
is_global: boolean;
|
|
20
|
+
}
|
|
21
|
+
export interface FieldCreateParams {
|
|
22
|
+
title: string;
|
|
23
|
+
/** "contacts" or "companies". Defaults to "contacts" on the backend. */
|
|
24
|
+
entity?: "contacts" | "companies";
|
|
25
|
+
/** "text" (default) — additional types may be added later. */
|
|
26
|
+
data_type?: string;
|
|
27
|
+
/** If set, the field is list-specific. Omit for org-wide global field. */
|
|
28
|
+
list_id?: number;
|
|
29
|
+
}
|
|
30
|
+
export interface FieldDeleteParams {
|
|
31
|
+
entity?: "contacts" | "companies";
|
|
32
|
+
/**
|
|
33
|
+
* Optional list scope guard. If provided, the column must belong to this
|
|
34
|
+
* list or the request returns 404. Use this to prevent accidentally
|
|
35
|
+
* deleting a column on a different list in the same org.
|
|
36
|
+
*/
|
|
37
|
+
list_id?: number;
|
|
38
|
+
}
|
|
39
|
+
export interface SetFieldValueParams {
|
|
40
|
+
/** Contact ID (entity='contacts') or company ID (entity='companies'). */
|
|
41
|
+
record_id: number;
|
|
42
|
+
/** Value to write. Pass null/undefined to clear the field. */
|
|
43
|
+
value?: string | null;
|
|
44
|
+
entity?: "contacts" | "companies";
|
|
45
|
+
}
|
|
46
|
+
/**
|
|
47
|
+
* Fields API - manage custom fields (columns) on contacts and companies.
|
|
48
|
+
* Requires API key (server-side). On the hardened HTTP core: throws a typed
|
|
49
|
+
* `G8Error` on failure and retries transient errors.
|
|
50
|
+
*
|
|
51
|
+
* Backed by:
|
|
52
|
+
* GET /api/v1/fields — list contact fields
|
|
53
|
+
* GET /api/v1/fields/companies — list company fields
|
|
54
|
+
* POST /api/v1/fields — create a custom field
|
|
55
|
+
* DELETE /api/v1/fields/{column_id} — delete a custom field
|
|
56
|
+
* PATCH /api/v1/fields/{column_id}/values — set value on a single record
|
|
57
|
+
*/
|
|
58
|
+
export declare const createFieldsClient: (apiKey: string, apiUrl?: string) => {
|
|
59
|
+
/** List contact fields (base + custom). Pass listId to include list-specific custom fields. */
|
|
60
|
+
listContactFields(listId?: number): Promise<{
|
|
61
|
+
data: Field[];
|
|
62
|
+
}>;
|
|
63
|
+
/** List company fields (base + custom). Pass listId to include list-specific custom fields. */
|
|
64
|
+
listCompanyFields(listId?: number): Promise<{
|
|
65
|
+
data: Field[];
|
|
66
|
+
}>;
|
|
67
|
+
/** Create a custom field on contacts (default) or companies. */
|
|
68
|
+
create(params: FieldCreateParams): Promise<CreatedField>;
|
|
69
|
+
/** Delete a custom field (soft-delete). Pass list_id to scope-guard against cross-list deletion. */
|
|
70
|
+
delete(columnId: number, params?: FieldDeleteParams): Promise<{
|
|
71
|
+
data: {
|
|
72
|
+
column_id: number;
|
|
73
|
+
deleted: boolean;
|
|
74
|
+
};
|
|
75
|
+
}>;
|
|
76
|
+
/** Set a custom field value on a single contact or company row. Pass value=null to clear. */
|
|
77
|
+
setValue(columnId: number, params: SetFieldValueParams): Promise<{
|
|
78
|
+
data: {
|
|
79
|
+
column_id: number;
|
|
80
|
+
record_id: number;
|
|
81
|
+
updated: boolean;
|
|
82
|
+
};
|
|
83
|
+
}>;
|
|
84
|
+
};
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
import type { EnrichLookupResult } from "./types";
|
|
2
|
+
/**
|
|
3
|
+
* Progressive form enrichment - checks what fields graph8 already knows
|
|
4
|
+
* about a contact so your form can skip those fields.
|
|
5
|
+
*
|
|
6
|
+
* Calls POST /api/v1/public/enrich/lookup (authenticated via write key).
|
|
7
|
+
*/
|
|
8
|
+
export declare const createFormsClient: (writeKey: string, apiUrl?: string) => {
|
|
9
|
+
/**
|
|
10
|
+
* Look up known fields for an email address.
|
|
11
|
+
*
|
|
12
|
+
* Use this in progressive forms: after the user enters their email,
|
|
13
|
+
* check what graph8 already knows and only show missing fields.
|
|
14
|
+
*/
|
|
15
|
+
lookup(email: string): Promise<EnrichLookupResult>;
|
|
16
|
+
};
|
|
@@ -0,0 +1,141 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hardened HTTP core for the graph8 JS SDK (sprint B2).
|
|
3
|
+
*
|
|
4
|
+
* Resource clients historically called `fetch` directly and returned
|
|
5
|
+
* `resp.json()` even on a 4xx/5xx — so API errors surfaced silently as "data".
|
|
6
|
+
* This module centralizes the request path with:
|
|
7
|
+
*
|
|
8
|
+
* - a typed `G8Error` (status, type, code, request_id, detail) thrown on any
|
|
9
|
+
* non-2xx response, parsed from the standard ApiError envelope;
|
|
10
|
+
* - automatic retry with exponential backoff + jitter on 429 and 5xx,
|
|
11
|
+
* honoring the `Retry-After` header — EXCEPT for billable and external
|
|
12
|
+
* (message-sending, call-placing) operations once the request may have
|
|
13
|
+
* reached the server (see `isNoBlindRetryOperation`);
|
|
14
|
+
* - `Idempotency-Key` on every write (POST/PUT/PATCH/DELETE) the client might
|
|
15
|
+
* retry, so a retry collapses into one operation server-side;
|
|
16
|
+
* - a cursor `paginate()` async-iterator that follows `next_cursor` (A9).
|
|
17
|
+
*
|
|
18
|
+
* `fetch` and `sleep` are injectable so the retry/backoff logic is
|
|
19
|
+
* deterministically unit-testable without real timers or network.
|
|
20
|
+
*/
|
|
21
|
+
export declare class G8Error extends Error {
|
|
22
|
+
readonly status: number;
|
|
23
|
+
readonly type: string;
|
|
24
|
+
readonly code?: string;
|
|
25
|
+
readonly requestId?: string;
|
|
26
|
+
readonly detail?: unknown;
|
|
27
|
+
/** True when the failure class is transient (429/5xx/network). */
|
|
28
|
+
readonly retryable: boolean;
|
|
29
|
+
constructor(args: {
|
|
30
|
+
message: string;
|
|
31
|
+
status: number;
|
|
32
|
+
type: string;
|
|
33
|
+
code?: string;
|
|
34
|
+
requestId?: string;
|
|
35
|
+
detail?: unknown;
|
|
36
|
+
retryable?: boolean;
|
|
37
|
+
});
|
|
38
|
+
}
|
|
39
|
+
/** 429 and 5xx are the transient classes worth retrying. */
|
|
40
|
+
export declare function isRetryableStatus(status: number): boolean;
|
|
41
|
+
/**
|
|
42
|
+
* True when `method` + `urlOrPath` is an operation the contract marks
|
|
43
|
+
* `billable` (it spends credits). Accepts a full URL or a path, with or without
|
|
44
|
+
* the `/api/v1` base; the query string is ignored.
|
|
45
|
+
*
|
|
46
|
+
* The table is generated from the contract (`src/generated/billable.ts`), never
|
|
47
|
+
* hand-written. Where a concrete path could match both a billable template and
|
|
48
|
+
* a non-billable one, this answers "billable": the cost of that mistake is a
|
|
49
|
+
* retry we did not make, while the opposite mistake is a double charge.
|
|
50
|
+
*/
|
|
51
|
+
export declare function isBillableOperation(method: string, urlOrPath: string): boolean;
|
|
52
|
+
/**
|
|
53
|
+
* True when `method` + `urlOrPath` is an operation the contract marks
|
|
54
|
+
* `external`: it sends an email, a text or a LinkedIn message, places a phone
|
|
55
|
+
* call, or launches something that will. Same input rules as
|
|
56
|
+
* {@link isBillableOperation}; the table is generated into
|
|
57
|
+
* `src/generated/external.ts`.
|
|
58
|
+
*/
|
|
59
|
+
export declare function isExternalOperation(method: string, urlOrPath: string): boolean;
|
|
60
|
+
/**
|
|
61
|
+
* True when a failure after the request may have reached the server must NOT be
|
|
62
|
+
* retried automatically: billable operations (a retry can charge twice) and
|
|
63
|
+
* external ones (a retry can send the same email or ring the same phone twice).
|
|
64
|
+
*
|
|
65
|
+
* Why the server's idempotency key is not enough for `external`: the API keeps
|
|
66
|
+
* a failed response under its key only for `billable` operations. For every
|
|
67
|
+
* other tier a 5xx RELEASES the key, so a same-key retry executes again. A send
|
|
68
|
+
* that reached the provider and then failed on bookkeeping would go out twice.
|
|
69
|
+
*/
|
|
70
|
+
export declare function isNoBlindRetryOperation(method: string, urlOrPath: string): boolean;
|
|
71
|
+
/** True only when the network error provably happened before the request was sent. */
|
|
72
|
+
export declare function isPreSendNetworkError(err: unknown): boolean;
|
|
73
|
+
/**
|
|
74
|
+
* Parse a `Retry-After` header into milliseconds. Supports both the
|
|
75
|
+
* delta-seconds form (`"2"`) and the HTTP-date form. Returns null when absent
|
|
76
|
+
* or unparseable so the caller falls back to computed backoff.
|
|
77
|
+
*/
|
|
78
|
+
export declare function parseRetryAfter(header: string | null | undefined, nowMs?: number): number | null;
|
|
79
|
+
/** Exponential backoff with full jitter, capped at 10s. */
|
|
80
|
+
export declare function backoffDelayMs(attempt: number, baseMs?: number, rand?: () => number): number;
|
|
81
|
+
/**
|
|
82
|
+
* Record what the server said about a key's agency status. @internal — fed by
|
|
83
|
+
* `agency.me()` / `agency.clients()`, never by an extra request.
|
|
84
|
+
*/
|
|
85
|
+
export declare function noteAgencyStatus(apiKey: string, isAgency: boolean): void;
|
|
86
|
+
/** @internal Test hook: forget every recorded agency status and warning. */
|
|
87
|
+
export declare function resetAgencyStatusForTests(): void;
|
|
88
|
+
export interface RequestOptions {
|
|
89
|
+
method?: string;
|
|
90
|
+
body?: unknown;
|
|
91
|
+
/**
|
|
92
|
+
* Extra request headers. Note on `X-Target-Org-Id`: it only takes effect for
|
|
93
|
+
* an AGENCY key (minted with `is_agency: true`) and only for a client org that
|
|
94
|
+
* agency is authorized for. For any other key the server silently ignores it
|
|
95
|
+
* and the call runs against the key's own org; `/api-keys` and `/agency/*`
|
|
96
|
+
* reject it with a 400. See `agency.me()`.
|
|
97
|
+
*/
|
|
98
|
+
headers?: Record<string, string>;
|
|
99
|
+
query?: Record<string, unknown>;
|
|
100
|
+
/**
|
|
101
|
+
* Sent as the `Idempotency-Key` header. When omitted, one is minted for every
|
|
102
|
+
* write (POST/PUT/PATCH/DELETE) unless `maxRetries` is 0.
|
|
103
|
+
*/
|
|
104
|
+
idempotencyKey?: string;
|
|
105
|
+
/**
|
|
106
|
+
* Max retry attempts on 429/5xx/network (default 2 -> up to 3 tries).
|
|
107
|
+
* Billable and external (send / dial / launch) operations are only retried
|
|
108
|
+
* on 429 and on network errors that provably happened before the request was
|
|
109
|
+
* sent.
|
|
110
|
+
*/
|
|
111
|
+
maxRetries?: number;
|
|
112
|
+
/** Base backoff in ms (default 200). */
|
|
113
|
+
retryBaseMs?: number;
|
|
114
|
+
signal?: AbortSignal;
|
|
115
|
+
/** Injected for tests; defaults to global fetch. */
|
|
116
|
+
fetchImpl?: typeof fetch;
|
|
117
|
+
/** Injected for tests; defaults to a real setTimeout sleep. */
|
|
118
|
+
sleepImpl?: (ms: number) => Promise<void>;
|
|
119
|
+
}
|
|
120
|
+
/**
|
|
121
|
+
* Perform a JSON request with retries + typed errors. Returns the parsed JSON
|
|
122
|
+
* envelope (callers unwrap `.data` as today). Throws `G8Error` on any non-2xx
|
|
123
|
+
* after exhausting retries.
|
|
124
|
+
*/
|
|
125
|
+
export declare function request<T = unknown>(baseUrl: string, path: string, apiKey: string, opts?: RequestOptions): Promise<T>;
|
|
126
|
+
/** @internal The identity headers to add, minus any the caller already set. */
|
|
127
|
+
export declare function clientIdentityHeaders(callerHeaders?: Record<string, string>): Record<string, string>;
|
|
128
|
+
export interface PaginatedResponse<T> {
|
|
129
|
+
data: T[];
|
|
130
|
+
pagination?: {
|
|
131
|
+
next_cursor?: string | null;
|
|
132
|
+
has_next?: boolean;
|
|
133
|
+
page?: number;
|
|
134
|
+
};
|
|
135
|
+
}
|
|
136
|
+
/**
|
|
137
|
+
* Auto-pagination async iterator following `next_cursor` (A9). Yields every
|
|
138
|
+
* item across pages so callers can `for await (const x of paginate(...))`
|
|
139
|
+
* without manual cursor bookkeeping.
|
|
140
|
+
*/
|
|
141
|
+
export declare function paginate<T>(fetchPage: (cursor?: string) => Promise<PaginatedResponse<T>>): AsyncGenerator<T, void, unknown>;
|
|
@@ -0,0 +1,123 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Inbox channel — `email`, `sms`, or `linkedin` (HeyReach internally).
|
|
3
|
+
* Defaults to `email` on routes that accept this as a query param.
|
|
4
|
+
*/
|
|
5
|
+
export type InboxChannel = "email" | "sms" | "linkedin";
|
|
6
|
+
export interface InboxContact {
|
|
7
|
+
name?: string | null;
|
|
8
|
+
email?: string | null;
|
|
9
|
+
company?: string | null;
|
|
10
|
+
[key: string]: unknown;
|
|
11
|
+
}
|
|
12
|
+
export interface InboxTag {
|
|
13
|
+
id: string;
|
|
14
|
+
name: string;
|
|
15
|
+
}
|
|
16
|
+
export interface InboxAssignee {
|
|
17
|
+
email: string;
|
|
18
|
+
name?: string | null;
|
|
19
|
+
[key: string]: unknown;
|
|
20
|
+
}
|
|
21
|
+
export interface InboxMessage {
|
|
22
|
+
message_id: string | null;
|
|
23
|
+
from_address: string | null;
|
|
24
|
+
to_addresses: string[];
|
|
25
|
+
content: string | null;
|
|
26
|
+
/** "USER", "AI", or "OTHER". */
|
|
27
|
+
responder: string | null;
|
|
28
|
+
date: string | null;
|
|
29
|
+
is_draft: boolean;
|
|
30
|
+
}
|
|
31
|
+
export interface InboxThread {
|
|
32
|
+
id: string;
|
|
33
|
+
/** "email", "sms", or "linkedin". */
|
|
34
|
+
channel: string;
|
|
35
|
+
subject: string | null;
|
|
36
|
+
contact: InboxContact | null;
|
|
37
|
+
messages: InboxMessage[];
|
|
38
|
+
/** "open", "responded", "ai_responded", etc. */
|
|
39
|
+
status: string | null;
|
|
40
|
+
tags: InboxTag[];
|
|
41
|
+
assignees: InboxAssignee[];
|
|
42
|
+
created_at: string | null;
|
|
43
|
+
updated_at: string | null;
|
|
44
|
+
}
|
|
45
|
+
export interface InboxListParams {
|
|
46
|
+
channel?: InboxChannel;
|
|
47
|
+
sequence_id?: string;
|
|
48
|
+
/** Filter by thread status (e.g. "open", "responded", "ai_responded"). */
|
|
49
|
+
status?: string;
|
|
50
|
+
/** Filter by assignee email. */
|
|
51
|
+
assignee?: string;
|
|
52
|
+
/** Filter by tag ID. */
|
|
53
|
+
tag?: string;
|
|
54
|
+
page?: number;
|
|
55
|
+
/** Default 50, max 100. */
|
|
56
|
+
page_size?: number;
|
|
57
|
+
}
|
|
58
|
+
export interface InboxAssignResult {
|
|
59
|
+
assigned: boolean;
|
|
60
|
+
assignee: string;
|
|
61
|
+
count: number;
|
|
62
|
+
[key: string]: unknown;
|
|
63
|
+
}
|
|
64
|
+
export interface InboxTagResult {
|
|
65
|
+
tagged: boolean;
|
|
66
|
+
tag_count: number;
|
|
67
|
+
[key: string]: unknown;
|
|
68
|
+
}
|
|
69
|
+
export interface InboxDraft {
|
|
70
|
+
/** HTML body. */
|
|
71
|
+
content: string;
|
|
72
|
+
/** Plain-text alternative, if available. */
|
|
73
|
+
plain_content: string | null;
|
|
74
|
+
/** Credits charged for AI generation. */
|
|
75
|
+
credits_charged: number;
|
|
76
|
+
}
|
|
77
|
+
export interface InboxSendParams {
|
|
78
|
+
body: string;
|
|
79
|
+
channel: InboxChannel;
|
|
80
|
+
subject?: string;
|
|
81
|
+
/** Recipient override — email, phone, or LinkedIn ID. */
|
|
82
|
+
to?: string;
|
|
83
|
+
/** Sender override — mailbox email, Twilio number, or LinkedIn account ID. */
|
|
84
|
+
from_address?: string;
|
|
85
|
+
}
|
|
86
|
+
export interface InboxSendResult {
|
|
87
|
+
message_id: string | null;
|
|
88
|
+
status: string;
|
|
89
|
+
channel: string;
|
|
90
|
+
}
|
|
91
|
+
/**
|
|
92
|
+
* Inbox API — read + reply to multi-channel inbox threads (email, SMS, LinkedIn/HeyReach).
|
|
93
|
+
* Requires API key (server-side). On the hardened HTTP core: throws a typed
|
|
94
|
+
* `G8Error` on failure (e.g. 402 when an AI draft exceeds your credit balance)
|
|
95
|
+
* and retries transient errors.
|
|
96
|
+
*
|
|
97
|
+
* Backed by:
|
|
98
|
+
* GET /api/v1/inbox
|
|
99
|
+
* GET /api/v1/inbox/{reply_id}
|
|
100
|
+
* POST /api/v1/inbox/{reply_id}/assign
|
|
101
|
+
* POST /api/v1/inbox/{reply_id}/tag
|
|
102
|
+
* GET /api/v1/inbox/{reply_id}/draft (charges credits, 402 on insufficient balance)
|
|
103
|
+
* POST /api/v1/inbox/{reply_id}/send
|
|
104
|
+
*/
|
|
105
|
+
export declare const createInboxClient: (apiKey: string, apiUrl?: string) => {
|
|
106
|
+
/** List inbox threads across email, SMS, and LinkedIn. */
|
|
107
|
+
list(params?: InboxListParams): Promise<{
|
|
108
|
+
data: InboxThread[];
|
|
109
|
+
}>;
|
|
110
|
+
/** Get a single inbox thread. Defaults to email channel. */
|
|
111
|
+
get(replyId: string, channel?: InboxChannel): Promise<InboxThread>;
|
|
112
|
+
/** Assign a user to an inbox thread. */
|
|
113
|
+
assign(replyId: string, assigneeEmail: string, channel?: InboxChannel): Promise<InboxAssignResult>;
|
|
114
|
+
/** Attach tag IDs to an inbox thread. */
|
|
115
|
+
tag(replyId: string, tagIds: string[], channel?: InboxChannel): Promise<InboxTagResult>;
|
|
116
|
+
/**
|
|
117
|
+
* Generate an AI draft reply for a thread.
|
|
118
|
+
* Charges credits — server returns 402 if balance is insufficient.
|
|
119
|
+
*/
|
|
120
|
+
draft(replyId: string, channel?: InboxChannel): Promise<InboxDraft>;
|
|
121
|
+
/** Send a reply through email, SMS, or LinkedIn. */
|
|
122
|
+
send(replyId: string, payload: InboxSendParams): Promise<InboxSendResult>;
|
|
123
|
+
};
|