@graph8/sdk 0.5.1 → 0.7.1

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/react.d.mts CHANGED
@@ -2,6 +2,314 @@ import * as _jitsu_js from '@jitsu/js';
2
2
  import * as react_jsx_runtime from 'react/jsx-runtime';
3
3
  import { ReactNode } from 'react';
4
4
 
5
+ interface Snippet {
6
+ write_key: string;
7
+ tracking_host: string;
8
+ domains: string[];
9
+ /** Ready-to-use React component import for @graph8/nextjs. */
10
+ react_snippet: string;
11
+ /** Vanilla JS script tag for non-React apps. */
12
+ script_tag: string;
13
+ /** Full configuration object (gtm/config.json). */
14
+ config: Record<string, unknown>;
15
+ }
16
+ /**
17
+ * Snippet API — fetch your org's graph8 tracking snippet programmatically, to
18
+ * embed the tracker into an app or a customer's site (the write key, a React
19
+ * component, a vanilla `<script>` tag, allowed domains, and the full config).
20
+ * Requires an API key (server-side). Built on the hardened HTTP core, so it
21
+ * throws a typed `G8Error` on failure and retries transient errors.
22
+ *
23
+ * Backed by `GET /api/v1/snippet`.
24
+ */
25
+ declare const createSnippetClient: (apiKey: string, apiUrl?: string) => {
26
+ /** Get your org's tracking snippet (write key + React/script-tag embeds + config). */
27
+ get(): Promise<Snippet>;
28
+ };
29
+
30
+ interface MarketplaceProfile {
31
+ id: string;
32
+ email: string;
33
+ first_name?: string | null;
34
+ last_name?: string | null;
35
+ marketplace_role?: string | null;
36
+ country_code?: string | null;
37
+ monthly_rate_usd?: string | null;
38
+ per_meeting_rate_usd?: string | null;
39
+ availability_status?: string | null;
40
+ bio?: string | null;
41
+ is_complete: boolean;
42
+ }
43
+ interface MarketplaceOffer {
44
+ id: string;
45
+ org_id: string;
46
+ org_name?: string | null;
47
+ sdr_id: string;
48
+ status: string;
49
+ monthly_rate_usd?: string | null;
50
+ per_meeting_rate_usd?: string | null;
51
+ created_at?: string | null;
52
+ }
53
+ interface MarketplaceHiring {
54
+ id: string;
55
+ org_id: string;
56
+ sdr_id: string;
57
+ status: string;
58
+ sdr_name?: string | null;
59
+ sdr_role?: string | null;
60
+ sdr_email?: string | null;
61
+ monthly_rate_usd?: string | null;
62
+ per_meeting_rate_usd?: string | null;
63
+ started_at?: string | null;
64
+ }
65
+ /**
66
+ * Marketplace API — for SDR/AE talent on the graph8 marketplace. View your
67
+ * profile, see pending hire offers and respond to them, and list your active
68
+ * hirings. Requires a personal API key (server-side). Built on the hardened
69
+ * HTTP core, so every method throws a typed `G8Error` on failure and retries
70
+ * transient errors.
71
+ *
72
+ * Backed by `/api/v1/marketplace`.
73
+ */
74
+ declare const createMarketplaceClient: (apiKey: string, apiUrl?: string) => {
75
+ /** Your own marketplace SDR profile. */
76
+ profile(): Promise<MarketplaceProfile>;
77
+ /** Pending hire offers you can accept or reject. */
78
+ offers(): Promise<{
79
+ offers: MarketplaceOffer[];
80
+ count: number;
81
+ }>;
82
+ /** Accept a pending hire offer (by hiring id). */
83
+ acceptOffer(hiringId: string): Promise<Record<string, unknown>>;
84
+ /** Reject a pending hire offer (by hiring id). */
85
+ rejectOffer(hiringId: string): Promise<Record<string, unknown>>;
86
+ /** Your active hiring contracts. */
87
+ hirings(): Promise<{
88
+ hirings: MarketplaceHiring[];
89
+ count: number;
90
+ }>;
91
+ };
92
+
93
+ interface AgencyInfo {
94
+ agency_org_id: string;
95
+ agency_org_name: string | null;
96
+ is_agency: boolean;
97
+ client_count: number;
98
+ /** Request header to set when operating a client org (e.g. "X-Target-Org-Id"). */
99
+ target_header: string;
100
+ }
101
+ interface AgencyClient {
102
+ /** Pass this as the `X-Target-Org-Id` header to operate this client org. */
103
+ org_id: string;
104
+ }
105
+ /**
106
+ * Agency API — for agency-scoped API keys (minted with `is_agency: true`).
107
+ * Discover the agency credential and the client orgs it may operate. To act on a
108
+ * client org, set the `X-Target-Org-Id` header (see `target_header`) to that
109
+ * client's `org_id` on your subsequent requests. Requires an agency API key
110
+ * (server-side); a non-agency key gets a `403`.
111
+ *
112
+ * Built on the hardened HTTP core (typed `G8Error` + retries). Backed by
113
+ * `/api/v1/agency`.
114
+ */
115
+ declare const createAgencyClient: (apiKey: string, apiUrl?: string) => {
116
+ /** Describe the agency credential: agency org + authorized client count. */
117
+ me(): Promise<AgencyInfo>;
118
+ /** List the client orgs this agency key may target via `X-Target-Org-Id`. */
119
+ clients(): Promise<{
120
+ data: AgencyClient[];
121
+ }>;
122
+ };
123
+
124
+ /** Filter operators supported by open-data search. */
125
+ type SearchOperator = "any_of" | "contains" | "all_of" | "none_of" | "is_empty" | "is_not_empty" | "between" | "exists";
126
+ /** A single search filter condition (named to avoid colliding with enrich's `SearchFilter`). */
127
+ interface SearchCondition {
128
+ /** Field to filter on, e.g. "job_title", "country", "industry". */
129
+ field: string;
130
+ operator: SearchOperator;
131
+ /** Filter values (operator-dependent; e.g. `["VP", "Director"]` for any_of). */
132
+ value?: unknown[];
133
+ }
134
+ interface SearchParams {
135
+ /** Filter conditions, combined with AND. */
136
+ filters?: SearchCondition[];
137
+ /** Page number, 1-indexed (1-100). */
138
+ page?: number;
139
+ /** Results per page (1-100, default 25). */
140
+ limit?: number;
141
+ }
142
+ interface SearchSaveParams extends SearchParams {
143
+ /** Title for the new list the matched records are saved into. */
144
+ list_title: string;
145
+ /** Max records to save (1-10,000, default 1,000). */
146
+ max_results?: number;
147
+ }
148
+ interface SearchContactItem {
149
+ first_name?: string | null;
150
+ last_name?: string | null;
151
+ middle_name?: string | null;
152
+ work_email?: string | null;
153
+ personal_emails?: string | null;
154
+ direct_phone?: string | null;
155
+ mobile_phone?: string | null;
156
+ job_title?: string | null;
157
+ job_department?: string | null;
158
+ seniority_level?: string | null;
159
+ role?: string | null;
160
+ linkedin_url?: string | null;
161
+ linkedin_headline?: string | null;
162
+ city?: string | null;
163
+ state?: string | null;
164
+ country?: string | null;
165
+ company_name?: string | null;
166
+ company_domain?: string | null;
167
+ company_industry?: string | null;
168
+ company_employee_count?: string | null;
169
+ company_country?: string | null;
170
+ confidence_score?: number | null;
171
+ }
172
+ interface SearchCompanyItem {
173
+ name?: string | null;
174
+ domain?: string | null;
175
+ website?: string | null;
176
+ description?: string | null;
177
+ industry?: string | null;
178
+ industry_group?: string | null;
179
+ employee_count?: string | null;
180
+ revenue?: string | null;
181
+ founded_year?: number | null;
182
+ phone?: string | null;
183
+ address?: string | null;
184
+ city?: string | null;
185
+ state?: string | null;
186
+ country?: string | null;
187
+ zip?: number | null;
188
+ linkedin_url?: string | null;
189
+ linkedin_followers?: string | null;
190
+ facebook_url?: string | null;
191
+ twitter_url?: string | null;
192
+ crunchbase_url?: string | null;
193
+ logo_url?: string | null;
194
+ }
195
+ interface SearchSaveResult {
196
+ list_id: number;
197
+ list_title: string;
198
+ estimated_total: number;
199
+ status: string;
200
+ }
201
+ /**
202
+ * Search API — prospect the open-data graph for new contacts and companies by
203
+ * filter, and optionally save the matches straight into a list. Requires API
204
+ * key (server-side). Built on the hardened HTTP core, so every method throws a
205
+ * typed `G8Error` on failure and retries transient errors.
206
+ *
207
+ * Backed by `/api/v1/search`.
208
+ */
209
+ declare const createSearchClient: (apiKey: string, apiUrl?: string) => {
210
+ /** Search open-data contacts by filter. */
211
+ contacts(params?: SearchParams): Promise<{
212
+ data: SearchContactItem[];
213
+ }>;
214
+ /** Search open-data companies by filter. */
215
+ companies(params?: SearchParams): Promise<{
216
+ data: SearchCompanyItem[];
217
+ }>;
218
+ /** Search contacts and save the matches into a new list. */
219
+ saveContacts(params: SearchSaveParams): Promise<SearchSaveResult>;
220
+ /** Search companies and save the matches into a new list. */
221
+ saveCompanies(params: SearchSaveParams): Promise<SearchSaveResult>;
222
+ };
223
+
224
+ /** Ad platform an audience can sync to. */
225
+ type AudienceSyncPlatform = "meta" | "linkedin" | "google" | "x";
226
+ /** Sync mode: full mirror, or only ever add members. */
227
+ type AudienceSyncMode = "mirror" | "append_only";
228
+ interface AudienceSync {
229
+ id: number;
230
+ audience_id: number;
231
+ platform: string;
232
+ platform_audience_name: string | null;
233
+ mode: string;
234
+ refresh_cadence_hours: number;
235
+ is_active: boolean;
236
+ status: string | null;
237
+ last_sync_at: string | null;
238
+ created_at: string | null;
239
+ }
240
+ interface AudienceSyncCreateParams {
241
+ /** Audience list ID to sync. */
242
+ audience_id: number;
243
+ platform: AudienceSyncPlatform;
244
+ platform_audience_name?: string;
245
+ /** Default "mirror". */
246
+ mode?: AudienceSyncMode;
247
+ /** Refresh cadence in hours (0-720; default 24). */
248
+ refresh_cadence_hours?: number;
249
+ /** Platform-specific config (OAuth creds, ad-account ids, etc.). */
250
+ platform_config?: Record<string, unknown>;
251
+ /** Audience list IDs whose members should be suppressed from the sync. */
252
+ suppression_list_ids?: number[];
253
+ }
254
+ interface AudienceSyncUpdateParams {
255
+ mode?: AudienceSyncMode;
256
+ refresh_cadence_hours?: number;
257
+ is_active?: boolean;
258
+ suppression_list_ids?: number[];
259
+ }
260
+ interface AudienceSyncRun {
261
+ id: number;
262
+ started_at: string | null;
263
+ finished_at: string | null;
264
+ status: string | null;
265
+ members_added: number | null;
266
+ members_removed: number | null;
267
+ total_members: number | null;
268
+ error_message: string | null;
269
+ }
270
+ interface AudienceSyncError {
271
+ id: number;
272
+ started_at: string | null;
273
+ error_message: string | null;
274
+ details: Record<string, unknown> | null;
275
+ }
276
+ /**
277
+ * Audiences API — sync an audience list to ad platforms (Meta, LinkedIn,
278
+ * Google, X). Requires API key (server-side). Built on the hardened HTTP core,
279
+ * so every method throws a typed `G8Error` on failure and retries transient
280
+ * 429/5xx/network errors.
281
+ *
282
+ * Backed by `/api/v1/audience-syncs`.
283
+ */
284
+ declare const createAudiencesClient: (apiKey: string, apiUrl?: string) => {
285
+ /** List all audience syncs for the organization. */
286
+ list(): Promise<{
287
+ data: AudienceSync[];
288
+ }>;
289
+ /** Create a new audience sync to an ad platform. */
290
+ create(params: AudienceSyncCreateParams): Promise<AudienceSync>;
291
+ /** Get a single audience sync by ID. */
292
+ get(configId: number): Promise<AudienceSync>;
293
+ /** Update an audience sync (partial). */
294
+ update(configId: number, fields: AudienceSyncUpdateParams): Promise<AudienceSync>;
295
+ /** Delete an audience sync. */
296
+ delete(configId: number): Promise<{
297
+ data: Record<string, unknown>;
298
+ }>;
299
+ /** Trigger an immediate sync run for a config. */
300
+ trigger(configId: number): Promise<{
301
+ data: Record<string, unknown>;
302
+ }>;
303
+ /** List recent sync runs for a config (most recent first). */
304
+ runs(configId: number): Promise<{
305
+ data: AudienceSyncRun[];
306
+ }>;
307
+ /** List recent sync errors for a config. */
308
+ errors(configId: number): Promise<{
309
+ data: AudienceSyncError[];
310
+ }>;
311
+ };
312
+
5
313
  interface MeetingAttendee {
6
314
  name: string | null;
7
315
  email: string;
@@ -135,10 +443,13 @@ interface ResearchReport {
135
443
  * GET /api/v1/research-reports
136
444
  */
137
445
  declare const createStudioClient: (apiKey: string, apiUrl?: string) => {
138
- /** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.). */
446
+ /** Org-level Studio documents (brand_brief, value_props, messaging_house, etc.).
447
+ * `include_content` defaults to true server-side, so each document includes
448
+ * its `content` body unless you explicitly pass `include_content: false`. */
139
449
  globalContext(params?: {
140
450
  category?: string;
141
451
  limit?: number;
452
+ include_content?: boolean;
142
453
  }): Promise<{
143
454
  data: GlobalContextDocument[];
144
455
  }>;
@@ -584,7 +895,8 @@ interface WorkflowListParams {
584
895
  }
585
896
  /**
586
897
  * Workflows API - automation workflows with nodes, connections, and execution lifecycle.
587
- * Requires API key (server-side).
898
+ * Requires API key (server-side). On the hardened HTTP core: throws a typed
899
+ * `G8Error` on failure and retries transient errors.
588
900
  *
589
901
  * The graph8 workflow surface treats the whole workflow definition as a single
590
902
  * record updated via `update()` — there are no per-node CRUD endpoints. To edit
@@ -649,9 +961,9 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
649
961
  }>;
650
962
  /** Execute a workflow immediately with a trigger payload. */
651
963
  execute(workflowId: string, triggerPayload?: Record<string, unknown>): Promise<WorkflowExecution>;
652
- /** Get the status + output of a workflow execution. */
964
+ /** Get the status + outputs of a single execution. */
653
965
  getExecution(executionId: string): Promise<WorkflowExecution>;
654
- /** Pause an in-flight execution. */
966
+ /** Pause a running execution. */
655
967
  pauseExecution(executionId: string): Promise<{
656
968
  data: {
657
969
  paused: boolean;
@@ -663,34 +975,32 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
663
975
  resumed: boolean;
664
976
  };
665
977
  }>;
666
- /** Stop an execution (terminal state — cannot resume). */
978
+ /** Stop an execution. */
667
979
  stopExecution(executionId: string): Promise<{
668
980
  data: {
669
981
  stopped: boolean;
670
982
  };
671
983
  }>;
672
- /** Get the status of a workflow's external trigger (e.g. "waiting for webhook"). */
984
+ /** Get the trigger status (e.g. schedule / webhook wiring) for a workflow. */
673
985
  getTriggerStatus(workflowId: string): Promise<{
674
986
  data: {
675
987
  status: string;
676
988
  details: Record<string, unknown>;
677
989
  };
678
990
  }>;
679
- /** Reset the trigger cursor (e.g. for event-stream triggers — resume from beginning). */
991
+ /** Reset a workflow's trigger cursor / state. */
680
992
  resetTrigger(workflowId: string): Promise<{
681
993
  data: {
682
994
  reset: boolean;
683
995
  };
684
996
  }>;
685
- /**
686
- * List available node types with schemas. Pass a `type` param to fetch one type's full schema.
687
- */
997
+ /** Catalog of available workflow node types with config + output schemas. */
688
998
  nodeTypes(params?: {
689
999
  type?: string;
690
1000
  }): Promise<{
691
1001
  data: NodeTypeSchema[];
692
1002
  }>;
693
- /** Slack workspace users (for Slack action recipients). */
1003
+ /** Slack users available to workflow nodes. */
694
1004
  listSlackUsers(): Promise<{
695
1005
  data: Array<{
696
1006
  id: string;
@@ -698,7 +1008,7 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
698
1008
  email: string | null;
699
1009
  }>;
700
1010
  }>;
701
- /** Slack channels. */
1011
+ /** Slack channels available to workflow nodes. */
702
1012
  listSlackChannels(): Promise<{
703
1013
  data: Array<{
704
1014
  id: string;
@@ -706,7 +1016,7 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
706
1016
  is_private: boolean;
707
1017
  }>;
708
1018
  }>;
709
- /** Roam (Copilot chat) users. */
1019
+ /** Roam users available to workflow nodes. */
710
1020
  listRoamUsers(): Promise<{
711
1021
  data: Array<{
712
1022
  id: string;
@@ -714,14 +1024,14 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
714
1024
  email: string | null;
715
1025
  }>;
716
1026
  }>;
717
- /** Roam (Copilot chat) groups. */
1027
+ /** Roam groups available to workflow nodes. */
718
1028
  listRoamGroups(): Promise<{
719
1029
  data: Array<{
720
1030
  id: string;
721
1031
  name: string;
722
1032
  }>;
723
1033
  }>;
724
- /** Available MCP servers (for Agent-node integrations). */
1034
+ /** MCP servers available to workflow nodes. */
725
1035
  listMcpServers(): Promise<{
726
1036
  data: Array<{
727
1037
  id: string;
@@ -729,14 +1039,14 @@ declare const createWorkflowsClient: (apiKey: string, apiUrl?: string) => {
729
1039
  url: string;
730
1040
  }>;
731
1041
  }>;
732
- /** Available call dispositions (voice workflow nodes). */
1042
+ /** Disposition options available to workflow nodes. */
733
1043
  listDispositions(): Promise<{
734
1044
  data: Array<{
735
1045
  id: string;
736
1046
  label: string;
737
1047
  }>;
738
1048
  }>;
739
- /** Form field schema for form-trigger nodes. */
1049
+ /** Form field definitions for a given form (used by form-trigger nodes). */
740
1050
  listFormFields(formId: string): Promise<{
741
1051
  data: Array<{
742
1052
  name: string;
@@ -819,7 +1129,8 @@ interface PipelineSuggestion {
819
1129
  }
820
1130
  /**
821
1131
  * Stage Checklist Pipelines API - workflow pipelines with evidence + scripts.
822
- * Requires API key (server-side).
1132
+ * Requires API key (server-side). On the hardened HTTP core: throws a typed
1133
+ * `G8Error` on failure and retries transient errors.
823
1134
  *
824
1135
  * Backed by:
825
1136
  * GET /api/v1/pipelines
@@ -962,7 +1273,9 @@ interface PaginationMeta$2 {
962
1273
  has_next: boolean;
963
1274
  }
964
1275
  /**
965
- * Quotes API - quote-to-cash lifecycle. Requires API key (server-side).
1276
+ * Quotes API - quote-to-cash lifecycle. Requires API key (server-side). On the
1277
+ * hardened HTTP core: throws a typed `G8Error` on failure and retries transient
1278
+ * errors.
966
1279
  *
967
1280
  * Backed by:
968
1281
  * GET /api/v1/quotes
@@ -1115,7 +1428,9 @@ interface InboxSendResult {
1115
1428
  }
1116
1429
  /**
1117
1430
  * Inbox API — read + reply to multi-channel inbox threads (email, SMS, LinkedIn/HeyReach).
1118
- * Requires API key (server-side).
1431
+ * Requires API key (server-side). On the hardened HTTP core: throws a typed
1432
+ * `G8Error` on failure (e.g. 402 when an AI draft exceeds your credit balance)
1433
+ * and retries transient errors.
1119
1434
  *
1120
1435
  * Backed by:
1121
1436
  * GET /api/v1/inbox
@@ -1322,7 +1637,8 @@ interface SetFieldValueParams {
1322
1637
  }
1323
1638
  /**
1324
1639
  * Fields API - manage custom fields (columns) on contacts and companies.
1325
- * Requires API key (server-side).
1640
+ * Requires API key (server-side). On the hardened HTTP core: throws a typed
1641
+ * `G8Error` on failure and retries transient errors.
1326
1642
  *
1327
1643
  * Backed by:
1328
1644
  * GET /api/v1/fields — list contact fields
@@ -1716,8 +2032,11 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
1716
2032
  }>;
1717
2033
  /** Get a single contact by ID. */
1718
2034
  get(contactId: number): Promise<Contact>;
1719
- /** Create a new contact. */
1720
- create(contact: ContactCreateParams): Promise<Contact>;
2035
+ /**
2036
+ * Create a new contact. Pass `idempotencyKey` to make a retry safe — the
2037
+ * same key returns the first result instead of creating a duplicate (A6).
2038
+ */
2039
+ create(contact: ContactCreateParams, idempotencyKey?: string): Promise<Contact>;
1721
2040
  /** Update a contact (partial). */
1722
2041
  update(contactId: number, fields: ContactUpdateParams): Promise<{
1723
2042
  updated: number;
@@ -1734,18 +2053,44 @@ declare const createContactsClient: (apiKey: string, apiUrl?: string) => {
1734
2053
  createColumn(params: ContactColumnCreateParams): Promise<ContactColumn>;
1735
2054
  };
1736
2055
 
1737
- type WebhookEvent = "reply_received" | "meeting_booked" | "contact_enriched" | "contact_created" | "sequence_completed" | "sequence_replied" | "campaign_launched" | "form_submitted" | "visitor_identified";
1738
- type WebhookCallback = (data: Record<string, unknown>) => void;
1739
2056
  /**
1740
- * Webhooks - listen for graph8 events. Requires API key (server-side).
2057
+ * Known graph8 webhook event types.
1741
2058
  *
1742
- * For client-side real-time events, use g8.visitors.onIntent() or g8.chat.on() instead.
2059
+ * Source of truth is the backend ``WEBHOOK_EVENTS`` catalog
2060
+ * (campaign_builder/services/webhook_service.py). Keep in sync when the backend
2061
+ * adds events. ``WebhookEvent`` also accepts any string so a newly-added
2062
+ * backend event never breaks a client that hasn't upgraded.
1743
2063
  */
1744
- declare const createWebhooksClient: (apiKey: string, apiUrl?: string) => {
1745
- /** Register a listener for a webhook event. Starts polling automatically. */
1746
- on(event: WebhookEvent, callback: WebhookCallback): void;
1747
- /** Stop all webhook polling. */
1748
- stop(): void;
2064
+ declare const KNOWN_WEBHOOK_EVENTS: readonly ["campaign.created", "campaign.updated", "campaign.deleted", "campaign.launched", "campaign.paused", "campaign.completed", "campaign.status_changed", "campaign.content_ready", "document.generated", "document.failed", "intelligence.completed", "intelligence.failed", "company.enriched", "company_intelligence.completed", "audience.ready", "audience.failed", "sequence.deployed", "sequence.started", "sequence.paused", "sequence.completed", "engagement.email_sent", "engagement.email_replied", "engagement.email_bounced", "engagement.email_skipped", "engagement.call_dispatched", "engagement.sms_sent", "engagement.sms_replied", "engagement.whatsapp_sent", "engagement.linkedin_connection_sent", "engagement.linkedin_message_sent", "engagement.linkedin_inmail_sent", "engagement.linkedin_reply_received", "engagement.linkedin_connection_accepted", "meeting.booked", "meeting.cancelled", "meeting.rescheduled"];
2065
+ type WebhookEvent = (typeof KNOWN_WEBHOOK_EVENTS)[number] | (string & {});
2066
+ /** The decoded body graph8 delivers to a webhook endpoint. */
2067
+ interface WebhookEventPayload {
2068
+ event: WebhookEvent;
2069
+ timestamp: string;
2070
+ data: Record<string, unknown>;
2071
+ org_id: string;
2072
+ /** Stable per-delivery id (present once the backend adds it; for consumer dedup). */
2073
+ id?: string;
2074
+ }
2075
+ interface ConstructEventOptions {
2076
+ /**
2077
+ * Reject events whose ``X-Studio-Timestamp`` is older (or newer) than this
2078
+ * many seconds — replay protection. Disabled when 0/undefined.
2079
+ */
2080
+ toleranceSeconds?: number;
2081
+ }
2082
+ /**
2083
+ * Webhooks client (server-side). graph8 webhooks are PUSH — graph8 POSTs to your
2084
+ * endpoint; you verify each delivery with {@link constructEvent}. (The previous
2085
+ * polling implementation hit a feed endpoint that never existed and is removed.)
2086
+ */
2087
+ declare const createWebhooksClient: (_apiKey: string, apiUrl?: string) => {
2088
+ /** Base URL the webhook subscription API lives under. */
2089
+ baseUrl: string;
2090
+ /** Known event types (for autocomplete / validation). */
2091
+ knownEvents: readonly ["campaign.created", "campaign.updated", "campaign.deleted", "campaign.launched", "campaign.paused", "campaign.completed", "campaign.status_changed", "campaign.content_ready", "document.generated", "document.failed", "intelligence.completed", "intelligence.failed", "company.enriched", "company_intelligence.completed", "audience.ready", "audience.failed", "sequence.deployed", "sequence.started", "sequence.paused", "sequence.completed", "engagement.email_sent", "engagement.email_replied", "engagement.email_bounced", "engagement.email_skipped", "engagement.call_dispatched", "engagement.sms_sent", "engagement.sms_replied", "engagement.whatsapp_sent", "engagement.linkedin_connection_sent", "engagement.linkedin_message_sent", "engagement.linkedin_inmail_sent", "engagement.linkedin_reply_received", "engagement.linkedin_connection_accepted", "meeting.booked", "meeting.cancelled", "meeting.rescheduled"];
2092
+ /** Verify an incoming webhook's HMAC signature and return the parsed event. */
2093
+ constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
1749
2094
  };
1750
2095
 
1751
2096
  interface LandingPage {
@@ -1756,7 +2101,9 @@ interface LandingPage {
1756
2101
  published_url: string | null;
1757
2102
  }
1758
2103
  /**
1759
- * Landing pages - clone, create, publish. Requires API key (server-side).
2104
+ * Landing pages - clone, create, publish. Requires API key (server-side). On the
2105
+ * hardened HTTP core: throws a typed `G8Error` on failure and retries transient
2106
+ * errors.
1760
2107
  */
1761
2108
  declare const createPagesClient: (apiKey: string, apiUrl?: string) => {
1762
2109
  /** Clone a landing page from any URL. */
@@ -2114,6 +2461,12 @@ interface AnalyticsOverview {
2114
2461
  }
2115
2462
  /**
2116
2463
  * Analytics - dashboard data and metrics. Requires API key (server-side).
2464
+ *
2465
+ * On the hardened HTTP core: throws a typed `G8Error` on failure and retries
2466
+ * transient errors. Note the deliberate behavior change vs the preview client —
2467
+ * a non-2xx response now **throws** instead of silently returning an all-zeros
2468
+ * overview, so callers can distinguish genuinely-zero activity from an auth/5xx
2469
+ * failure.
2117
2470
  */
2118
2471
  declare const createAnalyticsClient: (apiKey: string, apiUrl?: string) => {
2119
2472
  overview(config?: {
@@ -2146,7 +2499,9 @@ interface Integration {
2146
2499
  connected_at: string | null;
2147
2500
  }
2148
2501
  /**
2149
- * Integrations - connect CRM platforms, trigger syncs. Requires API key (server-side).
2502
+ * Integrations - connect CRM platforms, trigger syncs. Requires API key
2503
+ * (server-side). On the hardened HTTP core: throws a typed `G8Error` on failure
2504
+ * and retries transient errors.
2150
2505
  */
2151
2506
  declare const createIntegrationsClient: (apiKey: string, apiUrl?: string) => {
2152
2507
  list(): Promise<Integration[]>;
@@ -2182,6 +2537,8 @@ interface CampaignStats {
2182
2537
  }
2183
2538
  /**
2184
2539
  * Campaigns - create, manage, launch campaigns. Requires API key (server-side).
2540
+ * On the hardened HTTP core: throws a typed `G8Error` on failure and retries
2541
+ * transient errors.
2185
2542
  */
2186
2543
  declare const createCampaignsClient: (apiKey: string, apiUrl?: string) => {
2187
2544
  list(page?: number, limit?: number): Promise<Campaign[]>;
@@ -2213,6 +2570,8 @@ interface SequenceListParams {
2213
2570
  limit?: number;
2214
2571
  /** Filter by sequence status (e.g. "live", "draft", "paused"). */
2215
2572
  status?: string;
2573
+ /** Filter by sequence kind ("cold_outbound" or "nurture"). Omit to list all kinds. */
2574
+ sequence_kind?: SequenceKind;
2216
2575
  }
2217
2576
  interface SequenceDetail {
2218
2577
  id: string;
@@ -2226,6 +2585,10 @@ interface SequenceDetail {
2226
2585
  wait_for_new_contacts: boolean;
2227
2586
  paused_at: string | null;
2228
2587
  resumed_at: string | null;
2588
+ /** Sequence kind. Immutable after creation. "cold_outbound" (default) or "nurture". */
2589
+ sequence_kind?: string | null;
2590
+ /** Pinned mailbox for nurture sequences; null for cold_outbound. Immutable. */
2591
+ pinned_mailbox_id?: number | null;
2229
2592
  created_at: string | null;
2230
2593
  updated_at: string | null;
2231
2594
  }
@@ -2270,6 +2633,13 @@ interface SequenceChannelConfig {
2270
2633
  channel_type: string;
2271
2634
  channel_data?: Record<string, unknown>;
2272
2635
  }
2636
+ /**
2637
+ * Sequence kind. A "nurture" is an ordinary sequence with `sequence_kind:
2638
+ * "nurture"` — same step types as cold outreach, but pinned to a single mailbox
2639
+ * with a higher daily email cap. There is no separate nurture client; create one
2640
+ * via `sequences.create({ sequence_kind: "nurture", pinned_mailbox_id })`.
2641
+ */
2642
+ type SequenceKind = "cold_outbound" | "nurture";
2273
2643
  interface SequenceCreateParams {
2274
2644
  name: string;
2275
2645
  user_email: string;
@@ -2281,6 +2651,18 @@ interface SequenceCreateParams {
2281
2651
  steps?: SequenceStepConfig[];
2282
2652
  channels?: SequenceChannelConfig[];
2283
2653
  campaign_id?: string;
2654
+ /**
2655
+ * Sequence kind. Defaults to "cold_outbound" server-side. Immutable after
2656
+ * creation. "nurture" requires `pinned_mailbox_id` and is gated by the
2657
+ * ENABLE_NURTURE feature flag.
2658
+ */
2659
+ sequence_kind?: SequenceKind;
2660
+ /**
2661
+ * Mailbox to pin for a nurture sequence. Required when
2662
+ * `sequence_kind: "nurture"`; all email channels must use this mailbox.
2663
+ * Ignored for cold_outbound sequences.
2664
+ */
2665
+ pinned_mailbox_id?: number;
2284
2666
  }
2285
2667
  interface SequenceCreateResult {
2286
2668
  id: string;
@@ -2426,7 +2808,8 @@ interface SearchResults {
2426
2808
  /**
2427
2809
  * Enrichment API - person/company lookup, email verification, prospecting search.
2428
2810
  *
2429
- * Requires API key (server-side only). Credits charged per call.
2811
+ * Requires API key (server-side only). Credits charged per call. On the hardened
2812
+ * HTTP core: throws a typed `G8Error` on failure and retries transient errors.
2430
2813
  */
2431
2814
  declare const createEnrichClient: (apiKey: string, apiUrl?: string) => {
2432
2815
  /** Look up a person by email, LinkedIn, or name + company. Costs 1 credit. */
@@ -2733,6 +3116,11 @@ declare const useG8: () => {
2733
3116
  _intent: ReturnType<typeof createIntentClient> | null;
2734
3117
  _studio: ReturnType<typeof createStudioClient> | null;
2735
3118
  _meetings: ReturnType<typeof createMeetingsClient> | null;
3119
+ _audiences: ReturnType<typeof createAudiencesClient> | null;
3120
+ _search: ReturnType<typeof createSearchClient> | null;
3121
+ _agency: ReturnType<typeof createAgencyClient> | null;
3122
+ _marketplace: ReturnType<typeof createMarketplaceClient> | null;
3123
+ _snippet: ReturnType<typeof createSnippetClient> | null;
2736
3124
  init(config: G8Config): void;
2737
3125
  track(event: string, properties?: TrackProperties): void;
2738
3126
  identify(userId: string, properties?: IdentifyProperties): void;
@@ -2897,8 +3285,9 @@ declare const useG8: () => {
2897
3285
  }>;
2898
3286
  };
2899
3287
  get webhooks(): {
2900
- on(event: WebhookEvent, callback: (data: Record<string, unknown>) => void): void;
2901
- stop(): void;
3288
+ baseUrl: string;
3289
+ knownEvents: readonly ["campaign.created", "campaign.updated", "campaign.deleted", "campaign.launched", "campaign.paused", "campaign.completed", "campaign.status_changed", "campaign.content_ready", "document.generated", "document.failed", "intelligence.completed", "intelligence.failed", "company.enriched", "company_intelligence.completed", "audience.ready", "audience.failed", "sequence.deployed", "sequence.started", "sequence.paused", "sequence.completed", "engagement.email_sent", "engagement.email_replied", "engagement.email_bounced", "engagement.email_skipped", "engagement.call_dispatched", "engagement.sms_sent", "engagement.sms_replied", "engagement.whatsapp_sent", "engagement.linkedin_connection_sent", "engagement.linkedin_message_sent", "engagement.linkedin_inmail_sent", "engagement.linkedin_reply_received", "engagement.linkedin_connection_accepted", "meeting.booked", "meeting.cancelled", "meeting.rescheduled"];
3290
+ constructEvent(payload: string, signature: string, timestamp: string | number, secret: string, opts?: ConstructEventOptions): WebhookEventPayload;
2902
3291
  };
2903
3292
  get contacts(): {
2904
3293
  list(params?: ContactListParams): Promise<{
@@ -2906,7 +3295,7 @@ declare const useG8: () => {
2906
3295
  total: number;
2907
3296
  }>;
2908
3297
  get(contactId: number): Promise<Contact>;
2909
- create(contact: ContactCreateParams): Promise<Contact>;
3298
+ create(contact: ContactCreateParams, idempotencyKey?: string): Promise<Contact>;
2910
3299
  update(contactId: number, fields: ContactUpdateParams): Promise<{
2911
3300
  updated: number;
2912
3301
  }>;
@@ -3346,6 +3735,7 @@ declare const useG8: () => {
3346
3735
  globalContext(params?: {
3347
3736
  category?: string;
3348
3737
  limit?: number;
3738
+ include_content?: boolean;
3349
3739
  }): Promise<{
3350
3740
  data: GlobalContextDocument[];
3351
3741
  }>;
@@ -3386,6 +3776,58 @@ declare const useG8: () => {
3386
3776
  }>;
3387
3777
  get(meetingId: string): Promise<MeetingDetail>;
3388
3778
  };
3779
+ get audiences(): {
3780
+ list(): Promise<{
3781
+ data: AudienceSync[];
3782
+ }>;
3783
+ create(params: AudienceSyncCreateParams): Promise<AudienceSync>;
3784
+ get(configId: number): Promise<AudienceSync>;
3785
+ update(configId: number, fields: AudienceSyncUpdateParams): Promise<AudienceSync>;
3786
+ delete(configId: number): Promise<{
3787
+ data: Record<string, unknown>;
3788
+ }>;
3789
+ trigger(configId: number): Promise<{
3790
+ data: Record<string, unknown>;
3791
+ }>;
3792
+ runs(configId: number): Promise<{
3793
+ data: AudienceSyncRun[];
3794
+ }>;
3795
+ errors(configId: number): Promise<{
3796
+ data: AudienceSyncError[];
3797
+ }>;
3798
+ };
3799
+ get search(): {
3800
+ contacts(params?: SearchParams): Promise<{
3801
+ data: SearchContactItem[];
3802
+ }>;
3803
+ companies(params?: SearchParams): Promise<{
3804
+ data: SearchCompanyItem[];
3805
+ }>;
3806
+ saveContacts(params: SearchSaveParams): Promise<SearchSaveResult>;
3807
+ saveCompanies(params: SearchSaveParams): Promise<SearchSaveResult>;
3808
+ };
3809
+ get agency(): {
3810
+ me(): Promise<AgencyInfo>;
3811
+ clients(): Promise<{
3812
+ data: AgencyClient[];
3813
+ }>;
3814
+ };
3815
+ get marketplace(): {
3816
+ profile(): Promise<MarketplaceProfile>;
3817
+ offers(): Promise<{
3818
+ offers: MarketplaceOffer[];
3819
+ count: number;
3820
+ }>;
3821
+ acceptOffer(hiringId: string): Promise<Record<string, unknown>>;
3822
+ rejectOffer(hiringId: string): Promise<Record<string, unknown>>;
3823
+ hirings(): Promise<{
3824
+ hirings: MarketplaceHiring[];
3825
+ count: number;
3826
+ }>;
3827
+ };
3828
+ get snippet(): {
3829
+ get(): Promise<Snippet>;
3830
+ };
3389
3831
  get initialized(): boolean;
3390
3832
  _assertInit(): void;
3391
3833
  _assertKey(module: string): void;