@zavudev/sdk 0.12.0 → 0.15.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 +34 -0
- package/client.d.mts +4 -4
- package/client.d.mts.map +1 -1
- package/client.d.ts +4 -4
- package/client.d.ts.map +1 -1
- package/client.js.map +1 -1
- package/client.mjs.map +1 -1
- package/package.json +1 -1
- package/resources/contacts.d.mts +4 -0
- package/resources/contacts.d.mts.map +1 -1
- package/resources/contacts.d.ts +4 -0
- package/resources/contacts.d.ts.map +1 -1
- package/resources/index.d.mts +2 -2
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +2 -2
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js.map +1 -1
- package/resources/index.mjs.map +1 -1
- package/resources/senders.d.mts +224 -3
- package/resources/senders.d.mts.map +1 -1
- package/resources/senders.d.ts +224 -3
- package/resources/senders.d.ts.map +1 -1
- package/resources/senders.js +90 -0
- package/resources/senders.js.map +1 -1
- package/resources/senders.mjs +90 -0
- package/resources/senders.mjs.map +1 -1
- package/resources/templates.d.mts +25 -1
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +25 -1
- package/resources/templates.d.ts.map +1 -1
- package/resources/templates.js +16 -0
- package/resources/templates.js.map +1 -1
- package/resources/templates.mjs +16 -0
- package/resources/templates.mjs.map +1 -1
- package/src/client.ts +16 -0
- package/src/resources/contacts.ts +5 -0
- package/src/resources/index.ts +8 -0
- package/src/resources/senders.ts +297 -2
- package/src/resources/templates.ts +30 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.ts +1 -1
- package/version.js +1 -1
- package/version.mjs +1 -1
package/src/resources/senders.ts
CHANGED
|
@@ -10,6 +10,14 @@ import { path } from '../internal/utils/path';
|
|
|
10
10
|
export class Senders extends APIResource {
|
|
11
11
|
/**
|
|
12
12
|
* Create sender
|
|
13
|
+
*
|
|
14
|
+
* @example
|
|
15
|
+
* ```ts
|
|
16
|
+
* const sender = await client.senders.create({
|
|
17
|
+
* name: 'name',
|
|
18
|
+
* phoneNumber: 'phoneNumber',
|
|
19
|
+
* });
|
|
20
|
+
* ```
|
|
13
21
|
*/
|
|
14
22
|
create(body: SenderCreateParams, options?: RequestOptions): APIPromise<Sender> {
|
|
15
23
|
return this._client.post('/v1/senders', { body, ...options });
|
|
@@ -17,6 +25,11 @@ export class Senders extends APIResource {
|
|
|
17
25
|
|
|
18
26
|
/**
|
|
19
27
|
* Get sender
|
|
28
|
+
*
|
|
29
|
+
* @example
|
|
30
|
+
* ```ts
|
|
31
|
+
* const sender = await client.senders.retrieve('senderId');
|
|
32
|
+
* ```
|
|
20
33
|
*/
|
|
21
34
|
retrieve(senderID: string, options?: RequestOptions): APIPromise<Sender> {
|
|
22
35
|
return this._client.get(path`/v1/senders/${senderID}`, options);
|
|
@@ -24,6 +37,11 @@ export class Senders extends APIResource {
|
|
|
24
37
|
|
|
25
38
|
/**
|
|
26
39
|
* Update sender
|
|
40
|
+
*
|
|
41
|
+
* @example
|
|
42
|
+
* ```ts
|
|
43
|
+
* const sender = await client.senders.update('senderId');
|
|
44
|
+
* ```
|
|
27
45
|
*/
|
|
28
46
|
update(senderID: string, body: SenderUpdateParams, options?: RequestOptions): APIPromise<Sender> {
|
|
29
47
|
return this._client.patch(path`/v1/senders/${senderID}`, { body, ...options });
|
|
@@ -31,6 +49,14 @@ export class Senders extends APIResource {
|
|
|
31
49
|
|
|
32
50
|
/**
|
|
33
51
|
* List senders
|
|
52
|
+
*
|
|
53
|
+
* @example
|
|
54
|
+
* ```ts
|
|
55
|
+
* // Automatically fetches more pages as needed.
|
|
56
|
+
* for await (const sender of client.senders.list()) {
|
|
57
|
+
* // ...
|
|
58
|
+
* }
|
|
59
|
+
* ```
|
|
34
60
|
*/
|
|
35
61
|
list(
|
|
36
62
|
query: SenderListParams | null | undefined = {},
|
|
@@ -41,6 +67,11 @@ export class Senders extends APIResource {
|
|
|
41
67
|
|
|
42
68
|
/**
|
|
43
69
|
* Delete sender
|
|
70
|
+
*
|
|
71
|
+
* @example
|
|
72
|
+
* ```ts
|
|
73
|
+
* await client.senders.delete('senderId');
|
|
74
|
+
* ```
|
|
44
75
|
*/
|
|
45
76
|
delete(senderID: string, options?: RequestOptions): APIPromise<void> {
|
|
46
77
|
return this._client.delete(path`/v1/senders/${senderID}`, {
|
|
@@ -49,13 +80,83 @@ export class Senders extends APIResource {
|
|
|
49
80
|
});
|
|
50
81
|
}
|
|
51
82
|
|
|
83
|
+
/**
|
|
84
|
+
* Get the WhatsApp Business profile for a sender. The sender must have a WhatsApp
|
|
85
|
+
* Business Account connected.
|
|
86
|
+
*
|
|
87
|
+
* @example
|
|
88
|
+
* ```ts
|
|
89
|
+
* const whatsappBusinessProfileResponse =
|
|
90
|
+
* await client.senders.getProfile('senderId');
|
|
91
|
+
* ```
|
|
92
|
+
*/
|
|
93
|
+
getProfile(senderID: string, options?: RequestOptions): APIPromise<WhatsappBusinessProfileResponse> {
|
|
94
|
+
return this._client.get(path`/v1/senders/${senderID}/profile`, options);
|
|
95
|
+
}
|
|
96
|
+
|
|
52
97
|
/**
|
|
53
98
|
* Regenerate the webhook secret for a sender. The old secret will be invalidated
|
|
54
99
|
* immediately.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* const webhookSecretResponse =
|
|
104
|
+
* await client.senders.regenerateWebhookSecret('senderId');
|
|
105
|
+
* ```
|
|
55
106
|
*/
|
|
56
107
|
regenerateWebhookSecret(senderID: string, options?: RequestOptions): APIPromise<WebhookSecretResponse> {
|
|
57
108
|
return this._client.post(path`/v1/senders/${senderID}/webhook/secret`, options);
|
|
58
109
|
}
|
|
110
|
+
|
|
111
|
+
/**
|
|
112
|
+
* Update the WhatsApp Business profile for a sender. The sender must have a
|
|
113
|
+
* WhatsApp Business Account connected.
|
|
114
|
+
*
|
|
115
|
+
* @example
|
|
116
|
+
* ```ts
|
|
117
|
+
* const response = await client.senders.updateProfile(
|
|
118
|
+
* 'senderId',
|
|
119
|
+
* {
|
|
120
|
+
* about: 'Succulent specialists!',
|
|
121
|
+
* description:
|
|
122
|
+
* 'We specialize in providing high-quality succulents.',
|
|
123
|
+
* email: 'contact@example.com',
|
|
124
|
+
* vertical: 'RETAIL',
|
|
125
|
+
* websites: ['https://www.example.com'],
|
|
126
|
+
* },
|
|
127
|
+
* );
|
|
128
|
+
* ```
|
|
129
|
+
*/
|
|
130
|
+
updateProfile(
|
|
131
|
+
senderID: string,
|
|
132
|
+
body: SenderUpdateProfileParams,
|
|
133
|
+
options?: RequestOptions,
|
|
134
|
+
): APIPromise<SenderUpdateProfileResponse> {
|
|
135
|
+
return this._client.patch(path`/v1/senders/${senderID}/profile`, { body, ...options });
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
/**
|
|
139
|
+
* Upload a new profile picture for the WhatsApp Business profile. The image will
|
|
140
|
+
* be uploaded to Meta and set as the profile picture.
|
|
141
|
+
*
|
|
142
|
+
* @example
|
|
143
|
+
* ```ts
|
|
144
|
+
* const response = await client.senders.uploadProfilePicture(
|
|
145
|
+
* 'senderId',
|
|
146
|
+
* {
|
|
147
|
+
* imageUrl: 'https://example.com/profile.jpg',
|
|
148
|
+
* mimeType: 'image/jpeg',
|
|
149
|
+
* },
|
|
150
|
+
* );
|
|
151
|
+
* ```
|
|
152
|
+
*/
|
|
153
|
+
uploadProfilePicture(
|
|
154
|
+
senderID: string,
|
|
155
|
+
body: SenderUploadProfilePictureParams,
|
|
156
|
+
options?: RequestOptions,
|
|
157
|
+
): APIPromise<SenderUploadProfilePictureResponse> {
|
|
158
|
+
return this._client.post(path`/v1/senders/${senderID}/profile/picture`, { body, ...options });
|
|
159
|
+
}
|
|
59
160
|
}
|
|
60
161
|
|
|
61
162
|
export type SendersCursor = Cursor<Sender>;
|
|
@@ -83,6 +184,56 @@ export interface Sender {
|
|
|
83
184
|
* Webhook configuration for the sender.
|
|
84
185
|
*/
|
|
85
186
|
webhook?: SenderWebhook;
|
|
187
|
+
|
|
188
|
+
/**
|
|
189
|
+
* WhatsApp Business Account information. Only present if a WABA is connected.
|
|
190
|
+
*/
|
|
191
|
+
whatsapp?: Sender.Whatsapp;
|
|
192
|
+
}
|
|
193
|
+
|
|
194
|
+
export namespace Sender {
|
|
195
|
+
/**
|
|
196
|
+
* WhatsApp Business Account information. Only present if a WABA is connected.
|
|
197
|
+
*/
|
|
198
|
+
export interface Whatsapp {
|
|
199
|
+
/**
|
|
200
|
+
* Display phone number.
|
|
201
|
+
*/
|
|
202
|
+
displayPhoneNumber?: string;
|
|
203
|
+
|
|
204
|
+
/**
|
|
205
|
+
* Payment configuration status from Meta.
|
|
206
|
+
*/
|
|
207
|
+
paymentStatus?: Whatsapp.PaymentStatus;
|
|
208
|
+
|
|
209
|
+
/**
|
|
210
|
+
* WhatsApp phone number ID from Meta.
|
|
211
|
+
*/
|
|
212
|
+
phoneNumberId?: string;
|
|
213
|
+
}
|
|
214
|
+
|
|
215
|
+
export namespace Whatsapp {
|
|
216
|
+
/**
|
|
217
|
+
* Payment configuration status from Meta.
|
|
218
|
+
*/
|
|
219
|
+
export interface PaymentStatus {
|
|
220
|
+
/**
|
|
221
|
+
* Whether template messages can be sent. Requires setupStatus=COMPLETE and
|
|
222
|
+
* methodStatus=VALID.
|
|
223
|
+
*/
|
|
224
|
+
canSendTemplates?: boolean;
|
|
225
|
+
|
|
226
|
+
/**
|
|
227
|
+
* Payment method status (VALID, NONE, etc.).
|
|
228
|
+
*/
|
|
229
|
+
methodStatus?: string;
|
|
230
|
+
|
|
231
|
+
/**
|
|
232
|
+
* Payment setup status (COMPLETE, NOT_STARTED, etc.).
|
|
233
|
+
*/
|
|
234
|
+
setupStatus?: string;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
86
237
|
}
|
|
87
238
|
|
|
88
239
|
/**
|
|
@@ -112,14 +263,18 @@ export interface SenderWebhook {
|
|
|
112
263
|
}
|
|
113
264
|
|
|
114
265
|
/**
|
|
115
|
-
* Type of event that triggers the webhook.
|
|
266
|
+
* Type of event that triggers the webhook. Note: Reactions are delivered as
|
|
267
|
+
* message.inbound with messageType='reaction'.
|
|
116
268
|
*/
|
|
117
269
|
export type WebhookEvent =
|
|
270
|
+
| 'message.queued'
|
|
118
271
|
| 'message.sent'
|
|
119
272
|
| 'message.delivered'
|
|
120
273
|
| 'message.failed'
|
|
121
274
|
| 'message.inbound'
|
|
122
|
-
| '
|
|
275
|
+
| 'message.unsupported'
|
|
276
|
+
| 'conversation.new'
|
|
277
|
+
| 'template.status_changed';
|
|
123
278
|
|
|
124
279
|
export interface WebhookSecretResponse {
|
|
125
280
|
/**
|
|
@@ -128,6 +283,95 @@ export interface WebhookSecretResponse {
|
|
|
128
283
|
secret: string;
|
|
129
284
|
}
|
|
130
285
|
|
|
286
|
+
/**
|
|
287
|
+
* WhatsApp Business profile information.
|
|
288
|
+
*/
|
|
289
|
+
export interface WhatsappBusinessProfile {
|
|
290
|
+
/**
|
|
291
|
+
* Short description of the business (max 139 characters).
|
|
292
|
+
*/
|
|
293
|
+
about?: string;
|
|
294
|
+
|
|
295
|
+
/**
|
|
296
|
+
* Physical address of the business (max 256 characters).
|
|
297
|
+
*/
|
|
298
|
+
address?: string;
|
|
299
|
+
|
|
300
|
+
/**
|
|
301
|
+
* Extended description of the business (max 512 characters).
|
|
302
|
+
*/
|
|
303
|
+
description?: string;
|
|
304
|
+
|
|
305
|
+
/**
|
|
306
|
+
* Business email address.
|
|
307
|
+
*/
|
|
308
|
+
email?: string;
|
|
309
|
+
|
|
310
|
+
/**
|
|
311
|
+
* URL of the business profile picture.
|
|
312
|
+
*/
|
|
313
|
+
profilePictureUrl?: string;
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* Business category for WhatsApp Business profile.
|
|
317
|
+
*/
|
|
318
|
+
vertical?: WhatsappBusinessProfileVertical;
|
|
319
|
+
|
|
320
|
+
/**
|
|
321
|
+
* Business website URLs (maximum 2).
|
|
322
|
+
*/
|
|
323
|
+
websites?: Array<string>;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
export interface WhatsappBusinessProfileResponse {
|
|
327
|
+
/**
|
|
328
|
+
* WhatsApp Business profile information.
|
|
329
|
+
*/
|
|
330
|
+
profile: WhatsappBusinessProfile;
|
|
331
|
+
}
|
|
332
|
+
|
|
333
|
+
/**
|
|
334
|
+
* Business category for WhatsApp Business profile.
|
|
335
|
+
*/
|
|
336
|
+
export type WhatsappBusinessProfileVertical =
|
|
337
|
+
| 'UNDEFINED'
|
|
338
|
+
| 'OTHER'
|
|
339
|
+
| 'AUTO'
|
|
340
|
+
| 'BEAUTY'
|
|
341
|
+
| 'APPAREL'
|
|
342
|
+
| 'EDU'
|
|
343
|
+
| 'ENTERTAIN'
|
|
344
|
+
| 'EVENT_PLAN'
|
|
345
|
+
| 'FINANCE'
|
|
346
|
+
| 'GROCERY'
|
|
347
|
+
| 'GOVT'
|
|
348
|
+
| 'HOTEL'
|
|
349
|
+
| 'HEALTH'
|
|
350
|
+
| 'NONPROFIT'
|
|
351
|
+
| 'PROF_SERVICES'
|
|
352
|
+
| 'RETAIL'
|
|
353
|
+
| 'TRAVEL'
|
|
354
|
+
| 'RESTAURANT'
|
|
355
|
+
| 'NOT_A_BIZ';
|
|
356
|
+
|
|
357
|
+
export interface SenderUpdateProfileResponse {
|
|
358
|
+
/**
|
|
359
|
+
* WhatsApp Business profile information.
|
|
360
|
+
*/
|
|
361
|
+
profile: WhatsappBusinessProfile;
|
|
362
|
+
|
|
363
|
+
success: boolean;
|
|
364
|
+
}
|
|
365
|
+
|
|
366
|
+
export interface SenderUploadProfilePictureResponse {
|
|
367
|
+
/**
|
|
368
|
+
* WhatsApp Business profile information.
|
|
369
|
+
*/
|
|
370
|
+
profile: WhatsappBusinessProfile;
|
|
371
|
+
|
|
372
|
+
success: boolean;
|
|
373
|
+
}
|
|
374
|
+
|
|
131
375
|
export interface SenderCreateParams {
|
|
132
376
|
name: string;
|
|
133
377
|
|
|
@@ -169,15 +413,66 @@ export interface SenderUpdateParams {
|
|
|
169
413
|
|
|
170
414
|
export interface SenderListParams extends CursorParams {}
|
|
171
415
|
|
|
416
|
+
export interface SenderUpdateProfileParams {
|
|
417
|
+
/**
|
|
418
|
+
* Short description of the business (max 139 characters).
|
|
419
|
+
*/
|
|
420
|
+
about?: string;
|
|
421
|
+
|
|
422
|
+
/**
|
|
423
|
+
* Physical address of the business (max 256 characters).
|
|
424
|
+
*/
|
|
425
|
+
address?: string;
|
|
426
|
+
|
|
427
|
+
/**
|
|
428
|
+
* Extended description of the business (max 512 characters).
|
|
429
|
+
*/
|
|
430
|
+
description?: string;
|
|
431
|
+
|
|
432
|
+
/**
|
|
433
|
+
* Business email address.
|
|
434
|
+
*/
|
|
435
|
+
email?: string;
|
|
436
|
+
|
|
437
|
+
/**
|
|
438
|
+
* Business category for WhatsApp Business profile.
|
|
439
|
+
*/
|
|
440
|
+
vertical?: WhatsappBusinessProfileVertical;
|
|
441
|
+
|
|
442
|
+
/**
|
|
443
|
+
* Business website URLs (maximum 2).
|
|
444
|
+
*/
|
|
445
|
+
websites?: Array<string>;
|
|
446
|
+
}
|
|
447
|
+
|
|
448
|
+
export interface SenderUploadProfilePictureParams {
|
|
449
|
+
/**
|
|
450
|
+
* URL of the image to upload.
|
|
451
|
+
*/
|
|
452
|
+
imageUrl: string;
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* MIME type of the image.
|
|
456
|
+
*/
|
|
457
|
+
mimeType: 'image/jpeg' | 'image/png';
|
|
458
|
+
}
|
|
459
|
+
|
|
172
460
|
export declare namespace Senders {
|
|
173
461
|
export {
|
|
174
462
|
type Sender as Sender,
|
|
175
463
|
type SenderWebhook as SenderWebhook,
|
|
176
464
|
type WebhookEvent as WebhookEvent,
|
|
177
465
|
type WebhookSecretResponse as WebhookSecretResponse,
|
|
466
|
+
type WhatsappBusinessProfile as WhatsappBusinessProfile,
|
|
467
|
+
type WhatsappBusinessProfileResponse as WhatsappBusinessProfileResponse,
|
|
468
|
+
type WhatsappBusinessProfileVertical as WhatsappBusinessProfileVertical,
|
|
469
|
+
type SenderUpdateProfileResponse as SenderUpdateProfileResponse,
|
|
470
|
+
type SenderUploadProfilePictureResponse as SenderUploadProfilePictureResponse,
|
|
178
471
|
type SendersCursor as SendersCursor,
|
|
179
472
|
type SenderCreateParams as SenderCreateParams,
|
|
180
473
|
type SenderUpdateParams as SenderUpdateParams,
|
|
181
474
|
type SenderListParams as SenderListParams,
|
|
475
|
+
type SenderUpdateProfileParams as SenderUpdateProfileParams,
|
|
476
|
+
type SenderUploadProfilePictureParams as SenderUploadProfilePictureParams,
|
|
182
477
|
};
|
|
183
478
|
}
|
|
@@ -73,6 +73,23 @@ export class Templates extends APIResource {
|
|
|
73
73
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
74
74
|
});
|
|
75
75
|
}
|
|
76
|
+
|
|
77
|
+
/**
|
|
78
|
+
* Submit a WhatsApp template to Meta for approval. The template must be in draft
|
|
79
|
+
* status and associated with a sender that has a WhatsApp Business Account
|
|
80
|
+
* configured.
|
|
81
|
+
*
|
|
82
|
+
* @example
|
|
83
|
+
* ```ts
|
|
84
|
+
* const template = await client.templates.submit(
|
|
85
|
+
* 'templateId',
|
|
86
|
+
* { senderId: 'sender_abc123', category: 'UTILITY' },
|
|
87
|
+
* );
|
|
88
|
+
* ```
|
|
89
|
+
*/
|
|
90
|
+
submit(templateID: string, body: TemplateSubmitParams, options?: RequestOptions): APIPromise<Template> {
|
|
91
|
+
return this._client.post(path`/v1/templates/${templateID}/submit`, { body, ...options });
|
|
92
|
+
}
|
|
76
93
|
}
|
|
77
94
|
|
|
78
95
|
export type TemplatesCursor = Cursor<Template>;
|
|
@@ -191,6 +208,18 @@ export interface TemplateCreateParams {
|
|
|
191
208
|
|
|
192
209
|
export interface TemplateListParams extends CursorParams {}
|
|
193
210
|
|
|
211
|
+
export interface TemplateSubmitParams {
|
|
212
|
+
/**
|
|
213
|
+
* The sender ID with the WhatsApp Business Account to submit the template to.
|
|
214
|
+
*/
|
|
215
|
+
senderId: string;
|
|
216
|
+
|
|
217
|
+
/**
|
|
218
|
+
* Template category. If not provided, uses the category set on the template.
|
|
219
|
+
*/
|
|
220
|
+
category?: WhatsappCategory;
|
|
221
|
+
}
|
|
222
|
+
|
|
194
223
|
export declare namespace Templates {
|
|
195
224
|
export {
|
|
196
225
|
type Template as Template,
|
|
@@ -198,5 +227,6 @@ export declare namespace Templates {
|
|
|
198
227
|
type TemplatesCursor as TemplatesCursor,
|
|
199
228
|
type TemplateCreateParams as TemplateCreateParams,
|
|
200
229
|
type TemplateListParams as TemplateListParams,
|
|
230
|
+
type TemplateSubmitParams as TemplateSubmitParams,
|
|
201
231
|
};
|
|
202
232
|
}
|
package/src/version.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.15.0'; // x-release-please-version
|
package/version.d.mts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.15.0";
|
|
2
2
|
//# sourceMappingURL=version.d.mts.map
|
package/version.d.ts
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export declare const VERSION = "0.
|
|
1
|
+
export declare const VERSION = "0.15.0";
|
|
2
2
|
//# sourceMappingURL=version.d.ts.map
|
package/version.js
CHANGED
package/version.mjs
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
export const VERSION = '0.
|
|
1
|
+
export const VERSION = '0.15.0'; // x-release-please-version
|
|
2
2
|
//# sourceMappingURL=version.mjs.map
|