@sentdm/sentdm 0.7.2 → 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 +132 -0
- package/README.md +71 -34
- package/client.d.mts +49 -21
- package/client.d.mts.map +1 -1
- package/client.d.ts +49 -21
- package/client.d.ts.map +1 -1
- package/client.js +52 -38
- package/client.js.map +1 -1
- package/client.mjs +52 -38
- package/client.mjs.map +1 -1
- package/internal/tslib.js +17 -17
- package/internal/utils/log.d.mts.map +1 -1
- package/internal/utils/log.d.ts.map +1 -1
- package/internal/utils/log.js +0 -1
- package/internal/utils/log.js.map +1 -1
- package/internal/utils/log.mjs +0 -1
- package/internal/utils/log.mjs.map +1 -1
- package/internal/utils/query.d.mts +5 -0
- package/internal/utils/query.d.mts.map +1 -0
- package/internal/utils/query.d.ts +5 -0
- package/internal/utils/query.d.ts.map +1 -0
- package/internal/utils/query.js +23 -0
- package/internal/utils/query.js.map +1 -0
- package/internal/utils/query.mjs +20 -0
- package/internal/utils/query.mjs.map +1 -0
- package/internal/utils.d.mts +1 -0
- package/internal/utils.d.ts +1 -0
- package/internal/utils.js +1 -0
- package/internal/utils.js.map +1 -1
- package/internal/utils.mjs +1 -0
- package/package.json +7 -1
- package/resources/contacts.d.mts +243 -49
- package/resources/contacts.d.mts.map +1 -1
- package/resources/contacts.d.ts +243 -49
- package/resources/contacts.d.ts.map +1 -1
- package/resources/contacts.js +112 -15
- package/resources/contacts.js.map +1 -1
- package/resources/contacts.mjs +112 -15
- package/resources/contacts.mjs.map +1 -1
- package/resources/index.d.mts +8 -4
- package/resources/index.d.mts.map +1 -1
- package/resources/index.d.ts +8 -4
- package/resources/index.d.ts.map +1 -1
- package/resources/index.js +11 -3
- package/resources/index.js.map +1 -1
- package/resources/index.mjs +5 -1
- package/resources/index.mjs.map +1 -1
- package/resources/me.d.mts +269 -0
- package/resources/me.d.mts.map +1 -0
- package/resources/me.d.ts +269 -0
- package/resources/me.d.ts.map +1 -0
- package/resources/me.js +40 -0
- package/resources/me.js.map +1 -0
- package/resources/me.mjs +36 -0
- package/resources/me.mjs.map +1 -0
- package/resources/messages.d.mts +239 -133
- package/resources/messages.d.mts.map +1 -1
- package/resources/messages.d.ts +239 -133
- package/resources/messages.d.ts.map +1 -1
- package/resources/messages.js +42 -50
- package/resources/messages.js.map +1 -1
- package/resources/messages.mjs +42 -50
- package/resources/messages.mjs.map +1 -1
- package/resources/numbers.d.mts +70 -0
- package/resources/numbers.d.mts.map +1 -0
- package/resources/numbers.d.ts +70 -0
- package/resources/numbers.d.ts.map +1 -0
- package/resources/numbers.js +36 -0
- package/resources/numbers.js.map +1 -0
- package/resources/numbers.mjs +32 -0
- package/resources/numbers.mjs.map +1 -0
- package/resources/profiles/campaigns.d.mts +339 -0
- package/resources/profiles/campaigns.d.mts.map +1 -0
- package/resources/profiles/campaigns.d.ts +339 -0
- package/resources/profiles/campaigns.d.ts.map +1 -0
- package/resources/profiles/campaigns.js +148 -0
- package/resources/profiles/campaigns.js.map +1 -0
- package/resources/profiles/campaigns.mjs +144 -0
- package/resources/profiles/campaigns.mjs.map +1 -0
- package/resources/profiles/index.d.mts +3 -0
- package/resources/profiles/index.d.mts.map +1 -0
- package/resources/profiles/index.d.ts +3 -0
- package/resources/profiles/index.d.ts.map +1 -0
- package/resources/profiles/index.js +9 -0
- package/resources/profiles/index.js.map +1 -0
- package/resources/profiles/index.mjs +4 -0
- package/resources/profiles/index.mjs.map +1 -0
- package/resources/profiles/profiles.d.mts +967 -0
- package/resources/profiles/profiles.d.mts.map +1 -0
- package/resources/profiles/profiles.d.ts +967 -0
- package/resources/profiles/profiles.d.ts.map +1 -0
- package/resources/profiles/profiles.js +227 -0
- package/resources/profiles/profiles.js.map +1 -0
- package/resources/profiles/profiles.mjs +222 -0
- package/resources/profiles/profiles.mjs.map +1 -0
- package/resources/profiles.d.mts +2 -0
- package/resources/profiles.d.mts.map +1 -0
- package/resources/profiles.d.ts +2 -0
- package/resources/profiles.d.ts.map +1 -0
- package/resources/profiles.js +6 -0
- package/resources/profiles.js.map +1 -0
- package/resources/profiles.mjs +3 -0
- package/resources/profiles.mjs.map +1 -0
- package/resources/templates.d.mts +327 -191
- package/resources/templates.d.mts.map +1 -1
- package/resources/templates.d.ts +327 -191
- package/resources/templates.d.ts.map +1 -1
- package/resources/templates.js +80 -35
- package/resources/templates.js.map +1 -1
- package/resources/templates.mjs +80 -35
- package/resources/templates.mjs.map +1 -1
- package/resources/users.d.mts +251 -0
- package/resources/users.d.mts.map +1 -0
- package/resources/users.d.ts +251 -0
- package/resources/users.d.ts.map +1 -0
- package/resources/users.js +124 -0
- package/resources/users.js.map +1 -0
- package/resources/users.mjs +120 -0
- package/resources/users.mjs.map +1 -0
- package/resources/webhooks.d.mts +639 -0
- package/resources/webhooks.d.mts.map +1 -0
- package/resources/webhooks.d.ts +639 -0
- package/resources/webhooks.d.ts.map +1 -0
- package/resources/webhooks.js +237 -0
- package/resources/webhooks.js.map +1 -0
- package/resources/webhooks.mjs +233 -0
- package/resources/webhooks.mjs.map +1 -0
- package/src/client.ts +228 -80
- package/src/internal/utils/log.ts +0 -1
- package/src/internal/utils/query.ts +23 -0
- package/src/internal/utils.ts +1 -0
- package/src/resources/contacts.ts +335 -57
- package/src/resources/index.ts +81 -12
- package/src/resources/me.ts +333 -0
- package/src/resources/messages.ts +306 -147
- package/src/resources/numbers.ts +102 -0
- package/src/resources/profiles/campaigns.ts +501 -0
- package/src/resources/profiles/index.ts +38 -0
- package/src/resources/profiles/profiles.ts +1302 -0
- package/src/resources/profiles.ts +3 -0
- package/src/resources/templates.ts +424 -202
- package/src/resources/users.ts +366 -0
- package/src/resources/webhooks.ts +923 -0
- package/src/version.ts +1 -1
- package/version.d.mts +1 -1
- package/version.d.mts.map +1 -1
- package/version.d.ts +1 -1
- package/version.d.ts.map +1 -1
- package/version.js +1 -1
- package/version.js.map +1 -1
- package/version.mjs +1 -1
- package/version.mjs.map +1 -1
- package/resources/number-lookup.d.mts +0 -59
- package/resources/number-lookup.d.mts.map +0 -1
- package/resources/number-lookup.d.ts +0 -59
- package/resources/number-lookup.d.ts.map +0 -1
- package/resources/number-lookup.js +0 -17
- package/resources/number-lookup.js.map +0 -1
- package/resources/number-lookup.mjs +0 -13
- package/resources/number-lookup.mjs.map +0 -1
- package/src/resources/number-lookup.ts +0 -80
|
@@ -2,74 +2,124 @@
|
|
|
2
2
|
|
|
3
3
|
import { APIResource } from '../core/resource';
|
|
4
4
|
import * as TemplatesAPI from './templates';
|
|
5
|
+
import * as WebhooksAPI from './webhooks';
|
|
5
6
|
import { APIPromise } from '../core/api-promise';
|
|
6
7
|
import { buildHeaders } from '../internal/headers';
|
|
7
8
|
import { RequestOptions } from '../internal/request-options';
|
|
8
9
|
import { path } from '../internal/utils/path';
|
|
9
10
|
|
|
11
|
+
/**
|
|
12
|
+
* Manage message templates with variable substitution
|
|
13
|
+
*/
|
|
10
14
|
export class Templates extends APIResource {
|
|
11
15
|
/**
|
|
12
|
-
* Creates a new message template
|
|
13
|
-
* template
|
|
14
|
-
*
|
|
15
|
-
* category). Optionally submits the template for WhatsApp review. The customer ID
|
|
16
|
-
* is extracted from the authentication token.
|
|
16
|
+
* Creates a new message template with header, body, footer, and buttons. The
|
|
17
|
+
* template can be submitted for review immediately or saved as draft for later
|
|
18
|
+
* submission.
|
|
17
19
|
*
|
|
18
20
|
* @example
|
|
19
21
|
* ```ts
|
|
20
|
-
* const
|
|
21
|
-
* definition: { body: {} },
|
|
22
|
-
* });
|
|
22
|
+
* const apiResponseTemplate = await client.templates.create();
|
|
23
23
|
* ```
|
|
24
24
|
*/
|
|
25
|
-
create(
|
|
26
|
-
|
|
25
|
+
create(params: TemplateCreateParams, options?: RequestOptions): APIPromise<APIResponseTemplate> {
|
|
26
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
27
|
+
return this._client.post('/v3/templates', {
|
|
28
|
+
body,
|
|
29
|
+
...options,
|
|
30
|
+
headers: buildHeaders([
|
|
31
|
+
{
|
|
32
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
33
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
34
|
+
},
|
|
35
|
+
options?.headers,
|
|
36
|
+
]),
|
|
37
|
+
});
|
|
27
38
|
}
|
|
28
39
|
|
|
29
40
|
/**
|
|
30
|
-
* Retrieves a specific
|
|
31
|
-
*
|
|
32
|
-
* headers, body, footer, and interactive buttons. The customer ID is extracted
|
|
33
|
-
* from the authentication token.
|
|
41
|
+
* Retrieves a specific template by its ID. Returns template details including
|
|
42
|
+
* name, category, language, status, and definition.
|
|
34
43
|
*
|
|
35
44
|
* @example
|
|
36
45
|
* ```ts
|
|
37
|
-
* const
|
|
46
|
+
* const apiResponseTemplate = await client.templates.retrieve(
|
|
38
47
|
* '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
39
48
|
* );
|
|
40
49
|
* ```
|
|
41
50
|
*/
|
|
42
|
-
retrieve(
|
|
43
|
-
|
|
51
|
+
retrieve(
|
|
52
|
+
id: string,
|
|
53
|
+
params: TemplateRetrieveParams | null | undefined = {},
|
|
54
|
+
options?: RequestOptions,
|
|
55
|
+
): APIPromise<APIResponseTemplate> {
|
|
56
|
+
const { 'x-profile-id': xProfileID } = params ?? {};
|
|
57
|
+
return this._client.get(path`/v3/templates/${id}`, {
|
|
58
|
+
...options,
|
|
59
|
+
headers: buildHeaders([
|
|
60
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
61
|
+
options?.headers,
|
|
62
|
+
]),
|
|
63
|
+
});
|
|
44
64
|
}
|
|
45
65
|
|
|
46
66
|
/**
|
|
47
|
-
*
|
|
48
|
-
*
|
|
49
|
-
*
|
|
50
|
-
*
|
|
51
|
-
*
|
|
67
|
+
* Updates an existing template's name, category, language, definition, or submits
|
|
68
|
+
* it for review.
|
|
69
|
+
*
|
|
70
|
+
* @example
|
|
71
|
+
* ```ts
|
|
72
|
+
* const apiResponseTemplate = await client.templates.update(
|
|
73
|
+
* '7ba7b820-9dad-11d1-80b4-00c04fd430c8',
|
|
74
|
+
* );
|
|
75
|
+
* ```
|
|
76
|
+
*/
|
|
77
|
+
update(
|
|
78
|
+
id: string,
|
|
79
|
+
params: TemplateUpdateParams,
|
|
80
|
+
options?: RequestOptions,
|
|
81
|
+
): APIPromise<APIResponseTemplate> {
|
|
82
|
+
const { 'Idempotency-Key': idempotencyKey, 'x-profile-id': xProfileID, ...body } = params;
|
|
83
|
+
return this._client.put(path`/v3/templates/${id}`, {
|
|
84
|
+
body,
|
|
85
|
+
...options,
|
|
86
|
+
headers: buildHeaders([
|
|
87
|
+
{
|
|
88
|
+
...(idempotencyKey != null ? { 'Idempotency-Key': idempotencyKey } : undefined),
|
|
89
|
+
...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined),
|
|
90
|
+
},
|
|
91
|
+
options?.headers,
|
|
92
|
+
]),
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* Retrieves a paginated list of message templates for the authenticated customer.
|
|
98
|
+
* Supports filtering by status, category, and search term.
|
|
52
99
|
*
|
|
53
100
|
* @example
|
|
54
101
|
* ```ts
|
|
55
102
|
* const templates = await client.templates.list({
|
|
56
103
|
* page: 0,
|
|
57
|
-
*
|
|
104
|
+
* page_size: 0,
|
|
58
105
|
* });
|
|
59
106
|
* ```
|
|
60
107
|
*/
|
|
61
|
-
list(
|
|
62
|
-
|
|
108
|
+
list(params: TemplateListParams, options?: RequestOptions): APIPromise<TemplateListResponse> {
|
|
109
|
+
const { 'x-profile-id': xProfileID, ...query } = params;
|
|
110
|
+
return this._client.get('/v3/templates', {
|
|
111
|
+
query,
|
|
112
|
+
...options,
|
|
113
|
+
headers: buildHeaders([
|
|
114
|
+
{ ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
115
|
+
options?.headers,
|
|
116
|
+
]),
|
|
117
|
+
});
|
|
63
118
|
}
|
|
64
119
|
|
|
65
120
|
/**
|
|
66
|
-
* Deletes a
|
|
67
|
-
*
|
|
68
|
-
* template has NO messages: Permanently deleted from database (hard delete). - If
|
|
69
|
-
* template has messages: Marked as deleted but preserved for message history (soft
|
|
70
|
-
* delete with snapshot). The template must exist and belong to the authenticated
|
|
71
|
-
* customer to be deleted successfully. The customer ID is extracted from the
|
|
72
|
-
* authentication token.
|
|
121
|
+
* Deletes a template by ID. Optionally, you can also delete the template from
|
|
122
|
+
* WhatsApp/Meta by setting delete_from_meta=true.
|
|
73
123
|
*
|
|
74
124
|
* @example
|
|
75
125
|
* ```ts
|
|
@@ -78,252 +128,267 @@ export class Templates extends APIResource {
|
|
|
78
128
|
* );
|
|
79
129
|
* ```
|
|
80
130
|
*/
|
|
81
|
-
delete(id: string, options?: RequestOptions): APIPromise<void> {
|
|
82
|
-
|
|
131
|
+
delete(id: string, params: TemplateDeleteParams, options?: RequestOptions): APIPromise<void> {
|
|
132
|
+
const { 'x-profile-id': xProfileID, ...body } = params;
|
|
133
|
+
return this._client.delete(path`/v3/templates/${id}`, {
|
|
134
|
+
body,
|
|
83
135
|
...options,
|
|
84
|
-
headers: buildHeaders([
|
|
136
|
+
headers: buildHeaders([
|
|
137
|
+
{ Accept: '*/*', ...(xProfileID != null ? { 'x-profile-id': xProfileID } : undefined) },
|
|
138
|
+
options?.headers,
|
|
139
|
+
]),
|
|
85
140
|
});
|
|
86
141
|
}
|
|
87
142
|
}
|
|
88
143
|
|
|
89
|
-
export interface TemplateBodyContent {
|
|
90
|
-
template?: string;
|
|
91
|
-
|
|
92
|
-
type?: string | null;
|
|
93
|
-
|
|
94
|
-
variables?: Array<TemplateVariable> | null;
|
|
95
|
-
}
|
|
96
|
-
|
|
97
144
|
/**
|
|
98
|
-
*
|
|
99
|
-
* buttons
|
|
145
|
+
* Standard API response envelope for all v3 endpoints
|
|
100
146
|
*/
|
|
101
|
-
export interface
|
|
147
|
+
export interface APIResponseTemplate {
|
|
102
148
|
/**
|
|
103
|
-
*
|
|
104
|
-
* SMS-specific, or WhatsApp-specific)
|
|
149
|
+
* Template response for v3 API
|
|
105
150
|
*/
|
|
106
|
-
|
|
151
|
+
data?: Template | null;
|
|
107
152
|
|
|
108
153
|
/**
|
|
109
|
-
*
|
|
154
|
+
* Error information
|
|
110
155
|
*/
|
|
111
|
-
|
|
156
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
112
157
|
|
|
113
158
|
/**
|
|
114
|
-
*
|
|
159
|
+
* Request and response metadata
|
|
115
160
|
*/
|
|
116
|
-
|
|
161
|
+
meta?: WebhooksAPI.APIMeta;
|
|
117
162
|
|
|
118
163
|
/**
|
|
119
|
-
*
|
|
164
|
+
* Indicates whether the request was successful
|
|
120
165
|
*/
|
|
121
|
-
|
|
166
|
+
success?: boolean;
|
|
167
|
+
}
|
|
122
168
|
|
|
169
|
+
/**
|
|
170
|
+
* Configuration for AUTHENTICATION category templates
|
|
171
|
+
*/
|
|
172
|
+
export interface SentDmServicesCommonContractsPocOsAuthenticationConfig {
|
|
123
173
|
/**
|
|
124
|
-
*
|
|
174
|
+
* Whether to add the security recommendation text: "For your security, do not
|
|
175
|
+
* share this code."
|
|
125
176
|
*/
|
|
126
|
-
|
|
177
|
+
addSecurityRecommendation?: boolean;
|
|
127
178
|
|
|
128
179
|
/**
|
|
129
|
-
*
|
|
180
|
+
* Code expiration time in minutes (1-90). If set, adds footer: "This code expires
|
|
181
|
+
* in X minutes."
|
|
130
182
|
*/
|
|
131
|
-
|
|
183
|
+
codeExpirationMinutes?: number | null;
|
|
132
184
|
}
|
|
133
185
|
|
|
134
|
-
|
|
186
|
+
/**
|
|
187
|
+
* Body section of a message template with channel-specific content
|
|
188
|
+
*/
|
|
189
|
+
export interface SentDmServicesCommonContractsPocOsTemplateBody {
|
|
135
190
|
/**
|
|
136
|
-
*
|
|
137
|
-
*
|
|
191
|
+
* Content that will be used for all channels (SMS and WhatsApp) unless
|
|
192
|
+
* channel-specific content is provided
|
|
138
193
|
*/
|
|
139
|
-
|
|
140
|
-
/**
|
|
141
|
-
* Content that will be used for all channels (SMS and WhatsApp) unless
|
|
142
|
-
* channel-specific content is provided
|
|
143
|
-
*/
|
|
144
|
-
multiChannel?: TemplatesAPI.TemplateBodyContent | null;
|
|
145
|
-
|
|
146
|
-
/**
|
|
147
|
-
* SMS-specific content that overrides multi-channel content for SMS messages
|
|
148
|
-
*/
|
|
149
|
-
sms?: TemplatesAPI.TemplateBodyContent | null;
|
|
150
|
-
|
|
151
|
-
/**
|
|
152
|
-
* WhatsApp-specific content that overrides multi-channel content for WhatsApp
|
|
153
|
-
* messages
|
|
154
|
-
*/
|
|
155
|
-
whatsapp?: TemplatesAPI.TemplateBodyContent | null;
|
|
156
|
-
}
|
|
194
|
+
multiChannel?: TemplateBodyContent | null;
|
|
157
195
|
|
|
158
196
|
/**
|
|
159
|
-
*
|
|
197
|
+
* SMS-specific content that overrides multi-channel content for SMS messages
|
|
160
198
|
*/
|
|
161
|
-
|
|
162
|
-
/**
|
|
163
|
-
* Whether to add the security recommendation text: "For your security, do not
|
|
164
|
-
* share this code."
|
|
165
|
-
*/
|
|
166
|
-
addSecurityRecommendation?: boolean;
|
|
199
|
+
sms?: TemplateBodyContent | null;
|
|
167
200
|
|
|
168
|
-
|
|
169
|
-
|
|
170
|
-
|
|
171
|
-
|
|
172
|
-
|
|
173
|
-
|
|
201
|
+
/**
|
|
202
|
+
* WhatsApp-specific content that overrides multi-channel content for WhatsApp
|
|
203
|
+
* messages
|
|
204
|
+
*/
|
|
205
|
+
whatsapp?: TemplateBodyContent | null;
|
|
206
|
+
}
|
|
174
207
|
|
|
208
|
+
/**
|
|
209
|
+
* Interactive button in a message template
|
|
210
|
+
*/
|
|
211
|
+
export interface SentDmServicesCommonContractsPocOsTemplateButton {
|
|
175
212
|
/**
|
|
176
|
-
*
|
|
213
|
+
* The unique identifier of the button (1-based index)
|
|
177
214
|
*/
|
|
178
|
-
|
|
179
|
-
/**
|
|
180
|
-
* The unique identifier of the button (1-based index)
|
|
181
|
-
*/
|
|
182
|
-
id?: number;
|
|
215
|
+
id?: number;
|
|
183
216
|
|
|
184
|
-
|
|
185
|
-
|
|
186
|
-
|
|
187
|
-
|
|
217
|
+
/**
|
|
218
|
+
* Properties specific to the button type
|
|
219
|
+
*/
|
|
220
|
+
props?: SentDmServicesCommonContractsPocOsTemplateButtonProps;
|
|
188
221
|
|
|
189
|
-
|
|
190
|
-
|
|
191
|
-
|
|
192
|
-
|
|
193
|
-
|
|
222
|
+
/**
|
|
223
|
+
* The type of button (e.g., QUICK_REPLY, URL, PHONE_NUMBER, VOICE_CALL, COPY_CODE)
|
|
224
|
+
*/
|
|
225
|
+
type?: string;
|
|
226
|
+
}
|
|
194
227
|
|
|
195
|
-
|
|
196
|
-
|
|
197
|
-
* Properties specific to the button type
|
|
198
|
-
*/
|
|
199
|
-
export interface Props {
|
|
200
|
-
activeFor?: number | null;
|
|
228
|
+
export interface SentDmServicesCommonContractsPocOsTemplateButtonProps {
|
|
229
|
+
activeFor?: number | null;
|
|
201
230
|
|
|
202
|
-
|
|
231
|
+
autofillText?: string | null;
|
|
203
232
|
|
|
204
|
-
|
|
233
|
+
countryCode?: string | null;
|
|
205
234
|
|
|
206
|
-
|
|
235
|
+
offerCode?: string | null;
|
|
207
236
|
|
|
208
|
-
|
|
237
|
+
otpType?: string | null;
|
|
209
238
|
|
|
210
|
-
|
|
239
|
+
packageName?: string | null;
|
|
211
240
|
|
|
212
|
-
|
|
241
|
+
phoneNumber?: string | null;
|
|
213
242
|
|
|
214
|
-
|
|
243
|
+
quickReplyType?: string | null;
|
|
215
244
|
|
|
216
|
-
|
|
245
|
+
signatureHash?: string | null;
|
|
217
246
|
|
|
218
|
-
|
|
247
|
+
text?: string | null;
|
|
219
248
|
|
|
220
|
-
|
|
249
|
+
url?: string | null;
|
|
221
250
|
|
|
222
|
-
|
|
223
|
-
|
|
224
|
-
}
|
|
251
|
+
urlType?: string | null;
|
|
252
|
+
}
|
|
225
253
|
|
|
254
|
+
/**
|
|
255
|
+
* Footer section of a message template
|
|
256
|
+
*/
|
|
257
|
+
export interface SentDmServicesCommonContractsPocOsTemplateFooter {
|
|
226
258
|
/**
|
|
227
|
-
*
|
|
259
|
+
* The footer template text with optional variable placeholders
|
|
228
260
|
*/
|
|
229
|
-
|
|
230
|
-
/**
|
|
231
|
-
* The footer template text with optional variable placeholders
|
|
232
|
-
*/
|
|
233
|
-
template?: string;
|
|
261
|
+
template?: string;
|
|
234
262
|
|
|
235
|
-
|
|
236
|
-
|
|
237
|
-
|
|
238
|
-
|
|
263
|
+
/**
|
|
264
|
+
* The type of footer (typically "text")
|
|
265
|
+
*/
|
|
266
|
+
type?: string | null;
|
|
239
267
|
|
|
240
|
-
|
|
241
|
-
|
|
242
|
-
|
|
243
|
-
|
|
244
|
-
|
|
268
|
+
/**
|
|
269
|
+
* List of variables used in the footer template
|
|
270
|
+
*/
|
|
271
|
+
variables?: Array<TemplateVariable> | null;
|
|
272
|
+
}
|
|
245
273
|
|
|
274
|
+
/**
|
|
275
|
+
* Header section of a message template
|
|
276
|
+
*/
|
|
277
|
+
export interface SentDmServicesCommonContractsPocOsTemplateHeader {
|
|
246
278
|
/**
|
|
247
|
-
*
|
|
279
|
+
* The header template text with optional variable placeholders (e.g., "Welcome to
|
|
280
|
+
* {{0:variable}}")
|
|
248
281
|
*/
|
|
249
|
-
|
|
250
|
-
/**
|
|
251
|
-
* The header template text with optional variable placeholders (e.g., "Welcome to
|
|
252
|
-
* {{0:variable}}")
|
|
253
|
-
*/
|
|
254
|
-
template?: string;
|
|
282
|
+
template?: string;
|
|
255
283
|
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
259
|
-
|
|
284
|
+
/**
|
|
285
|
+
* The type of header (e.g., "text", "image", "video", "document")
|
|
286
|
+
*/
|
|
287
|
+
type?: string | null;
|
|
260
288
|
|
|
261
|
-
|
|
262
|
-
|
|
263
|
-
|
|
264
|
-
|
|
265
|
-
}
|
|
289
|
+
/**
|
|
290
|
+
* List of variables used in the header template
|
|
291
|
+
*/
|
|
292
|
+
variables?: Array<TemplateVariable> | null;
|
|
266
293
|
}
|
|
267
294
|
|
|
268
295
|
/**
|
|
269
|
-
*
|
|
270
|
-
* structure
|
|
296
|
+
* Template response for v3 API
|
|
271
297
|
*/
|
|
272
|
-
export interface
|
|
298
|
+
export interface Template {
|
|
273
299
|
/**
|
|
274
|
-
*
|
|
300
|
+
* Unique template identifier
|
|
275
301
|
*/
|
|
276
302
|
id?: string;
|
|
277
303
|
|
|
278
304
|
/**
|
|
279
|
-
*
|
|
305
|
+
* Template category: MARKETING, UTILITY, AUTHENTICATION
|
|
280
306
|
*/
|
|
281
307
|
category?: string;
|
|
282
308
|
|
|
283
309
|
/**
|
|
284
|
-
*
|
|
310
|
+
* Supported channels: sms, whatsapp
|
|
285
311
|
*/
|
|
286
|
-
|
|
312
|
+
channels?: Array<string> | null;
|
|
287
313
|
|
|
288
314
|
/**
|
|
289
|
-
*
|
|
315
|
+
* When the template was created
|
|
290
316
|
*/
|
|
291
|
-
|
|
317
|
+
created_at?: string;
|
|
292
318
|
|
|
293
319
|
/**
|
|
294
|
-
*
|
|
320
|
+
* Whether the template is published and active
|
|
295
321
|
*/
|
|
296
|
-
|
|
322
|
+
is_published?: boolean;
|
|
297
323
|
|
|
298
324
|
/**
|
|
299
|
-
*
|
|
325
|
+
* Template language code (e.g., en_US)
|
|
300
326
|
*/
|
|
301
|
-
|
|
327
|
+
language?: string;
|
|
302
328
|
|
|
303
329
|
/**
|
|
304
|
-
*
|
|
330
|
+
* Template display name
|
|
305
331
|
*/
|
|
306
|
-
|
|
332
|
+
name?: string;
|
|
307
333
|
|
|
308
334
|
/**
|
|
309
|
-
*
|
|
335
|
+
* Template status: APPROVED, PENDING, REJECTED
|
|
310
336
|
*/
|
|
311
337
|
status?: string;
|
|
312
338
|
|
|
313
339
|
/**
|
|
314
|
-
*
|
|
340
|
+
* When the template was last updated
|
|
315
341
|
*/
|
|
316
|
-
|
|
342
|
+
updated_at?: string | null;
|
|
317
343
|
|
|
318
344
|
/**
|
|
319
|
-
*
|
|
345
|
+
* Template variables for personalization
|
|
320
346
|
*/
|
|
321
|
-
|
|
347
|
+
variables?: Array<string> | null;
|
|
348
|
+
}
|
|
349
|
+
|
|
350
|
+
export interface TemplateBodyContent {
|
|
351
|
+
template?: string;
|
|
352
|
+
|
|
353
|
+
type?: string | null;
|
|
322
354
|
|
|
355
|
+
variables?: Array<TemplateVariable> | null;
|
|
356
|
+
}
|
|
357
|
+
|
|
358
|
+
/**
|
|
359
|
+
* Complete definition of a message template including header, body, footer, and
|
|
360
|
+
* buttons
|
|
361
|
+
*/
|
|
362
|
+
export interface TemplateDefinition {
|
|
323
363
|
/**
|
|
324
|
-
*
|
|
364
|
+
* Body section of a message template with channel-specific content
|
|
325
365
|
*/
|
|
326
|
-
|
|
366
|
+
body: SentDmServicesCommonContractsPocOsTemplateBody;
|
|
367
|
+
|
|
368
|
+
/**
|
|
369
|
+
* Configuration for AUTHENTICATION category templates
|
|
370
|
+
*/
|
|
371
|
+
authenticationConfig?: SentDmServicesCommonContractsPocOsAuthenticationConfig | null;
|
|
372
|
+
|
|
373
|
+
/**
|
|
374
|
+
* Optional list of interactive buttons (e.g., quick replies, URLs, phone numbers)
|
|
375
|
+
*/
|
|
376
|
+
buttons?: Array<SentDmServicesCommonContractsPocOsTemplateButton> | null;
|
|
377
|
+
|
|
378
|
+
/**
|
|
379
|
+
* The version of the template definition format
|
|
380
|
+
*/
|
|
381
|
+
definitionVersion?: string | null;
|
|
382
|
+
|
|
383
|
+
/**
|
|
384
|
+
* Footer section of a message template
|
|
385
|
+
*/
|
|
386
|
+
footer?: SentDmServicesCommonContractsPocOsTemplateFooter | null;
|
|
387
|
+
|
|
388
|
+
/**
|
|
389
|
+
* Header section of a message template
|
|
390
|
+
*/
|
|
391
|
+
header?: SentDmServicesCommonContractsPocOsTemplateHeader | null;
|
|
327
392
|
}
|
|
328
393
|
|
|
329
394
|
export interface TemplateVariable {
|
|
@@ -342,6 +407,8 @@ export namespace TemplateVariable {
|
|
|
342
407
|
|
|
343
408
|
mediaType?: string | null;
|
|
344
409
|
|
|
410
|
+
regex?: string | null;
|
|
411
|
+
|
|
345
412
|
sample?: string | null;
|
|
346
413
|
|
|
347
414
|
shortUrl?: string | null;
|
|
@@ -352,79 +419,234 @@ export namespace TemplateVariable {
|
|
|
352
419
|
}
|
|
353
420
|
}
|
|
354
421
|
|
|
422
|
+
/**
|
|
423
|
+
* Standard API response envelope for all v3 endpoints
|
|
424
|
+
*/
|
|
355
425
|
export interface TemplateListResponse {
|
|
356
|
-
|
|
426
|
+
/**
|
|
427
|
+
* Paginated list of templates
|
|
428
|
+
*/
|
|
429
|
+
data?: TemplateListResponse.Data | null;
|
|
357
430
|
|
|
358
|
-
|
|
431
|
+
/**
|
|
432
|
+
* Error information
|
|
433
|
+
*/
|
|
434
|
+
error?: WebhooksAPI.ErrorDetail | null;
|
|
435
|
+
|
|
436
|
+
/**
|
|
437
|
+
* Request and response metadata
|
|
438
|
+
*/
|
|
439
|
+
meta?: WebhooksAPI.APIMeta;
|
|
359
440
|
|
|
360
|
-
|
|
441
|
+
/**
|
|
442
|
+
* Indicates whether the request was successful
|
|
443
|
+
*/
|
|
444
|
+
success?: boolean;
|
|
445
|
+
}
|
|
361
446
|
|
|
362
|
-
|
|
447
|
+
export namespace TemplateListResponse {
|
|
448
|
+
/**
|
|
449
|
+
* Paginated list of templates
|
|
450
|
+
*/
|
|
451
|
+
export interface Data {
|
|
452
|
+
/**
|
|
453
|
+
* Pagination metadata for list responses
|
|
454
|
+
*/
|
|
455
|
+
pagination?: WebhooksAPI.PaginationMeta;
|
|
363
456
|
|
|
364
|
-
|
|
457
|
+
/**
|
|
458
|
+
* List of templates
|
|
459
|
+
*/
|
|
460
|
+
templates?: Array<TemplatesAPI.Template>;
|
|
461
|
+
}
|
|
365
462
|
}
|
|
366
463
|
|
|
367
464
|
export interface TemplateCreateParams {
|
|
368
465
|
/**
|
|
369
|
-
*
|
|
466
|
+
* Body param: Template category: MARKETING, UTILITY, AUTHENTICATION (optional,
|
|
467
|
+
* auto-detected if not provided)
|
|
468
|
+
*/
|
|
469
|
+
category?: string | null;
|
|
470
|
+
|
|
471
|
+
/**
|
|
472
|
+
* Body param: Source of template creation (default: from-api)
|
|
370
473
|
*/
|
|
371
|
-
|
|
474
|
+
creation_source?: string | null;
|
|
372
475
|
|
|
373
476
|
/**
|
|
374
|
-
*
|
|
375
|
-
*
|
|
376
|
-
|
|
477
|
+
* Body param: Complete definition of a message template including header, body,
|
|
478
|
+
* footer, and buttons
|
|
479
|
+
*/
|
|
480
|
+
definition?: TemplateDefinition;
|
|
481
|
+
|
|
482
|
+
/**
|
|
483
|
+
* Body param: Template language code (e.g., en_US) (optional, auto-detected if not
|
|
484
|
+
* provided)
|
|
485
|
+
*/
|
|
486
|
+
language?: string | null;
|
|
487
|
+
|
|
488
|
+
/**
|
|
489
|
+
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
490
|
+
* effects Useful for testing integrations without actual execution
|
|
491
|
+
*/
|
|
492
|
+
sandbox?: boolean;
|
|
493
|
+
|
|
494
|
+
/**
|
|
495
|
+
* Body param: Whether to submit the template for review after creation (default:
|
|
496
|
+
* false)
|
|
497
|
+
*/
|
|
498
|
+
submit_for_review?: boolean;
|
|
499
|
+
|
|
500
|
+
/**
|
|
501
|
+
* Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
502
|
+
* alphanumeric characters, hyphens, or underscores. Responses are cached for 24
|
|
503
|
+
* hours per key per customer.
|
|
504
|
+
*/
|
|
505
|
+
'Idempotency-Key'?: string;
|
|
506
|
+
|
|
507
|
+
/**
|
|
508
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
509
|
+
* organization API keys can use this header. The profile must belong to the
|
|
510
|
+
* calling organization.
|
|
511
|
+
*/
|
|
512
|
+
'x-profile-id'?: string;
|
|
513
|
+
}
|
|
514
|
+
|
|
515
|
+
export interface TemplateRetrieveParams {
|
|
516
|
+
/**
|
|
517
|
+
* Profile UUID to scope the request to a child profile. Only organization API keys
|
|
518
|
+
* can use this header. The profile must belong to the calling organization.
|
|
519
|
+
*/
|
|
520
|
+
'x-profile-id'?: string;
|
|
521
|
+
}
|
|
522
|
+
|
|
523
|
+
export interface TemplateUpdateParams {
|
|
524
|
+
/**
|
|
525
|
+
* Body param: Template category: MARKETING, UTILITY, AUTHENTICATION
|
|
377
526
|
*/
|
|
378
527
|
category?: string | null;
|
|
379
528
|
|
|
380
529
|
/**
|
|
381
|
-
*
|
|
382
|
-
*
|
|
530
|
+
* Body param: Complete definition of a message template including header, body,
|
|
531
|
+
* footer, and buttons
|
|
532
|
+
*/
|
|
533
|
+
definition?: TemplateDefinition | null;
|
|
534
|
+
|
|
535
|
+
/**
|
|
536
|
+
* Body param: Template language code (e.g., en_US)
|
|
383
537
|
*/
|
|
384
538
|
language?: string | null;
|
|
385
539
|
|
|
386
540
|
/**
|
|
387
|
-
*
|
|
388
|
-
* submitted for review.
|
|
541
|
+
* Body param: Template display name
|
|
389
542
|
*/
|
|
390
|
-
|
|
543
|
+
name?: string | null;
|
|
544
|
+
|
|
545
|
+
/**
|
|
546
|
+
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
547
|
+
* effects Useful for testing integrations without actual execution
|
|
548
|
+
*/
|
|
549
|
+
sandbox?: boolean;
|
|
550
|
+
|
|
551
|
+
/**
|
|
552
|
+
* Body param: Whether to submit the template for review after updating (default:
|
|
553
|
+
* false)
|
|
554
|
+
*/
|
|
555
|
+
submit_for_review?: boolean;
|
|
556
|
+
|
|
557
|
+
/**
|
|
558
|
+
* Header param: Unique key to ensure idempotent request processing. Must be 1-255
|
|
559
|
+
* alphanumeric characters, hyphens, or underscores. Responses are cached for 24
|
|
560
|
+
* hours per key per customer.
|
|
561
|
+
*/
|
|
562
|
+
'Idempotency-Key'?: string;
|
|
563
|
+
|
|
564
|
+
/**
|
|
565
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
566
|
+
* organization API keys can use this header. The profile must belong to the
|
|
567
|
+
* calling organization.
|
|
568
|
+
*/
|
|
569
|
+
'x-profile-id'?: string;
|
|
391
570
|
}
|
|
392
571
|
|
|
393
572
|
export interface TemplateListParams {
|
|
394
573
|
/**
|
|
395
|
-
*
|
|
574
|
+
* Query param: Page number (1-indexed)
|
|
396
575
|
*/
|
|
397
576
|
page: number;
|
|
398
577
|
|
|
399
578
|
/**
|
|
400
|
-
*
|
|
579
|
+
* Query param: Number of items per page
|
|
401
580
|
*/
|
|
402
|
-
|
|
581
|
+
page_size: number;
|
|
403
582
|
|
|
404
583
|
/**
|
|
405
|
-
*
|
|
584
|
+
* Query param: Optional category filter: MARKETING, UTILITY, AUTHENTICATION
|
|
406
585
|
*/
|
|
407
586
|
category?: string | null;
|
|
408
587
|
|
|
409
588
|
/**
|
|
410
|
-
*
|
|
589
|
+
* Query param: Optional filter by welcome playground flag
|
|
590
|
+
*/
|
|
591
|
+
is_welcome_playground?: boolean | null;
|
|
592
|
+
|
|
593
|
+
/**
|
|
594
|
+
* Query param: Optional search term for filtering templates
|
|
411
595
|
*/
|
|
412
596
|
search?: string | null;
|
|
413
597
|
|
|
414
598
|
/**
|
|
415
|
-
*
|
|
599
|
+
* Query param: Optional status filter: APPROVED, PENDING, REJECTED
|
|
416
600
|
*/
|
|
417
601
|
status?: string | null;
|
|
602
|
+
|
|
603
|
+
/**
|
|
604
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
605
|
+
* organization API keys can use this header. The profile must belong to the
|
|
606
|
+
* calling organization.
|
|
607
|
+
*/
|
|
608
|
+
'x-profile-id'?: string;
|
|
609
|
+
}
|
|
610
|
+
|
|
611
|
+
export interface TemplateDeleteParams {
|
|
612
|
+
/**
|
|
613
|
+
* Body param: Whether to also delete the template from WhatsApp/Meta (optional,
|
|
614
|
+
* defaults to false)
|
|
615
|
+
*/
|
|
616
|
+
delete_from_meta?: boolean | null;
|
|
617
|
+
|
|
618
|
+
/**
|
|
619
|
+
* Body param: Sandbox flag - when true, the operation is simulated without side
|
|
620
|
+
* effects Useful for testing integrations without actual execution
|
|
621
|
+
*/
|
|
622
|
+
sandbox?: boolean;
|
|
623
|
+
|
|
624
|
+
/**
|
|
625
|
+
* Header param: Profile UUID to scope the request to a child profile. Only
|
|
626
|
+
* organization API keys can use this header. The profile must belong to the
|
|
627
|
+
* calling organization.
|
|
628
|
+
*/
|
|
629
|
+
'x-profile-id'?: string;
|
|
418
630
|
}
|
|
419
631
|
|
|
420
632
|
export declare namespace Templates {
|
|
421
633
|
export {
|
|
634
|
+
type APIResponseTemplate as APIResponseTemplate,
|
|
635
|
+
type SentDmServicesCommonContractsPocOsAuthenticationConfig as SentDmServicesCommonContractsPocOsAuthenticationConfig,
|
|
636
|
+
type SentDmServicesCommonContractsPocOsTemplateBody as SentDmServicesCommonContractsPocOsTemplateBody,
|
|
637
|
+
type SentDmServicesCommonContractsPocOsTemplateButton as SentDmServicesCommonContractsPocOsTemplateButton,
|
|
638
|
+
type SentDmServicesCommonContractsPocOsTemplateButtonProps as SentDmServicesCommonContractsPocOsTemplateButtonProps,
|
|
639
|
+
type SentDmServicesCommonContractsPocOsTemplateFooter as SentDmServicesCommonContractsPocOsTemplateFooter,
|
|
640
|
+
type SentDmServicesCommonContractsPocOsTemplateHeader as SentDmServicesCommonContractsPocOsTemplateHeader,
|
|
641
|
+
type Template as Template,
|
|
422
642
|
type TemplateBodyContent as TemplateBodyContent,
|
|
423
643
|
type TemplateDefinition as TemplateDefinition,
|
|
424
|
-
type TemplateResponseV2 as TemplateResponseV2,
|
|
425
644
|
type TemplateVariable as TemplateVariable,
|
|
426
645
|
type TemplateListResponse as TemplateListResponse,
|
|
427
646
|
type TemplateCreateParams as TemplateCreateParams,
|
|
647
|
+
type TemplateRetrieveParams as TemplateRetrieveParams,
|
|
648
|
+
type TemplateUpdateParams as TemplateUpdateParams,
|
|
428
649
|
type TemplateListParams as TemplateListParams,
|
|
650
|
+
type TemplateDeleteParams as TemplateDeleteParams,
|
|
429
651
|
};
|
|
430
652
|
}
|