@zavudev/sdk 0.14.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 +9 -0
- package/client.d.mts +2 -2
- package/client.d.mts.map +1 -1
- package/client.d.ts +2 -2
- 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/index.d.mts +1 -1
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +1 -1
- 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 +221 -1
- package/resources/senders.d.mts.map +1 -1
- package/resources/senders.d.ts +221 -1
- 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/src/client.ts +14 -0
- package/src/resources/index.ts +7 -0
- package/src/resources/senders.ts +291 -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/resources/senders.js
CHANGED
|
@@ -9,30 +9,61 @@ const path_1 = require("../internal/utils/path.js");
|
|
|
9
9
|
class Senders extends resource_1.APIResource {
|
|
10
10
|
/**
|
|
11
11
|
* Create sender
|
|
12
|
+
*
|
|
13
|
+
* @example
|
|
14
|
+
* ```ts
|
|
15
|
+
* const sender = await client.senders.create({
|
|
16
|
+
* name: 'name',
|
|
17
|
+
* phoneNumber: 'phoneNumber',
|
|
18
|
+
* });
|
|
19
|
+
* ```
|
|
12
20
|
*/
|
|
13
21
|
create(body, options) {
|
|
14
22
|
return this._client.post('/v1/senders', { body, ...options });
|
|
15
23
|
}
|
|
16
24
|
/**
|
|
17
25
|
* Get sender
|
|
26
|
+
*
|
|
27
|
+
* @example
|
|
28
|
+
* ```ts
|
|
29
|
+
* const sender = await client.senders.retrieve('senderId');
|
|
30
|
+
* ```
|
|
18
31
|
*/
|
|
19
32
|
retrieve(senderID, options) {
|
|
20
33
|
return this._client.get((0, path_1.path) `/v1/senders/${senderID}`, options);
|
|
21
34
|
}
|
|
22
35
|
/**
|
|
23
36
|
* Update sender
|
|
37
|
+
*
|
|
38
|
+
* @example
|
|
39
|
+
* ```ts
|
|
40
|
+
* const sender = await client.senders.update('senderId');
|
|
41
|
+
* ```
|
|
24
42
|
*/
|
|
25
43
|
update(senderID, body, options) {
|
|
26
44
|
return this._client.patch((0, path_1.path) `/v1/senders/${senderID}`, { body, ...options });
|
|
27
45
|
}
|
|
28
46
|
/**
|
|
29
47
|
* List senders
|
|
48
|
+
*
|
|
49
|
+
* @example
|
|
50
|
+
* ```ts
|
|
51
|
+
* // Automatically fetches more pages as needed.
|
|
52
|
+
* for await (const sender of client.senders.list()) {
|
|
53
|
+
* // ...
|
|
54
|
+
* }
|
|
55
|
+
* ```
|
|
30
56
|
*/
|
|
31
57
|
list(query = {}, options) {
|
|
32
58
|
return this._client.getAPIList('/v1/senders', (pagination_1.Cursor), { query, ...options });
|
|
33
59
|
}
|
|
34
60
|
/**
|
|
35
61
|
* Delete sender
|
|
62
|
+
*
|
|
63
|
+
* @example
|
|
64
|
+
* ```ts
|
|
65
|
+
* await client.senders.delete('senderId');
|
|
66
|
+
* ```
|
|
36
67
|
*/
|
|
37
68
|
delete(senderID, options) {
|
|
38
69
|
return this._client.delete((0, path_1.path) `/v1/senders/${senderID}`, {
|
|
@@ -40,13 +71,72 @@ class Senders extends resource_1.APIResource {
|
|
|
40
71
|
headers: (0, headers_1.buildHeaders)([{ Accept: '*/*' }, options?.headers]),
|
|
41
72
|
});
|
|
42
73
|
}
|
|
74
|
+
/**
|
|
75
|
+
* Get the WhatsApp Business profile for a sender. The sender must have a WhatsApp
|
|
76
|
+
* Business Account connected.
|
|
77
|
+
*
|
|
78
|
+
* @example
|
|
79
|
+
* ```ts
|
|
80
|
+
* const whatsappBusinessProfileResponse =
|
|
81
|
+
* await client.senders.getProfile('senderId');
|
|
82
|
+
* ```
|
|
83
|
+
*/
|
|
84
|
+
getProfile(senderID, options) {
|
|
85
|
+
return this._client.get((0, path_1.path) `/v1/senders/${senderID}/profile`, options);
|
|
86
|
+
}
|
|
43
87
|
/**
|
|
44
88
|
* Regenerate the webhook secret for a sender. The old secret will be invalidated
|
|
45
89
|
* immediately.
|
|
90
|
+
*
|
|
91
|
+
* @example
|
|
92
|
+
* ```ts
|
|
93
|
+
* const webhookSecretResponse =
|
|
94
|
+
* await client.senders.regenerateWebhookSecret('senderId');
|
|
95
|
+
* ```
|
|
46
96
|
*/
|
|
47
97
|
regenerateWebhookSecret(senderID, options) {
|
|
48
98
|
return this._client.post((0, path_1.path) `/v1/senders/${senderID}/webhook/secret`, options);
|
|
49
99
|
}
|
|
100
|
+
/**
|
|
101
|
+
* Update the WhatsApp Business profile for a sender. The sender must have a
|
|
102
|
+
* WhatsApp Business Account connected.
|
|
103
|
+
*
|
|
104
|
+
* @example
|
|
105
|
+
* ```ts
|
|
106
|
+
* const response = await client.senders.updateProfile(
|
|
107
|
+
* 'senderId',
|
|
108
|
+
* {
|
|
109
|
+
* about: 'Succulent specialists!',
|
|
110
|
+
* description:
|
|
111
|
+
* 'We specialize in providing high-quality succulents.',
|
|
112
|
+
* email: 'contact@example.com',
|
|
113
|
+
* vertical: 'RETAIL',
|
|
114
|
+
* websites: ['https://www.example.com'],
|
|
115
|
+
* },
|
|
116
|
+
* );
|
|
117
|
+
* ```
|
|
118
|
+
*/
|
|
119
|
+
updateProfile(senderID, body, options) {
|
|
120
|
+
return this._client.patch((0, path_1.path) `/v1/senders/${senderID}/profile`, { body, ...options });
|
|
121
|
+
}
|
|
122
|
+
/**
|
|
123
|
+
* Upload a new profile picture for the WhatsApp Business profile. The image will
|
|
124
|
+
* be uploaded to Meta and set as the profile picture.
|
|
125
|
+
*
|
|
126
|
+
* @example
|
|
127
|
+
* ```ts
|
|
128
|
+
* const response = await client.senders.uploadProfilePicture(
|
|
129
|
+
* 'senderId',
|
|
130
|
+
* {
|
|
131
|
+
* imageUrl: 'https://example.com/profile.jpg',
|
|
132
|
+
* mimeType: 'image/jpeg',
|
|
133
|
+
* },
|
|
134
|
+
* );
|
|
135
|
+
* ```
|
|
136
|
+
*/
|
|
137
|
+
uploadProfilePicture(senderID, body, options) {
|
|
138
|
+
return this._client.post((0, path_1.path) `/v1/senders/${senderID}/profile/picture`, { body, ...options });
|
|
139
|
+
}
|
|
50
140
|
}
|
|
51
141
|
exports.Senders = Senders;
|
|
52
142
|
//# sourceMappingURL=senders.js.map
|
package/resources/senders.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"senders.js","sourceRoot":"","sources":["../src/resources/senders.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAA4E;AAC5E,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,OAAQ,SAAQ,sBAAW;IACtC
|
|
1
|
+
{"version":3,"file":"senders.js","sourceRoot":"","sources":["../src/resources/senders.ts"],"names":[],"mappings":";AAAA,sFAAsF;;;AAEtF,kDAA+C;AAE/C,sDAA4E;AAC5E,oDAAmD;AAEnD,oDAA8C;AAE9C,MAAa,OAAQ,SAAQ,sBAAW;IACtC;;;;;;;;;;OAUG;IACH,MAAM,CAAC,IAAwB,EAAE,OAAwB;QACvD,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,aAAa,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChE,CAAC;IAED;;;;;;;OAOG;IACH,QAAQ,CAAC,QAAgB,EAAE,OAAwB;QACjD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAA,WAAI,EAAA,eAAe,QAAQ,EAAE,EAAE,OAAO,CAAC,CAAC;IAClE,CAAC;IAED;;;;;;;OAOG;IACH,MAAM,CAAC,QAAgB,EAAE,IAAwB,EAAE,OAAwB;Q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EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,oBAAoB,CAClB,QAAgB,EAChB,IAAsC,EACtC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAA,WAAI,EAAA,eAAe,QAAQ,kBAAkB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChG,CAAC;CACF;AAtJD,0BAsJC"}
|
package/resources/senders.mjs
CHANGED
|
@@ -6,30 +6,61 @@ import { path } from "../internal/utils/path.mjs";
|
|
|
6
6
|
export class Senders extends APIResource {
|
|
7
7
|
/**
|
|
8
8
|
* Create sender
|
|
9
|
+
*
|
|
10
|
+
* @example
|
|
11
|
+
* ```ts
|
|
12
|
+
* const sender = await client.senders.create({
|
|
13
|
+
* name: 'name',
|
|
14
|
+
* phoneNumber: 'phoneNumber',
|
|
15
|
+
* });
|
|
16
|
+
* ```
|
|
9
17
|
*/
|
|
10
18
|
create(body, options) {
|
|
11
19
|
return this._client.post('/v1/senders', { body, ...options });
|
|
12
20
|
}
|
|
13
21
|
/**
|
|
14
22
|
* Get sender
|
|
23
|
+
*
|
|
24
|
+
* @example
|
|
25
|
+
* ```ts
|
|
26
|
+
* const sender = await client.senders.retrieve('senderId');
|
|
27
|
+
* ```
|
|
15
28
|
*/
|
|
16
29
|
retrieve(senderID, options) {
|
|
17
30
|
return this._client.get(path `/v1/senders/${senderID}`, options);
|
|
18
31
|
}
|
|
19
32
|
/**
|
|
20
33
|
* Update sender
|
|
34
|
+
*
|
|
35
|
+
* @example
|
|
36
|
+
* ```ts
|
|
37
|
+
* const sender = await client.senders.update('senderId');
|
|
38
|
+
* ```
|
|
21
39
|
*/
|
|
22
40
|
update(senderID, body, options) {
|
|
23
41
|
return this._client.patch(path `/v1/senders/${senderID}`, { body, ...options });
|
|
24
42
|
}
|
|
25
43
|
/**
|
|
26
44
|
* List senders
|
|
45
|
+
*
|
|
46
|
+
* @example
|
|
47
|
+
* ```ts
|
|
48
|
+
* // Automatically fetches more pages as needed.
|
|
49
|
+
* for await (const sender of client.senders.list()) {
|
|
50
|
+
* // ...
|
|
51
|
+
* }
|
|
52
|
+
* ```
|
|
27
53
|
*/
|
|
28
54
|
list(query = {}, options) {
|
|
29
55
|
return this._client.getAPIList('/v1/senders', (Cursor), { query, ...options });
|
|
30
56
|
}
|
|
31
57
|
/**
|
|
32
58
|
* Delete sender
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* ```ts
|
|
62
|
+
* await client.senders.delete('senderId');
|
|
63
|
+
* ```
|
|
33
64
|
*/
|
|
34
65
|
delete(senderID, options) {
|
|
35
66
|
return this._client.delete(path `/v1/senders/${senderID}`, {
|
|
@@ -37,12 +68,71 @@ export class Senders extends APIResource {
|
|
|
37
68
|
headers: buildHeaders([{ Accept: '*/*' }, options?.headers]),
|
|
38
69
|
});
|
|
39
70
|
}
|
|
71
|
+
/**
|
|
72
|
+
* Get the WhatsApp Business profile for a sender. The sender must have a WhatsApp
|
|
73
|
+
* Business Account connected.
|
|
74
|
+
*
|
|
75
|
+
* @example
|
|
76
|
+
* ```ts
|
|
77
|
+
* const whatsappBusinessProfileResponse =
|
|
78
|
+
* await client.senders.getProfile('senderId');
|
|
79
|
+
* ```
|
|
80
|
+
*/
|
|
81
|
+
getProfile(senderID, options) {
|
|
82
|
+
return this._client.get(path `/v1/senders/${senderID}/profile`, options);
|
|
83
|
+
}
|
|
40
84
|
/**
|
|
41
85
|
* Regenerate the webhook secret for a sender. The old secret will be invalidated
|
|
42
86
|
* immediately.
|
|
87
|
+
*
|
|
88
|
+
* @example
|
|
89
|
+
* ```ts
|
|
90
|
+
* const webhookSecretResponse =
|
|
91
|
+
* await client.senders.regenerateWebhookSecret('senderId');
|
|
92
|
+
* ```
|
|
43
93
|
*/
|
|
44
94
|
regenerateWebhookSecret(senderID, options) {
|
|
45
95
|
return this._client.post(path `/v1/senders/${senderID}/webhook/secret`, options);
|
|
46
96
|
}
|
|
97
|
+
/**
|
|
98
|
+
* Update the WhatsApp Business profile for a sender. The sender must have a
|
|
99
|
+
* WhatsApp Business Account connected.
|
|
100
|
+
*
|
|
101
|
+
* @example
|
|
102
|
+
* ```ts
|
|
103
|
+
* const response = await client.senders.updateProfile(
|
|
104
|
+
* 'senderId',
|
|
105
|
+
* {
|
|
106
|
+
* about: 'Succulent specialists!',
|
|
107
|
+
* description:
|
|
108
|
+
* 'We specialize in providing high-quality succulents.',
|
|
109
|
+
* email: 'contact@example.com',
|
|
110
|
+
* vertical: 'RETAIL',
|
|
111
|
+
* websites: ['https://www.example.com'],
|
|
112
|
+
* },
|
|
113
|
+
* );
|
|
114
|
+
* ```
|
|
115
|
+
*/
|
|
116
|
+
updateProfile(senderID, body, options) {
|
|
117
|
+
return this._client.patch(path `/v1/senders/${senderID}/profile`, { body, ...options });
|
|
118
|
+
}
|
|
119
|
+
/**
|
|
120
|
+
* Upload a new profile picture for the WhatsApp Business profile. The image will
|
|
121
|
+
* be uploaded to Meta and set as the profile picture.
|
|
122
|
+
*
|
|
123
|
+
* @example
|
|
124
|
+
* ```ts
|
|
125
|
+
* const response = await client.senders.uploadProfilePicture(
|
|
126
|
+
* 'senderId',
|
|
127
|
+
* {
|
|
128
|
+
* imageUrl: 'https://example.com/profile.jpg',
|
|
129
|
+
* mimeType: 'image/jpeg',
|
|
130
|
+
* },
|
|
131
|
+
* );
|
|
132
|
+
* ```
|
|
133
|
+
*/
|
|
134
|
+
uploadProfilePicture(senderID, body, options) {
|
|
135
|
+
return this._client.post(path `/v1/senders/${senderID}/profile/picture`, { body, ...options });
|
|
136
|
+
}
|
|
47
137
|
}
|
|
48
138
|
//# sourceMappingURL=senders.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"senders.mjs","sourceRoot":"","sources":["../src/resources/senders.ts"],"names":[],"mappings":"AAAA,sFAAsF;OAE/E,EAAE,WAAW,EAAE;OAEf,EAAE,MAAM,EAAkC;OAC1C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EAAE;YACxD,GAAG,OAAO;YACV,OAAO,EAAE,YAAY,CAAC,CAAC,EAAE,MAAM,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,OAAO,CAAC,CAAC;SAC7D,CAAC,CAAC;IACL,CAAC;IAED;;;;;;;;;OASG;IACH,UAAU,CAAC,QAAgB,EAAE,OAAwB;QACnD,OAAO,IAAI,CAAC,OAAO,CAAC,GAAG,CAAC,IAAI,CAAA,eAAe,QAAQ,UAAU,EAAE,OAAO,CAAC,CAAC;IAC1E,CAAC;IAED;;;;;;;;;OASG;IACH,uBAAuB,CAAC,QAAgB,EAAE,OAAwB;QAChE,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,eAAe,QAAQ,iBAAiB,EAAE,OAAO,CAAC,CAAC;IAClF,CAAC;IAED;;;;;;;;;;;;;;;;;;OAkBG;IACH,aAAa,CACX,QAAgB,EAChB,IAA+B,EAC/B,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,KAAK,CAAC,IAAI,CAAA,eAAe,QAAQ,UAAU,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IACzF,CAAC;IAED;;;;;;;;;;;;;;OAcG;IACH,oBAAoB,CAClB,QAAgB,EAChB,IAAsC,EACtC,OAAwB;QAExB,OAAO,IAAI,CAAC,OAAO,CAAC,IAAI,CAAC,IAAI,CAAA,eAAe,QAAQ,kBAAkB,EAAE,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC,CAAC;IAChG,CAAC;CACF"}
|
package/src/client.ts
CHANGED
|
@@ -68,11 +68,18 @@ import {
|
|
|
68
68
|
SenderCreateParams,
|
|
69
69
|
SenderListParams,
|
|
70
70
|
SenderUpdateParams,
|
|
71
|
+
SenderUpdateProfileParams,
|
|
72
|
+
SenderUpdateProfileResponse,
|
|
73
|
+
SenderUploadProfilePictureParams,
|
|
74
|
+
SenderUploadProfilePictureResponse,
|
|
71
75
|
SenderWebhook,
|
|
72
76
|
Senders,
|
|
73
77
|
SendersCursor,
|
|
74
78
|
WebhookEvent,
|
|
75
79
|
WebhookSecretResponse,
|
|
80
|
+
WhatsappBusinessProfile,
|
|
81
|
+
WhatsappBusinessProfileResponse,
|
|
82
|
+
WhatsappBusinessProfileVertical,
|
|
76
83
|
} from './resources/senders';
|
|
77
84
|
import {
|
|
78
85
|
Template,
|
|
@@ -873,10 +880,17 @@ export declare namespace Zavudev {
|
|
|
873
880
|
type SenderWebhook as SenderWebhook,
|
|
874
881
|
type WebhookEvent as WebhookEvent,
|
|
875
882
|
type WebhookSecretResponse as WebhookSecretResponse,
|
|
883
|
+
type WhatsappBusinessProfile as WhatsappBusinessProfile,
|
|
884
|
+
type WhatsappBusinessProfileResponse as WhatsappBusinessProfileResponse,
|
|
885
|
+
type WhatsappBusinessProfileVertical as WhatsappBusinessProfileVertical,
|
|
886
|
+
type SenderUpdateProfileResponse as SenderUpdateProfileResponse,
|
|
887
|
+
type SenderUploadProfilePictureResponse as SenderUploadProfilePictureResponse,
|
|
876
888
|
type SendersCursor as SendersCursor,
|
|
877
889
|
type SenderCreateParams as SenderCreateParams,
|
|
878
890
|
type SenderUpdateParams as SenderUpdateParams,
|
|
879
891
|
type SenderListParams as SenderListParams,
|
|
892
|
+
type SenderUpdateProfileParams as SenderUpdateProfileParams,
|
|
893
|
+
type SenderUploadProfilePictureParams as SenderUploadProfilePictureParams,
|
|
880
894
|
};
|
|
881
895
|
|
|
882
896
|
export {
|
package/src/resources/index.ts
CHANGED
|
@@ -73,9 +73,16 @@ export {
|
|
|
73
73
|
type SenderWebhook,
|
|
74
74
|
type WebhookEvent,
|
|
75
75
|
type WebhookSecretResponse,
|
|
76
|
+
type WhatsappBusinessProfile,
|
|
77
|
+
type WhatsappBusinessProfileResponse,
|
|
78
|
+
type WhatsappBusinessProfileVertical,
|
|
79
|
+
type SenderUpdateProfileResponse,
|
|
80
|
+
type SenderUploadProfilePictureResponse,
|
|
76
81
|
type SenderCreateParams,
|
|
77
82
|
type SenderUpdateParams,
|
|
78
83
|
type SenderListParams,
|
|
84
|
+
type SenderUpdateProfileParams,
|
|
85
|
+
type SenderUploadProfilePictureParams,
|
|
79
86
|
type SendersCursor,
|
|
80
87
|
} from './senders';
|
|
81
88
|
export {
|
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
|
/**
|
|
@@ -132,6 +283,95 @@ export interface WebhookSecretResponse {
|
|
|
132
283
|
secret: string;
|
|
133
284
|
}
|
|
134
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
|
+
|
|
135
375
|
export interface SenderCreateParams {
|
|
136
376
|
name: string;
|
|
137
377
|
|
|
@@ -173,15 +413,66 @@ export interface SenderUpdateParams {
|
|
|
173
413
|
|
|
174
414
|
export interface SenderListParams extends CursorParams {}
|
|
175
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
|
+
|
|
176
460
|
export declare namespace Senders {
|
|
177
461
|
export {
|
|
178
462
|
type Sender as Sender,
|
|
179
463
|
type SenderWebhook as SenderWebhook,
|
|
180
464
|
type WebhookEvent as WebhookEvent,
|
|
181
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,
|
|
182
471
|
type SendersCursor as SendersCursor,
|
|
183
472
|
type SenderCreateParams as SenderCreateParams,
|
|
184
473
|
type SenderUpdateParams as SenderUpdateParams,
|
|
185
474
|
type SenderListParams as SenderListParams,
|
|
475
|
+
type SenderUpdateProfileParams as SenderUpdateProfileParams,
|
|
476
|
+
type SenderUploadProfilePictureParams as SenderUploadProfilePictureParams,
|
|
186
477
|
};
|
|
187
478
|
}
|