@atribu/node 0.1.4 → 0.3.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/CHANGELOG.md +65 -0
- package/README.md +153 -2
- package/dist/admin/index.cjs.map +1 -1
- package/dist/admin/index.d.cts +1 -1
- package/dist/admin/index.d.ts +1 -1
- package/dist/admin/index.js.map +1 -1
- package/dist/{api.d-BXINTQo6.d.cts → api.d-K2ywQhc9.d.cts} +1143 -0
- package/dist/{api.d-BXINTQo6.d.ts → api.d-K2ywQhc9.d.ts} +1143 -0
- package/dist/index.cjs +242 -2
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +167 -16
- package/dist/index.d.ts +167 -16
- package/dist/index.js +242 -2
- package/dist/index.js.map +1 -1
- package/dist/test/index.cjs +239 -0
- package/dist/test/index.cjs.map +1 -1
- package/dist/test/index.d.cts +563 -0
- package/dist/test/index.d.ts +563 -0
- package/dist/test/index.js +239 -0
- package/dist/test/index.js.map +1 -1
- package/package.json +1 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpClientLike, p as paths, R as RequestOptions } from './api.d-
|
|
1
|
+
import { H as HttpClientLike, p as paths, R as RequestOptions } from './api.d-K2ywQhc9.cjs';
|
|
2
2
|
import { d as AtribuError } from './errors-BLELoojK.cjs';
|
|
3
3
|
export { A as ApiErrorBody, a as ApiErrorCode, b as AtribuApiError, c as AtribuConfigError, e as AtribuOauthError, f as AtribuTransportError, g as AtribuWebhookError, O as OauthErrorCode, R as RetryHint, W as WebhookErrorCode } from './errors-BLELoojK.cjs';
|
|
4
4
|
|
|
@@ -47,21 +47,46 @@ declare class CommentsResource {
|
|
|
47
47
|
privateReply(input: CommentPrivateReplyInput, opts?: CommentReplyOptions): Promise<CommentReplyResponse>;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
type ListResponse = paths["/api/v1/
|
|
51
|
-
type
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
type ListResponse$4 = paths["/api/v1/connections"]["get"]["responses"][200]["content"]["application/json"];
|
|
51
|
+
type Connection = ListResponse$4["data"][number];
|
|
52
|
+
interface ListOptions$3 {
|
|
53
|
+
channel?: "whatsapp" | "instagram";
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}
|
|
56
|
+
interface MutationOptions$3 {
|
|
57
|
+
idempotencyKey?: string;
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
}
|
|
60
|
+
declare class ConnectionsResource {
|
|
61
|
+
private readonly http;
|
|
62
|
+
constructor(http: HttpClientLike);
|
|
63
|
+
list(opts?: ListOptions$3): Promise<Connection[]>;
|
|
64
|
+
get(id: string, opts?: {
|
|
65
|
+
signal?: AbortSignal;
|
|
66
|
+
}): Promise<Connection>;
|
|
67
|
+
/**
|
|
68
|
+
* Revoke this OAuth app's authorization for the connection. Does NOT
|
|
69
|
+
* disconnect the underlying data_connection (other consumers + the
|
|
70
|
+
* Atribu UI still see it). Direct admin keys reject this call with 400.
|
|
71
|
+
*/
|
|
72
|
+
revoke(id: string, opts?: MutationOptions$3): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type ListResponse$3 = paths["/api/v1/webhooks/subscriptions"]["get"]["responses"][200]["content"]["application/json"];
|
|
76
|
+
type CreateBody$3 = NonNullable<paths["/api/v1/webhooks/subscriptions"]["post"]["requestBody"]>["content"]["application/json"];
|
|
77
|
+
type CreateResponse$1 = paths["/api/v1/webhooks/subscriptions"]["post"]["responses"][201]["content"]["application/json"];
|
|
78
|
+
type UpdateBody$1 = NonNullable<paths["/api/v1/webhooks/subscriptions/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
|
|
54
79
|
type RotateBody = NonNullable<NonNullable<paths["/api/v1/webhooks/subscriptions/{id}/rotate-secret"]["post"]["requestBody"]>["content"]["application/json"]>;
|
|
55
80
|
type RotateResponse = paths["/api/v1/webhooks/subscriptions/{id}/rotate-secret"]["post"]["responses"][200]["content"]["application/json"];
|
|
56
81
|
type TestResponse = paths["/api/v1/webhooks/test/{id}"]["post"]["responses"][200]["content"]["application/json"];
|
|
57
|
-
type WebhookSubscription = ListResponse["data"][number];
|
|
58
|
-
type WebhookSubscriptionWithSecret = CreateResponse["data"];
|
|
59
|
-
type WebhookSubscriptionCreateInput = CreateBody;
|
|
60
|
-
type WebhookSubscriptionUpdateInput = UpdateBody;
|
|
82
|
+
type WebhookSubscription = ListResponse$3["data"][number];
|
|
83
|
+
type WebhookSubscriptionWithSecret = CreateResponse$1["data"];
|
|
84
|
+
type WebhookSubscriptionCreateInput = CreateBody$3;
|
|
85
|
+
type WebhookSubscriptionUpdateInput = UpdateBody$1;
|
|
61
86
|
type WebhookSubscriptionRotateOptions = RotateBody;
|
|
62
87
|
type WebhookSubscriptionRotateResult = RotateResponse["data"];
|
|
63
88
|
type WebhookSubscriptionTestResult = TestResponse["data"];
|
|
64
|
-
interface MutationOptions {
|
|
89
|
+
interface MutationOptions$2 {
|
|
65
90
|
idempotencyKey?: string;
|
|
66
91
|
signal?: AbortSignal;
|
|
67
92
|
}
|
|
@@ -71,11 +96,11 @@ declare class WebhookSubscriptionsResource {
|
|
|
71
96
|
list(opts?: {
|
|
72
97
|
signal?: AbortSignal;
|
|
73
98
|
}): Promise<WebhookSubscription[]>;
|
|
74
|
-
create(input: WebhookSubscriptionCreateInput, opts?: MutationOptions): Promise<WebhookSubscriptionWithSecret>;
|
|
75
|
-
update(id: string, input: WebhookSubscriptionUpdateInput, opts?: MutationOptions): Promise<WebhookSubscription>;
|
|
76
|
-
delete(id: string, opts?: MutationOptions): Promise<void>;
|
|
77
|
-
rotateSecret(id: string, options?: WebhookSubscriptionRotateOptions, opts?: MutationOptions): Promise<WebhookSubscriptionRotateResult>;
|
|
78
|
-
test(id: string, opts?: MutationOptions): Promise<WebhookSubscriptionTestResult>;
|
|
99
|
+
create(input: WebhookSubscriptionCreateInput, opts?: MutationOptions$2): Promise<WebhookSubscriptionWithSecret>;
|
|
100
|
+
update(id: string, input: WebhookSubscriptionUpdateInput, opts?: MutationOptions$2): Promise<WebhookSubscription>;
|
|
101
|
+
delete(id: string, opts?: MutationOptions$2): Promise<void>;
|
|
102
|
+
rotateSecret(id: string, options?: WebhookSubscriptionRotateOptions, opts?: MutationOptions$2): Promise<WebhookSubscriptionRotateResult>;
|
|
103
|
+
test(id: string, opts?: MutationOptions$2): Promise<WebhookSubscriptionTestResult>;
|
|
79
104
|
}
|
|
80
105
|
|
|
81
106
|
type ReplayResponse = paths["/api/v1/webhooks/deliveries/{id}/replay"]["post"]["responses"][200]["content"]["application/json"];
|
|
@@ -90,6 +115,126 @@ declare class WebhookDeliveriesResource {
|
|
|
90
115
|
replay(id: string, opts?: ReplayOptions): Promise<WebhookDeliveryReplayResult>;
|
|
91
116
|
}
|
|
92
117
|
|
|
118
|
+
type ListResponse$2 = paths["/api/v1/whatsapp/templates"]["get"]["responses"][200]["content"]["application/json"];
|
|
119
|
+
type CreateBody$2 = NonNullable<paths["/api/v1/whatsapp/templates"]["post"]["requestBody"]>["content"]["application/json"];
|
|
120
|
+
type CreateResponse = paths["/api/v1/whatsapp/templates"]["post"]["responses"][201]["content"]["application/json"];
|
|
121
|
+
type WhatsAppTemplate = ListResponse$2["data"][number];
|
|
122
|
+
type WhatsAppTemplateCreateInput = CreateBody$2;
|
|
123
|
+
type WhatsAppTemplateCreateResult = CreateResponse["data"];
|
|
124
|
+
interface ListOptions$2 {
|
|
125
|
+
connectionId: string;
|
|
126
|
+
signal?: AbortSignal;
|
|
127
|
+
}
|
|
128
|
+
interface DeleteOptions {
|
|
129
|
+
connectionId: string;
|
|
130
|
+
idempotencyKey?: string;
|
|
131
|
+
signal?: AbortSignal;
|
|
132
|
+
}
|
|
133
|
+
interface CreateOptions {
|
|
134
|
+
idempotencyKey?: string;
|
|
135
|
+
signal?: AbortSignal;
|
|
136
|
+
}
|
|
137
|
+
declare class WhatsAppTemplatesResource {
|
|
138
|
+
private readonly http;
|
|
139
|
+
constructor(http: HttpClientLike);
|
|
140
|
+
list(opts: ListOptions$2): Promise<WhatsAppTemplate[]>;
|
|
141
|
+
create(input: WhatsAppTemplateCreateInput, opts?: CreateOptions): Promise<WhatsAppTemplateCreateResult>;
|
|
142
|
+
delete(name: string, opts: DeleteOptions): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
type ListResponse$1 = paths["/api/v1/whatsapp/broadcasts"]["get"]["responses"][200]["content"]["application/json"];
|
|
146
|
+
type CreateBody$1 = NonNullable<paths["/api/v1/whatsapp/broadcasts"]["post"]["requestBody"]>["content"]["application/json"];
|
|
147
|
+
type GetResponse = paths["/api/v1/whatsapp/broadcasts/{id}"]["get"]["responses"][200]["content"]["application/json"];
|
|
148
|
+
type WhatsAppBroadcast = ListResponse$1["data"][number];
|
|
149
|
+
type WhatsAppBroadcastDetail = GetResponse["data"];
|
|
150
|
+
type WhatsAppBroadcastCreateInput = CreateBody$1;
|
|
151
|
+
interface ListOptions$1 {
|
|
152
|
+
connectionId: string;
|
|
153
|
+
signal?: AbortSignal;
|
|
154
|
+
}
|
|
155
|
+
interface MutationOptions$1 {
|
|
156
|
+
idempotencyKey?: string;
|
|
157
|
+
signal?: AbortSignal;
|
|
158
|
+
}
|
|
159
|
+
declare class WhatsAppBroadcastsResource {
|
|
160
|
+
private readonly http;
|
|
161
|
+
constructor(http: HttpClientLike);
|
|
162
|
+
list(opts: ListOptions$1): Promise<WhatsAppBroadcast[]>;
|
|
163
|
+
create(input: WhatsAppBroadcastCreateInput, opts?: MutationOptions$1): Promise<WhatsAppBroadcast>;
|
|
164
|
+
get(id: string, opts?: {
|
|
165
|
+
signal?: AbortSignal;
|
|
166
|
+
}): Promise<WhatsAppBroadcastDetail>;
|
|
167
|
+
cancel(id: string, opts?: MutationOptions$1): Promise<WhatsAppBroadcast>;
|
|
168
|
+
/**
|
|
169
|
+
* Execute the broadcast. Long-running — iterates recipients with 100ms
|
|
170
|
+
* pacing between sends. Consider extending your HTTP client's timeout
|
|
171
|
+
* for broadcasts over a few hundred recipients (the Atribu server caps
|
|
172
|
+
* the route at 300s).
|
|
173
|
+
*/
|
|
174
|
+
send(id: string, opts?: MutationOptions$1): Promise<WhatsAppBroadcast>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* WhatsApp-specific resource namespace. Mounted on `AtribuClient.whatsapp`.
|
|
179
|
+
* Cross-channel messaging stays on `AtribuClient.messages`.
|
|
180
|
+
*/
|
|
181
|
+
declare class WhatsAppNamespace {
|
|
182
|
+
readonly templates: WhatsAppTemplatesResource;
|
|
183
|
+
readonly broadcasts: WhatsAppBroadcastsResource;
|
|
184
|
+
constructor(http: HttpClientLike);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
type ListResponse = paths["/api/v1/instagram/triggers"]["get"]["responses"][200]["content"]["application/json"];
|
|
188
|
+
type CreateBody = NonNullable<paths["/api/v1/instagram/triggers"]["post"]["requestBody"]>["content"]["application/json"];
|
|
189
|
+
type UpdateBody = NonNullable<paths["/api/v1/instagram/triggers/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
|
|
190
|
+
type TestDmBody = NonNullable<paths["/api/v1/instagram/triggers/{id}/test-dm"]["post"]["requestBody"]>["content"]["application/json"];
|
|
191
|
+
type TestDmResponse = paths["/api/v1/instagram/triggers/{id}/test-dm"]["post"]["responses"][200]["content"]["application/json"];
|
|
192
|
+
type ResumeResponse = paths["/api/v1/instagram/triggers/resume"]["post"]["responses"][200]["content"]["application/json"];
|
|
193
|
+
type InstagramTrigger = ListResponse["data"][number];
|
|
194
|
+
type InstagramTriggerCreateInput = CreateBody;
|
|
195
|
+
type InstagramTriggerUpdateInput = UpdateBody;
|
|
196
|
+
interface ListOptions {
|
|
197
|
+
connectionId: string;
|
|
198
|
+
signal?: AbortSignal;
|
|
199
|
+
}
|
|
200
|
+
interface MutationOptions {
|
|
201
|
+
idempotencyKey?: string;
|
|
202
|
+
signal?: AbortSignal;
|
|
203
|
+
}
|
|
204
|
+
interface ResumeOptions extends MutationOptions {
|
|
205
|
+
connectionId: string;
|
|
206
|
+
}
|
|
207
|
+
declare class InstagramTriggersResource {
|
|
208
|
+
private readonly http;
|
|
209
|
+
constructor(http: HttpClientLike);
|
|
210
|
+
list(opts: ListOptions): Promise<InstagramTrigger[]>;
|
|
211
|
+
create(input: InstagramTriggerCreateInput, opts?: MutationOptions): Promise<InstagramTrigger>;
|
|
212
|
+
update(id: string, input: InstagramTriggerUpdateInput, opts?: MutationOptions): Promise<InstagramTrigger>;
|
|
213
|
+
delete(id: string, opts?: MutationOptions): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Send the trigger's `opening_message` as a one-off DM to a test IGSID.
|
|
216
|
+
* Uses Meta's HUMAN_AGENT tag — recipient must have DMed the IG account
|
|
217
|
+
* in the past 7 days, otherwise Meta rejects the send.
|
|
218
|
+
*/
|
|
219
|
+
testDm(id: string, input: TestDmBody, opts?: MutationOptions): Promise<TestDmResponse["data"]>;
|
|
220
|
+
/**
|
|
221
|
+
* Manually clear the comment-to-DM circuit breaker for the connection's
|
|
222
|
+
* IG account. The breaker normally clears itself once spam signals
|
|
223
|
+
* subside; this method exists for ops intervention.
|
|
224
|
+
*/
|
|
225
|
+
resumeCircuit(opts: ResumeOptions): Promise<ResumeResponse["data"]>;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Instagram-specific resource namespace. Mounted on `AtribuClient.instagram`.
|
|
230
|
+
* Cross-channel messaging stays on `AtribuClient.messages` and
|
|
231
|
+
* `AtribuClient.comments`.
|
|
232
|
+
*/
|
|
233
|
+
declare class InstagramNamespace {
|
|
234
|
+
readonly triggers: InstagramTriggersResource;
|
|
235
|
+
constructor(http: HttpClientLike);
|
|
236
|
+
}
|
|
237
|
+
|
|
93
238
|
/**
|
|
94
239
|
* Opt-in retry layer.
|
|
95
240
|
*
|
|
@@ -158,15 +303,21 @@ declare function isRetryableError(err: unknown): err is AtribuError;
|
|
|
158
303
|
interface ResourceBundle {
|
|
159
304
|
messages: MessagesResource;
|
|
160
305
|
comments: CommentsResource;
|
|
306
|
+
connections: ConnectionsResource;
|
|
161
307
|
webhooks: {
|
|
162
308
|
subscriptions: WebhookSubscriptionsResource;
|
|
163
309
|
deliveries: WebhookDeliveriesResource;
|
|
164
310
|
};
|
|
311
|
+
whatsapp: WhatsAppNamespace;
|
|
312
|
+
instagram: InstagramNamespace;
|
|
165
313
|
}
|
|
166
314
|
declare class AtribuClient {
|
|
167
315
|
readonly messages: MessagesResource;
|
|
168
316
|
readonly comments: CommentsResource;
|
|
317
|
+
readonly connections: ConnectionsResource;
|
|
169
318
|
readonly webhooks: ResourceBundle["webhooks"];
|
|
319
|
+
readonly whatsapp: WhatsAppNamespace;
|
|
320
|
+
readonly instagram: InstagramNamespace;
|
|
170
321
|
/** @internal — exposed for `withRetry` chaining; do not depend on this. */
|
|
171
322
|
protected readonly _http: HttpClientLike;
|
|
172
323
|
constructor(config: AtribuClientConfig);
|
|
@@ -195,4 +346,4 @@ type Runtime = "node" | "bun" | "deno" | "edge" | "browser" | "unknown";
|
|
|
195
346
|
declare function detectRuntime(): Runtime;
|
|
196
347
|
declare function runtimeTag(): string;
|
|
197
348
|
|
|
198
|
-
export { AtribuClient, type AtribuClientConfig, AtribuError, type BackoffStrategy, type CommentPrivateReplyInput, type CommentReplyInput, type CommentReplyOptions, type CommentReplyResponse, type MessageContent, type MessageSendInput, type MessageSendResponse, type MutationOptions, type ReplayOptions, type RetryOptions, RetryingHttpClient, type Runtime, SDK_VERSION, type SendOptions, type WebhookDeliveryReplayResult, type WebhookSubscription, type WebhookSubscriptionCreateInput, type WebhookSubscriptionRotateOptions, type WebhookSubscriptionRotateResult, type WebhookSubscriptionTestResult, type WebhookSubscriptionUpdateInput, type WebhookSubscriptionWithSecret, detectRuntime, isRetryableError, runtimeTag };
|
|
349
|
+
export { AtribuClient, type AtribuClientConfig, AtribuError, type BackoffStrategy, type CommentPrivateReplyInput, type CommentReplyInput, type CommentReplyOptions, type CommentReplyResponse, type Connection, type InstagramTrigger, type InstagramTriggerCreateInput, type InstagramTriggerUpdateInput, type MessageContent, type MessageSendInput, type MessageSendResponse, type MutationOptions$2 as MutationOptions, type ReplayOptions, type RetryOptions, RetryingHttpClient, type Runtime, SDK_VERSION, type SendOptions, type WebhookDeliveryReplayResult, type WebhookSubscription, type WebhookSubscriptionCreateInput, type WebhookSubscriptionRotateOptions, type WebhookSubscriptionRotateResult, type WebhookSubscriptionTestResult, type WebhookSubscriptionUpdateInput, type WebhookSubscriptionWithSecret, type WhatsAppBroadcast, type WhatsAppBroadcastCreateInput, type WhatsAppBroadcastDetail, type WhatsAppTemplate, type WhatsAppTemplateCreateInput, type WhatsAppTemplateCreateResult, detectRuntime, isRetryableError, runtimeTag };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { H as HttpClientLike, p as paths, R as RequestOptions } from './api.d-
|
|
1
|
+
import { H as HttpClientLike, p as paths, R as RequestOptions } from './api.d-K2ywQhc9.js';
|
|
2
2
|
import { d as AtribuError } from './errors-BLELoojK.js';
|
|
3
3
|
export { A as ApiErrorBody, a as ApiErrorCode, b as AtribuApiError, c as AtribuConfigError, e as AtribuOauthError, f as AtribuTransportError, g as AtribuWebhookError, O as OauthErrorCode, R as RetryHint, W as WebhookErrorCode } from './errors-BLELoojK.js';
|
|
4
4
|
|
|
@@ -47,21 +47,46 @@ declare class CommentsResource {
|
|
|
47
47
|
privateReply(input: CommentPrivateReplyInput, opts?: CommentReplyOptions): Promise<CommentReplyResponse>;
|
|
48
48
|
}
|
|
49
49
|
|
|
50
|
-
type ListResponse = paths["/api/v1/
|
|
51
|
-
type
|
|
52
|
-
|
|
53
|
-
|
|
50
|
+
type ListResponse$4 = paths["/api/v1/connections"]["get"]["responses"][200]["content"]["application/json"];
|
|
51
|
+
type Connection = ListResponse$4["data"][number];
|
|
52
|
+
interface ListOptions$3 {
|
|
53
|
+
channel?: "whatsapp" | "instagram";
|
|
54
|
+
signal?: AbortSignal;
|
|
55
|
+
}
|
|
56
|
+
interface MutationOptions$3 {
|
|
57
|
+
idempotencyKey?: string;
|
|
58
|
+
signal?: AbortSignal;
|
|
59
|
+
}
|
|
60
|
+
declare class ConnectionsResource {
|
|
61
|
+
private readonly http;
|
|
62
|
+
constructor(http: HttpClientLike);
|
|
63
|
+
list(opts?: ListOptions$3): Promise<Connection[]>;
|
|
64
|
+
get(id: string, opts?: {
|
|
65
|
+
signal?: AbortSignal;
|
|
66
|
+
}): Promise<Connection>;
|
|
67
|
+
/**
|
|
68
|
+
* Revoke this OAuth app's authorization for the connection. Does NOT
|
|
69
|
+
* disconnect the underlying data_connection (other consumers + the
|
|
70
|
+
* Atribu UI still see it). Direct admin keys reject this call with 400.
|
|
71
|
+
*/
|
|
72
|
+
revoke(id: string, opts?: MutationOptions$3): Promise<void>;
|
|
73
|
+
}
|
|
74
|
+
|
|
75
|
+
type ListResponse$3 = paths["/api/v1/webhooks/subscriptions"]["get"]["responses"][200]["content"]["application/json"];
|
|
76
|
+
type CreateBody$3 = NonNullable<paths["/api/v1/webhooks/subscriptions"]["post"]["requestBody"]>["content"]["application/json"];
|
|
77
|
+
type CreateResponse$1 = paths["/api/v1/webhooks/subscriptions"]["post"]["responses"][201]["content"]["application/json"];
|
|
78
|
+
type UpdateBody$1 = NonNullable<paths["/api/v1/webhooks/subscriptions/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
|
|
54
79
|
type RotateBody = NonNullable<NonNullable<paths["/api/v1/webhooks/subscriptions/{id}/rotate-secret"]["post"]["requestBody"]>["content"]["application/json"]>;
|
|
55
80
|
type RotateResponse = paths["/api/v1/webhooks/subscriptions/{id}/rotate-secret"]["post"]["responses"][200]["content"]["application/json"];
|
|
56
81
|
type TestResponse = paths["/api/v1/webhooks/test/{id}"]["post"]["responses"][200]["content"]["application/json"];
|
|
57
|
-
type WebhookSubscription = ListResponse["data"][number];
|
|
58
|
-
type WebhookSubscriptionWithSecret = CreateResponse["data"];
|
|
59
|
-
type WebhookSubscriptionCreateInput = CreateBody;
|
|
60
|
-
type WebhookSubscriptionUpdateInput = UpdateBody;
|
|
82
|
+
type WebhookSubscription = ListResponse$3["data"][number];
|
|
83
|
+
type WebhookSubscriptionWithSecret = CreateResponse$1["data"];
|
|
84
|
+
type WebhookSubscriptionCreateInput = CreateBody$3;
|
|
85
|
+
type WebhookSubscriptionUpdateInput = UpdateBody$1;
|
|
61
86
|
type WebhookSubscriptionRotateOptions = RotateBody;
|
|
62
87
|
type WebhookSubscriptionRotateResult = RotateResponse["data"];
|
|
63
88
|
type WebhookSubscriptionTestResult = TestResponse["data"];
|
|
64
|
-
interface MutationOptions {
|
|
89
|
+
interface MutationOptions$2 {
|
|
65
90
|
idempotencyKey?: string;
|
|
66
91
|
signal?: AbortSignal;
|
|
67
92
|
}
|
|
@@ -71,11 +96,11 @@ declare class WebhookSubscriptionsResource {
|
|
|
71
96
|
list(opts?: {
|
|
72
97
|
signal?: AbortSignal;
|
|
73
98
|
}): Promise<WebhookSubscription[]>;
|
|
74
|
-
create(input: WebhookSubscriptionCreateInput, opts?: MutationOptions): Promise<WebhookSubscriptionWithSecret>;
|
|
75
|
-
update(id: string, input: WebhookSubscriptionUpdateInput, opts?: MutationOptions): Promise<WebhookSubscription>;
|
|
76
|
-
delete(id: string, opts?: MutationOptions): Promise<void>;
|
|
77
|
-
rotateSecret(id: string, options?: WebhookSubscriptionRotateOptions, opts?: MutationOptions): Promise<WebhookSubscriptionRotateResult>;
|
|
78
|
-
test(id: string, opts?: MutationOptions): Promise<WebhookSubscriptionTestResult>;
|
|
99
|
+
create(input: WebhookSubscriptionCreateInput, opts?: MutationOptions$2): Promise<WebhookSubscriptionWithSecret>;
|
|
100
|
+
update(id: string, input: WebhookSubscriptionUpdateInput, opts?: MutationOptions$2): Promise<WebhookSubscription>;
|
|
101
|
+
delete(id: string, opts?: MutationOptions$2): Promise<void>;
|
|
102
|
+
rotateSecret(id: string, options?: WebhookSubscriptionRotateOptions, opts?: MutationOptions$2): Promise<WebhookSubscriptionRotateResult>;
|
|
103
|
+
test(id: string, opts?: MutationOptions$2): Promise<WebhookSubscriptionTestResult>;
|
|
79
104
|
}
|
|
80
105
|
|
|
81
106
|
type ReplayResponse = paths["/api/v1/webhooks/deliveries/{id}/replay"]["post"]["responses"][200]["content"]["application/json"];
|
|
@@ -90,6 +115,126 @@ declare class WebhookDeliveriesResource {
|
|
|
90
115
|
replay(id: string, opts?: ReplayOptions): Promise<WebhookDeliveryReplayResult>;
|
|
91
116
|
}
|
|
92
117
|
|
|
118
|
+
type ListResponse$2 = paths["/api/v1/whatsapp/templates"]["get"]["responses"][200]["content"]["application/json"];
|
|
119
|
+
type CreateBody$2 = NonNullable<paths["/api/v1/whatsapp/templates"]["post"]["requestBody"]>["content"]["application/json"];
|
|
120
|
+
type CreateResponse = paths["/api/v1/whatsapp/templates"]["post"]["responses"][201]["content"]["application/json"];
|
|
121
|
+
type WhatsAppTemplate = ListResponse$2["data"][number];
|
|
122
|
+
type WhatsAppTemplateCreateInput = CreateBody$2;
|
|
123
|
+
type WhatsAppTemplateCreateResult = CreateResponse["data"];
|
|
124
|
+
interface ListOptions$2 {
|
|
125
|
+
connectionId: string;
|
|
126
|
+
signal?: AbortSignal;
|
|
127
|
+
}
|
|
128
|
+
interface DeleteOptions {
|
|
129
|
+
connectionId: string;
|
|
130
|
+
idempotencyKey?: string;
|
|
131
|
+
signal?: AbortSignal;
|
|
132
|
+
}
|
|
133
|
+
interface CreateOptions {
|
|
134
|
+
idempotencyKey?: string;
|
|
135
|
+
signal?: AbortSignal;
|
|
136
|
+
}
|
|
137
|
+
declare class WhatsAppTemplatesResource {
|
|
138
|
+
private readonly http;
|
|
139
|
+
constructor(http: HttpClientLike);
|
|
140
|
+
list(opts: ListOptions$2): Promise<WhatsAppTemplate[]>;
|
|
141
|
+
create(input: WhatsAppTemplateCreateInput, opts?: CreateOptions): Promise<WhatsAppTemplateCreateResult>;
|
|
142
|
+
delete(name: string, opts: DeleteOptions): Promise<void>;
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
type ListResponse$1 = paths["/api/v1/whatsapp/broadcasts"]["get"]["responses"][200]["content"]["application/json"];
|
|
146
|
+
type CreateBody$1 = NonNullable<paths["/api/v1/whatsapp/broadcasts"]["post"]["requestBody"]>["content"]["application/json"];
|
|
147
|
+
type GetResponse = paths["/api/v1/whatsapp/broadcasts/{id}"]["get"]["responses"][200]["content"]["application/json"];
|
|
148
|
+
type WhatsAppBroadcast = ListResponse$1["data"][number];
|
|
149
|
+
type WhatsAppBroadcastDetail = GetResponse["data"];
|
|
150
|
+
type WhatsAppBroadcastCreateInput = CreateBody$1;
|
|
151
|
+
interface ListOptions$1 {
|
|
152
|
+
connectionId: string;
|
|
153
|
+
signal?: AbortSignal;
|
|
154
|
+
}
|
|
155
|
+
interface MutationOptions$1 {
|
|
156
|
+
idempotencyKey?: string;
|
|
157
|
+
signal?: AbortSignal;
|
|
158
|
+
}
|
|
159
|
+
declare class WhatsAppBroadcastsResource {
|
|
160
|
+
private readonly http;
|
|
161
|
+
constructor(http: HttpClientLike);
|
|
162
|
+
list(opts: ListOptions$1): Promise<WhatsAppBroadcast[]>;
|
|
163
|
+
create(input: WhatsAppBroadcastCreateInput, opts?: MutationOptions$1): Promise<WhatsAppBroadcast>;
|
|
164
|
+
get(id: string, opts?: {
|
|
165
|
+
signal?: AbortSignal;
|
|
166
|
+
}): Promise<WhatsAppBroadcastDetail>;
|
|
167
|
+
cancel(id: string, opts?: MutationOptions$1): Promise<WhatsAppBroadcast>;
|
|
168
|
+
/**
|
|
169
|
+
* Execute the broadcast. Long-running — iterates recipients with 100ms
|
|
170
|
+
* pacing between sends. Consider extending your HTTP client's timeout
|
|
171
|
+
* for broadcasts over a few hundred recipients (the Atribu server caps
|
|
172
|
+
* the route at 300s).
|
|
173
|
+
*/
|
|
174
|
+
send(id: string, opts?: MutationOptions$1): Promise<WhatsAppBroadcast>;
|
|
175
|
+
}
|
|
176
|
+
|
|
177
|
+
/**
|
|
178
|
+
* WhatsApp-specific resource namespace. Mounted on `AtribuClient.whatsapp`.
|
|
179
|
+
* Cross-channel messaging stays on `AtribuClient.messages`.
|
|
180
|
+
*/
|
|
181
|
+
declare class WhatsAppNamespace {
|
|
182
|
+
readonly templates: WhatsAppTemplatesResource;
|
|
183
|
+
readonly broadcasts: WhatsAppBroadcastsResource;
|
|
184
|
+
constructor(http: HttpClientLike);
|
|
185
|
+
}
|
|
186
|
+
|
|
187
|
+
type ListResponse = paths["/api/v1/instagram/triggers"]["get"]["responses"][200]["content"]["application/json"];
|
|
188
|
+
type CreateBody = NonNullable<paths["/api/v1/instagram/triggers"]["post"]["requestBody"]>["content"]["application/json"];
|
|
189
|
+
type UpdateBody = NonNullable<paths["/api/v1/instagram/triggers/{id}"]["patch"]["requestBody"]>["content"]["application/json"];
|
|
190
|
+
type TestDmBody = NonNullable<paths["/api/v1/instagram/triggers/{id}/test-dm"]["post"]["requestBody"]>["content"]["application/json"];
|
|
191
|
+
type TestDmResponse = paths["/api/v1/instagram/triggers/{id}/test-dm"]["post"]["responses"][200]["content"]["application/json"];
|
|
192
|
+
type ResumeResponse = paths["/api/v1/instagram/triggers/resume"]["post"]["responses"][200]["content"]["application/json"];
|
|
193
|
+
type InstagramTrigger = ListResponse["data"][number];
|
|
194
|
+
type InstagramTriggerCreateInput = CreateBody;
|
|
195
|
+
type InstagramTriggerUpdateInput = UpdateBody;
|
|
196
|
+
interface ListOptions {
|
|
197
|
+
connectionId: string;
|
|
198
|
+
signal?: AbortSignal;
|
|
199
|
+
}
|
|
200
|
+
interface MutationOptions {
|
|
201
|
+
idempotencyKey?: string;
|
|
202
|
+
signal?: AbortSignal;
|
|
203
|
+
}
|
|
204
|
+
interface ResumeOptions extends MutationOptions {
|
|
205
|
+
connectionId: string;
|
|
206
|
+
}
|
|
207
|
+
declare class InstagramTriggersResource {
|
|
208
|
+
private readonly http;
|
|
209
|
+
constructor(http: HttpClientLike);
|
|
210
|
+
list(opts: ListOptions): Promise<InstagramTrigger[]>;
|
|
211
|
+
create(input: InstagramTriggerCreateInput, opts?: MutationOptions): Promise<InstagramTrigger>;
|
|
212
|
+
update(id: string, input: InstagramTriggerUpdateInput, opts?: MutationOptions): Promise<InstagramTrigger>;
|
|
213
|
+
delete(id: string, opts?: MutationOptions): Promise<void>;
|
|
214
|
+
/**
|
|
215
|
+
* Send the trigger's `opening_message` as a one-off DM to a test IGSID.
|
|
216
|
+
* Uses Meta's HUMAN_AGENT tag — recipient must have DMed the IG account
|
|
217
|
+
* in the past 7 days, otherwise Meta rejects the send.
|
|
218
|
+
*/
|
|
219
|
+
testDm(id: string, input: TestDmBody, opts?: MutationOptions): Promise<TestDmResponse["data"]>;
|
|
220
|
+
/**
|
|
221
|
+
* Manually clear the comment-to-DM circuit breaker for the connection's
|
|
222
|
+
* IG account. The breaker normally clears itself once spam signals
|
|
223
|
+
* subside; this method exists for ops intervention.
|
|
224
|
+
*/
|
|
225
|
+
resumeCircuit(opts: ResumeOptions): Promise<ResumeResponse["data"]>;
|
|
226
|
+
}
|
|
227
|
+
|
|
228
|
+
/**
|
|
229
|
+
* Instagram-specific resource namespace. Mounted on `AtribuClient.instagram`.
|
|
230
|
+
* Cross-channel messaging stays on `AtribuClient.messages` and
|
|
231
|
+
* `AtribuClient.comments`.
|
|
232
|
+
*/
|
|
233
|
+
declare class InstagramNamespace {
|
|
234
|
+
readonly triggers: InstagramTriggersResource;
|
|
235
|
+
constructor(http: HttpClientLike);
|
|
236
|
+
}
|
|
237
|
+
|
|
93
238
|
/**
|
|
94
239
|
* Opt-in retry layer.
|
|
95
240
|
*
|
|
@@ -158,15 +303,21 @@ declare function isRetryableError(err: unknown): err is AtribuError;
|
|
|
158
303
|
interface ResourceBundle {
|
|
159
304
|
messages: MessagesResource;
|
|
160
305
|
comments: CommentsResource;
|
|
306
|
+
connections: ConnectionsResource;
|
|
161
307
|
webhooks: {
|
|
162
308
|
subscriptions: WebhookSubscriptionsResource;
|
|
163
309
|
deliveries: WebhookDeliveriesResource;
|
|
164
310
|
};
|
|
311
|
+
whatsapp: WhatsAppNamespace;
|
|
312
|
+
instagram: InstagramNamespace;
|
|
165
313
|
}
|
|
166
314
|
declare class AtribuClient {
|
|
167
315
|
readonly messages: MessagesResource;
|
|
168
316
|
readonly comments: CommentsResource;
|
|
317
|
+
readonly connections: ConnectionsResource;
|
|
169
318
|
readonly webhooks: ResourceBundle["webhooks"];
|
|
319
|
+
readonly whatsapp: WhatsAppNamespace;
|
|
320
|
+
readonly instagram: InstagramNamespace;
|
|
170
321
|
/** @internal — exposed for `withRetry` chaining; do not depend on this. */
|
|
171
322
|
protected readonly _http: HttpClientLike;
|
|
172
323
|
constructor(config: AtribuClientConfig);
|
|
@@ -195,4 +346,4 @@ type Runtime = "node" | "bun" | "deno" | "edge" | "browser" | "unknown";
|
|
|
195
346
|
declare function detectRuntime(): Runtime;
|
|
196
347
|
declare function runtimeTag(): string;
|
|
197
348
|
|
|
198
|
-
export { AtribuClient, type AtribuClientConfig, AtribuError, type BackoffStrategy, type CommentPrivateReplyInput, type CommentReplyInput, type CommentReplyOptions, type CommentReplyResponse, type MessageContent, type MessageSendInput, type MessageSendResponse, type MutationOptions, type ReplayOptions, type RetryOptions, RetryingHttpClient, type Runtime, SDK_VERSION, type SendOptions, type WebhookDeliveryReplayResult, type WebhookSubscription, type WebhookSubscriptionCreateInput, type WebhookSubscriptionRotateOptions, type WebhookSubscriptionRotateResult, type WebhookSubscriptionTestResult, type WebhookSubscriptionUpdateInput, type WebhookSubscriptionWithSecret, detectRuntime, isRetryableError, runtimeTag };
|
|
349
|
+
export { AtribuClient, type AtribuClientConfig, AtribuError, type BackoffStrategy, type CommentPrivateReplyInput, type CommentReplyInput, type CommentReplyOptions, type CommentReplyResponse, type Connection, type InstagramTrigger, type InstagramTriggerCreateInput, type InstagramTriggerUpdateInput, type MessageContent, type MessageSendInput, type MessageSendResponse, type MutationOptions$2 as MutationOptions, type ReplayOptions, type RetryOptions, RetryingHttpClient, type Runtime, SDK_VERSION, type SendOptions, type WebhookDeliveryReplayResult, type WebhookSubscription, type WebhookSubscriptionCreateInput, type WebhookSubscriptionRotateOptions, type WebhookSubscriptionRotateResult, type WebhookSubscriptionTestResult, type WebhookSubscriptionUpdateInput, type WebhookSubscriptionWithSecret, type WhatsAppBroadcast, type WhatsAppBroadcastCreateInput, type WhatsAppBroadcastDetail, type WhatsAppTemplate, type WhatsAppTemplateCreateInput, type WhatsAppTemplateCreateResult, detectRuntime, isRetryableError, runtimeTag };
|