@wats/graph 0.3.26 → 0.3.28
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/README.md +1 -1
- package/dist/endpoints/businessManagement.d.ts +372 -1
- package/dist/endpoints/businessManagement.js +775 -5
- package/dist/endpoints/calling.d.ts +41 -1
- package/dist/endpoints/calling.js +100 -2
- package/dist/endpoints/flows/dataChannel.d.ts +139 -0
- package/dist/endpoints/flows/dataChannel.js +252 -0
- package/dist/endpoints/flows/flowDsl.d.ts +306 -0
- package/dist/endpoints/flows/flowDsl.js +610 -0
- package/dist/endpoints/flows/flowMediaUpload.d.ts +102 -0
- package/dist/endpoints/flows/flowMediaUpload.js +188 -0
- package/dist/endpoints/flows/index.d.ts +9 -1
- package/dist/endpoints/flows/index.js +70 -0
- package/dist/endpoints/flows/metricsMigration.d.ts +36 -0
- package/dist/endpoints/flows/metricsMigration.js +207 -0
- package/dist/endpoints/flows/types.d.ts +145 -0
- package/dist/endpoints/flows/types.js +14 -0
- package/dist/endpoints/flows.d.ts +2 -2
- package/dist/endpoints/flows.js +49 -1
- package/dist/endpoints/messages/builders-interactive.d.ts +9 -1
- package/dist/endpoints/messages/builders-interactive.js +49 -0
- package/dist/endpoints/messages/builders-template.d.ts +2 -1
- package/dist/endpoints/messages/builders-template.js +53 -2
- package/dist/endpoints/messages/deepLinks.d.ts +12 -0
- package/dist/endpoints/messages/deepLinks.js +38 -0
- package/dist/endpoints/messages/index.d.ts +4 -3
- package/dist/endpoints/messages/index.js +13 -2
- package/dist/endpoints/messages/types.d.ts +26 -3
- package/dist/endpoints/messages/validation.d.ts +7 -0
- package/dist/endpoints/messages/validation.js +12 -0
- package/dist/endpoints/oauth.d.ts +57 -0
- package/dist/endpoints/oauth.js +116 -0
- package/dist/endpoints/templates/advanced.d.ts +280 -0
- package/dist/endpoints/templates/advanced.js +519 -0
- package/dist/endpoints/templates/builders.js +21 -1
- package/dist/endpoints/templates/index.d.ts +2 -0
- package/dist/endpoints/templates/index.js +15 -0
- package/dist/endpoints/templates/shared.js +7 -1
- package/dist/endpoints/templates/types.d.ts +17 -2
- package/dist/endpoints/templates.d.ts +2 -1
- package/dist/endpoints/templates.js +14 -1
- package/dist/endpoints/wabaEndpoints.d.ts +4 -4
- package/dist/endpoints/wabaEndpoints.js +56 -0
- package/dist/index.d.ts +2 -1
- package/dist/index.js +1 -0
- package/dist/nodeMedia.d.ts +57 -0
- package/dist/nodeMedia.js +178 -0
- package/dist/subclients/phoneNumberClient.d.ts +92 -2
- package/dist/subclients/phoneNumberClient.js +133 -1
- package/dist/subclients/wabaClient.d.ts +82 -2
- package/dist/subclients/wabaClient.js +102 -2
- package/package.json +10 -3
|
@@ -0,0 +1,519 @@
|
|
|
1
|
+
import { defineEndpoint } from "../../endpoint.js";
|
|
2
|
+
import {
|
|
3
|
+
createGraphApiError,
|
|
4
|
+
isGraphApiErrorPayload,
|
|
5
|
+
isGraphErrorEnvelope
|
|
6
|
+
} from "../../errors.js";
|
|
7
|
+
import {
|
|
8
|
+
assertArray,
|
|
9
|
+
assertPlainRecord,
|
|
10
|
+
assertString,
|
|
11
|
+
hasControlChar,
|
|
12
|
+
validationError,
|
|
13
|
+
TEMPLATE_SHORT_TEXT_MAX_LENGTH
|
|
14
|
+
} from "./shared.js";
|
|
15
|
+
export const KNOWN_TEMPLATE_TOP_BLOCK_REASONS = [
|
|
16
|
+
"NO_LONGER_NEEDED",
|
|
17
|
+
"NO_REASON",
|
|
18
|
+
"NO_REASON_GIVEN",
|
|
19
|
+
"NO_SIGN_UP",
|
|
20
|
+
"OFFENSIVE_MESSAGES",
|
|
21
|
+
"OTHER",
|
|
22
|
+
"OTP_DID_NOT_REQUEST",
|
|
23
|
+
"SPAM",
|
|
24
|
+
"UNKNOWN_BLOCK_REASON",
|
|
25
|
+
"UNKNOWN"
|
|
26
|
+
];
|
|
27
|
+
export const COMPARE_TEMPLATES_MAX_IDS = 200;
|
|
28
|
+
function normalizeCompareParams(input) {
|
|
29
|
+
const helperName = "compareTemplates";
|
|
30
|
+
const record = assertPlainRecord(input, "compareTemplates");
|
|
31
|
+
const templateId = assertString(record.templateId, "templateId", "compareTemplates");
|
|
32
|
+
const idsArr = assertArray(record.templateIds, "templateIds", 1, COMPARE_TEMPLATES_MAX_IDS, "compareTemplates");
|
|
33
|
+
const templateIds = idsArr.map((item, index) => assertString(item, `templateIds[${index}]`, "compareTemplates"));
|
|
34
|
+
const start = assertString(record.start, "start", "compareTemplates");
|
|
35
|
+
const end = assertString(record.end, "end", "compareTemplates");
|
|
36
|
+
return { templateId, template_ids: templateIds.join(","), start, end };
|
|
37
|
+
}
|
|
38
|
+
function parseCompareResult(raw) {
|
|
39
|
+
const out = {};
|
|
40
|
+
if (raw !== null && typeof raw === "object") {
|
|
41
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
42
|
+
if (key !== "data")
|
|
43
|
+
out[key] = value;
|
|
44
|
+
}
|
|
45
|
+
}
|
|
46
|
+
const data = raw?.data;
|
|
47
|
+
if (Array.isArray(data)) {
|
|
48
|
+
out.data = data;
|
|
49
|
+
for (const entry of data) {
|
|
50
|
+
if (entry === null || typeof entry !== "object")
|
|
51
|
+
continue;
|
|
52
|
+
const rec = entry;
|
|
53
|
+
const metric = typeof rec.metric === "string" ? rec.metric : "";
|
|
54
|
+
if (metric === "BLOCK_RATE") {
|
|
55
|
+
const arr = rec.order_by_relative_metric;
|
|
56
|
+
if (Array.isArray(arr)) {
|
|
57
|
+
out.blockRate = arr.map((item) => typeof item === "string" ? item : String(item));
|
|
58
|
+
}
|
|
59
|
+
} else if (metric === "MESSAGE_SENDS") {
|
|
60
|
+
const nv = rec.number_values;
|
|
61
|
+
if (Array.isArray(nv)) {
|
|
62
|
+
const map = {};
|
|
63
|
+
for (const item of nv) {
|
|
64
|
+
if (item === null || typeof item !== "object")
|
|
65
|
+
continue;
|
|
66
|
+
const r = item;
|
|
67
|
+
if (typeof r.key === "string" && typeof r.value === "number" && Number.isFinite(r.value)) {
|
|
68
|
+
map[r.key] = r.value;
|
|
69
|
+
}
|
|
70
|
+
}
|
|
71
|
+
if (Object.keys(map).length > 0)
|
|
72
|
+
out.timesSent = map;
|
|
73
|
+
}
|
|
74
|
+
} else if (metric === "TOP_BLOCK_REASON") {
|
|
75
|
+
const sv = rec.string_values;
|
|
76
|
+
if (Array.isArray(sv)) {
|
|
77
|
+
const map = {};
|
|
78
|
+
for (const item of sv) {
|
|
79
|
+
if (item === null || typeof item !== "object")
|
|
80
|
+
continue;
|
|
81
|
+
const r = item;
|
|
82
|
+
if (typeof r.key === "string" && typeof r.value === "string") {
|
|
83
|
+
map[r.key] = r.value;
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
if (Object.keys(map).length > 0)
|
|
87
|
+
out.topBlockReason = map;
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
return out;
|
|
93
|
+
}
|
|
94
|
+
const compareTemplatesRaw = defineEndpoint({
|
|
95
|
+
method: "GET",
|
|
96
|
+
pathTemplate: "/{templateId}/compare",
|
|
97
|
+
params: {
|
|
98
|
+
templateId: { in: "path", required: true },
|
|
99
|
+
template_ids: { in: "query", required: true },
|
|
100
|
+
start: { in: "query", required: true },
|
|
101
|
+
end: { in: "query", required: true }
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
export const compareTemplates = Object.assign(async function compareTemplates(client, params, body, opts) {
|
|
105
|
+
const normalized = normalizeCompareParams(params);
|
|
106
|
+
const raw = await compareTemplatesRaw(client, normalized, body, opts);
|
|
107
|
+
return parseCompareResult(raw);
|
|
108
|
+
}, { definition: compareTemplatesRaw.definition });
|
|
109
|
+
function normalizeUnpauseParams(input) {
|
|
110
|
+
const helperName = "unpauseTemplate";
|
|
111
|
+
const record = assertPlainRecord(input, "unpauseTemplate");
|
|
112
|
+
const templateId = assertString(record.templateId, "templateId", "unpauseTemplate");
|
|
113
|
+
return { templateId };
|
|
114
|
+
}
|
|
115
|
+
const unpauseTemplateRaw = defineEndpoint({
|
|
116
|
+
method: "POST",
|
|
117
|
+
pathTemplate: "/{templateId}/unpause",
|
|
118
|
+
params: { templateId: { in: "path", required: true } }
|
|
119
|
+
});
|
|
120
|
+
export const unpauseTemplate = Object.assign(async function unpauseTemplate(client, params, body, opts) {
|
|
121
|
+
const normalized = normalizeUnpauseParams(params);
|
|
122
|
+
return unpauseTemplateRaw(client, normalized, body, opts);
|
|
123
|
+
}, { definition: unpauseTemplateRaw.definition });
|
|
124
|
+
const HELPER_MIGRATE_TEMPLATES = "migrateTemplates";
|
|
125
|
+
function assertSafeMigrateId(value, fieldName, helperName) {
|
|
126
|
+
const str = assertString(value, fieldName, helperName);
|
|
127
|
+
if (str === "." || str === "..") {
|
|
128
|
+
throw validationError(`Invalid ${helperName} input: ${fieldName} must not be a dot-segment.`);
|
|
129
|
+
}
|
|
130
|
+
if (str.includes("/") || str.includes("\\") || str.includes("?") || str.includes("#")) {
|
|
131
|
+
throw validationError(`Invalid ${helperName} input: ${fieldName} must not contain path/query/fragment separators.`);
|
|
132
|
+
}
|
|
133
|
+
return str;
|
|
134
|
+
}
|
|
135
|
+
function assertPageNumber(value, helperName) {
|
|
136
|
+
if (value === undefined)
|
|
137
|
+
return;
|
|
138
|
+
if (typeof value !== "number") {
|
|
139
|
+
throw validationError(`Invalid ${helperName} input: pageNumber must be a number.`);
|
|
140
|
+
}
|
|
141
|
+
if (!Number.isFinite(value)) {
|
|
142
|
+
throw validationError(`Invalid ${helperName} input: pageNumber must be a finite number.`);
|
|
143
|
+
}
|
|
144
|
+
if (!Number.isInteger(value)) {
|
|
145
|
+
throw validationError(`Invalid ${helperName} input: pageNumber must be an integer.`);
|
|
146
|
+
}
|
|
147
|
+
if (value < 0) {
|
|
148
|
+
throw validationError(`Invalid ${helperName} input: pageNumber must be >= 0.`);
|
|
149
|
+
}
|
|
150
|
+
return value;
|
|
151
|
+
}
|
|
152
|
+
function normalizeMigrateTemplatesParams(input) {
|
|
153
|
+
const record = assertPlainRecord(input, HELPER_MIGRATE_TEMPLATES);
|
|
154
|
+
const destinationWabaId = assertSafeMigrateId(record.destinationWabaId, "destinationWabaId", HELPER_MIGRATE_TEMPLATES);
|
|
155
|
+
const sourceWabaId = assertSafeMigrateId(record.sourceWabaId, "sourceWabaId", HELPER_MIGRATE_TEMPLATES);
|
|
156
|
+
const pageNumber = assertPageNumber(record.pageNumber, HELPER_MIGRATE_TEMPLATES);
|
|
157
|
+
const out = {
|
|
158
|
+
destinationWabaId,
|
|
159
|
+
source_waba_id: sourceWabaId
|
|
160
|
+
};
|
|
161
|
+
if (pageNumber !== undefined) {
|
|
162
|
+
out.page_number = String(pageNumber);
|
|
163
|
+
}
|
|
164
|
+
return out;
|
|
165
|
+
}
|
|
166
|
+
function normalizeMigratedTemplateEntry(entry) {
|
|
167
|
+
if (typeof entry === "string") {
|
|
168
|
+
if (entry.length === 0)
|
|
169
|
+
return null;
|
|
170
|
+
return { id: entry };
|
|
171
|
+
}
|
|
172
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
173
|
+
return null;
|
|
174
|
+
}
|
|
175
|
+
const rec = entry;
|
|
176
|
+
if (typeof rec.id !== "string" || rec.id.length === 0)
|
|
177
|
+
return null;
|
|
178
|
+
const out = { id: rec.id };
|
|
179
|
+
for (const [key, value] of Object.entries(rec)) {
|
|
180
|
+
if (key === "id")
|
|
181
|
+
continue;
|
|
182
|
+
out[key] = value;
|
|
183
|
+
}
|
|
184
|
+
return out;
|
|
185
|
+
}
|
|
186
|
+
function normalizeFailedTemplateEntryList(entry) {
|
|
187
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
188
|
+
return null;
|
|
189
|
+
}
|
|
190
|
+
const rec = entry;
|
|
191
|
+
if (typeof rec.id !== "string" || rec.id.length === 0)
|
|
192
|
+
return null;
|
|
193
|
+
if (typeof rec.reason !== "string")
|
|
194
|
+
return null;
|
|
195
|
+
const out = { id: rec.id, reason: rec.reason };
|
|
196
|
+
for (const [key, value] of Object.entries(rec)) {
|
|
197
|
+
if (key === "id" || key === "reason")
|
|
198
|
+
continue;
|
|
199
|
+
out[key] = value;
|
|
200
|
+
}
|
|
201
|
+
return out;
|
|
202
|
+
}
|
|
203
|
+
function parseMigrateTemplatesResponse(raw) {
|
|
204
|
+
const out = {};
|
|
205
|
+
if (raw !== null && typeof raw === "object") {
|
|
206
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
207
|
+
if (key !== "migrated_templates" && key !== "failed_templates") {
|
|
208
|
+
out[key] = value;
|
|
209
|
+
}
|
|
210
|
+
}
|
|
211
|
+
}
|
|
212
|
+
const migrated = raw?.migrated_templates;
|
|
213
|
+
if (Array.isArray(migrated)) {
|
|
214
|
+
const entries = [];
|
|
215
|
+
for (const entry of migrated) {
|
|
216
|
+
const norm = normalizeMigratedTemplateEntry(entry);
|
|
217
|
+
if (norm !== null)
|
|
218
|
+
entries.push(norm);
|
|
219
|
+
}
|
|
220
|
+
out.migratedTemplates = entries;
|
|
221
|
+
}
|
|
222
|
+
const failed = raw?.failed_templates;
|
|
223
|
+
if (Array.isArray(failed)) {
|
|
224
|
+
const entries = [];
|
|
225
|
+
for (const entry of failed) {
|
|
226
|
+
const norm = normalizeFailedTemplateEntryList(entry);
|
|
227
|
+
if (norm !== null)
|
|
228
|
+
entries.push(norm);
|
|
229
|
+
}
|
|
230
|
+
out.failedTemplates = entries;
|
|
231
|
+
} else if (failed !== null && typeof failed === "object") {
|
|
232
|
+
const entries = [];
|
|
233
|
+
for (const [id, reason] of Object.entries(failed)) {
|
|
234
|
+
if (id.length > 0 && typeof reason === "string") {
|
|
235
|
+
entries.push({ id, reason });
|
|
236
|
+
}
|
|
237
|
+
}
|
|
238
|
+
out.failedTemplates = entries;
|
|
239
|
+
}
|
|
240
|
+
return out;
|
|
241
|
+
}
|
|
242
|
+
const migrateTemplatesRaw = defineEndpoint({
|
|
243
|
+
method: "POST",
|
|
244
|
+
pathTemplate: "/{destinationWabaId}/migrate_message_templates",
|
|
245
|
+
params: {
|
|
246
|
+
destinationWabaId: { in: "path", required: true },
|
|
247
|
+
source_waba_id: { in: "query", required: true },
|
|
248
|
+
page_number: { in: "query" }
|
|
249
|
+
}
|
|
250
|
+
});
|
|
251
|
+
export const migrateTemplates = Object.assign(async function migrateTemplates(client, params, body, opts) {
|
|
252
|
+
const normalized = normalizeMigrateTemplatesParams(params);
|
|
253
|
+
const raw = await migrateTemplatesRaw(client, normalized, body, opts);
|
|
254
|
+
return parseMigrateTemplatesResponse(raw);
|
|
255
|
+
}, { definition: migrateTemplatesRaw.definition });
|
|
256
|
+
const HELPER_ARCHIVE_TEMPLATES = "archiveTemplates";
|
|
257
|
+
const HELPER_UNARCHIVE_TEMPLATES = "unarchiveTemplates";
|
|
258
|
+
const API_FACEBOOK_BASE = "https://api.facebook.com/";
|
|
259
|
+
export const ARCHIVE_TEMPLATES_MAX_IDS = 100;
|
|
260
|
+
const TEMPLATE_ID_MAX_LENGTH = 256;
|
|
261
|
+
function assertArchiveClient(client, helperName) {
|
|
262
|
+
if (client === null || typeof client !== "object" || typeof client.requestRaw !== "function") {
|
|
263
|
+
throw validationError(`Invalid ${helperName} client: expected a GraphClient-like object with requestRaw().`);
|
|
264
|
+
}
|
|
265
|
+
}
|
|
266
|
+
function assertTemplateIdBodyValue(value, index, helperName) {
|
|
267
|
+
if (typeof value !== "string") {
|
|
268
|
+
throw validationError(`Invalid ${helperName} input: templateIds[${index}] must be a string.`);
|
|
269
|
+
}
|
|
270
|
+
if (value.length === 0 || value.trim().length === 0) {
|
|
271
|
+
throw validationError(`Invalid ${helperName} input: templateIds[${index}] must be non-empty.`);
|
|
272
|
+
}
|
|
273
|
+
if (hasControlChar(value)) {
|
|
274
|
+
throw validationError(`Invalid ${helperName} input: templateIds[${index}] must not contain control characters (CR/LF/NUL/etc.).`);
|
|
275
|
+
}
|
|
276
|
+
if (/\s/.test(value)) {
|
|
277
|
+
throw validationError(`Invalid ${helperName} input: templateIds[${index}] must not contain whitespace.`);
|
|
278
|
+
}
|
|
279
|
+
if (value.length > TEMPLATE_ID_MAX_LENGTH) {
|
|
280
|
+
throw validationError(`Invalid ${helperName} input: templateIds[${index}] exceeds ${TEMPLATE_ID_MAX_LENGTH}-character limit.`);
|
|
281
|
+
}
|
|
282
|
+
return value;
|
|
283
|
+
}
|
|
284
|
+
function normalizeArchiveInput(input, helperName) {
|
|
285
|
+
const record = assertPlainRecord(input, helperName);
|
|
286
|
+
const wabaId = assertSafeMigrateId(record.wabaId, "wabaId", helperName);
|
|
287
|
+
const idsArr = assertArray(record.templateIds, "templateIds", 1, ARCHIVE_TEMPLATES_MAX_IDS, helperName);
|
|
288
|
+
const templateIds = idsArr.map((item, index) => assertTemplateIdBodyValue(item, index, helperName));
|
|
289
|
+
return { wabaId, templateIds };
|
|
290
|
+
}
|
|
291
|
+
function normalizeIdEntry(entry) {
|
|
292
|
+
if (typeof entry === "string") {
|
|
293
|
+
return entry.length === 0 ? null : entry;
|
|
294
|
+
}
|
|
295
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
296
|
+
return null;
|
|
297
|
+
}
|
|
298
|
+
const rec = entry;
|
|
299
|
+
if (typeof rec.id !== "string" || rec.id.length === 0)
|
|
300
|
+
return null;
|
|
301
|
+
return rec.id;
|
|
302
|
+
}
|
|
303
|
+
function normalizeFailedMap(failed) {
|
|
304
|
+
const out = {};
|
|
305
|
+
if (Array.isArray(failed)) {
|
|
306
|
+
for (const entry of failed) {
|
|
307
|
+
if (entry === null || typeof entry !== "object" || Array.isArray(entry)) {
|
|
308
|
+
continue;
|
|
309
|
+
}
|
|
310
|
+
const rec = entry;
|
|
311
|
+
if (typeof rec.id !== "string" || rec.id.length === 0)
|
|
312
|
+
continue;
|
|
313
|
+
if (typeof rec.reason !== "string")
|
|
314
|
+
continue;
|
|
315
|
+
out[rec.id] = rec.reason;
|
|
316
|
+
}
|
|
317
|
+
} else if (failed !== null && typeof failed === "object") {
|
|
318
|
+
for (const [id, reason] of Object.entries(failed)) {
|
|
319
|
+
if (id.length === 0)
|
|
320
|
+
continue;
|
|
321
|
+
if (typeof reason !== "string")
|
|
322
|
+
continue;
|
|
323
|
+
out[id] = reason;
|
|
324
|
+
}
|
|
325
|
+
}
|
|
326
|
+
return out;
|
|
327
|
+
}
|
|
328
|
+
function parseArchiveResponse(raw, successKey, successField) {
|
|
329
|
+
const out = {};
|
|
330
|
+
if (raw !== null && typeof raw === "object") {
|
|
331
|
+
for (const [key, value] of Object.entries(raw)) {
|
|
332
|
+
if (key !== successKey && key !== "failed_templates") {
|
|
333
|
+
out[key] = value;
|
|
334
|
+
}
|
|
335
|
+
}
|
|
336
|
+
}
|
|
337
|
+
const successArr = raw?.[successKey];
|
|
338
|
+
const ids = [];
|
|
339
|
+
if (Array.isArray(successArr)) {
|
|
340
|
+
for (const entry of successArr) {
|
|
341
|
+
const id = normalizeIdEntry(entry);
|
|
342
|
+
if (id !== null)
|
|
343
|
+
ids.push(id);
|
|
344
|
+
}
|
|
345
|
+
}
|
|
346
|
+
out[successField] = ids;
|
|
347
|
+
out.failedTemplates = normalizeFailedMap(raw?.failed_templates);
|
|
348
|
+
return out;
|
|
349
|
+
}
|
|
350
|
+
async function parseResponseBody(response) {
|
|
351
|
+
const contentType = response.headers.get("content-type") ?? "";
|
|
352
|
+
if (contentType.includes("application/json")) {
|
|
353
|
+
try {
|
|
354
|
+
return await response.json();
|
|
355
|
+
} catch {
|
|
356
|
+
return;
|
|
357
|
+
}
|
|
358
|
+
}
|
|
359
|
+
const text = await response.text();
|
|
360
|
+
if (text.length === 0)
|
|
361
|
+
return;
|
|
362
|
+
try {
|
|
363
|
+
return JSON.parse(text);
|
|
364
|
+
} catch {
|
|
365
|
+
return text;
|
|
366
|
+
}
|
|
367
|
+
}
|
|
368
|
+
async function invokeArchiveEndpoint(client, helperName, edge, input, opts, successKey, successField) {
|
|
369
|
+
assertArchiveClient(client, helperName);
|
|
370
|
+
const { wabaId, templateIds } = normalizeArchiveInput(input, helperName);
|
|
371
|
+
const url = `${API_FACEBOOK_BASE}${wabaId}/message_templates/${edge}`;
|
|
372
|
+
const headers = {
|
|
373
|
+
"content-type": "application/json"
|
|
374
|
+
};
|
|
375
|
+
if (opts?.headers !== undefined) {
|
|
376
|
+
if (opts.headers instanceof Headers) {
|
|
377
|
+
opts.headers.forEach((value, key) => {
|
|
378
|
+
headers[key] = value;
|
|
379
|
+
});
|
|
380
|
+
} else {
|
|
381
|
+
Object.assign(headers, opts.headers);
|
|
382
|
+
}
|
|
383
|
+
}
|
|
384
|
+
const rawOptions = {
|
|
385
|
+
method: "POST",
|
|
386
|
+
url,
|
|
387
|
+
body: { hsm_ids: templateIds },
|
|
388
|
+
headers
|
|
389
|
+
};
|
|
390
|
+
if (opts?.signal !== undefined) {
|
|
391
|
+
rawOptions.signal = opts.signal;
|
|
392
|
+
}
|
|
393
|
+
const response = await client.requestRaw(rawOptions);
|
|
394
|
+
const parsed = await parseResponseBody(response);
|
|
395
|
+
if (response.status < 200 || response.status >= 300) {
|
|
396
|
+
if (isGraphErrorEnvelope(parsed)) {
|
|
397
|
+
throw createGraphApiError({
|
|
398
|
+
status: response.status,
|
|
399
|
+
payload: parsed.error,
|
|
400
|
+
fallbackMessage: `Graph API request failed with status ${response.status}`,
|
|
401
|
+
headers: response.headers
|
|
402
|
+
});
|
|
403
|
+
}
|
|
404
|
+
const fallbackPayload = isGraphApiErrorPayload(parsed) ? parsed : undefined;
|
|
405
|
+
const errorParams = {
|
|
406
|
+
status: response.status,
|
|
407
|
+
fallbackMessage: `Graph API request failed with status ${response.status}`,
|
|
408
|
+
classify: false,
|
|
409
|
+
headers: response.headers
|
|
410
|
+
};
|
|
411
|
+
if (fallbackPayload !== undefined) {
|
|
412
|
+
errorParams.payload = fallbackPayload;
|
|
413
|
+
}
|
|
414
|
+
throw createGraphApiError(errorParams);
|
|
415
|
+
}
|
|
416
|
+
return parseArchiveResponse(parsed ?? {}, successKey, successField);
|
|
417
|
+
}
|
|
418
|
+
export async function archiveTemplates(client, params, _body, opts) {
|
|
419
|
+
return invokeArchiveEndpoint(client, HELPER_ARCHIVE_TEMPLATES, "archive", params, opts, "archived_templates", "archivedTemplates");
|
|
420
|
+
}
|
|
421
|
+
export async function unarchiveTemplates(client, params, _body, opts) {
|
|
422
|
+
return invokeArchiveEndpoint(client, HELPER_UNARCHIVE_TEMPLATES, "unarchive", params, opts, "unarchived_templates", "unarchivedTemplates");
|
|
423
|
+
}
|
|
424
|
+
const HELPER_UPSERT_AUTH = "upsertAuthenticationTemplate";
|
|
425
|
+
export const UPSERT_AUTH_LANGUAGES_MAX = 100;
|
|
426
|
+
export const UPSERT_AUTH_SUPPORTED_APPS_MAX = 10;
|
|
427
|
+
export const KNOWN_UPSERT_AUTH_OTP_TYPES = [
|
|
428
|
+
"COPY_CODE",
|
|
429
|
+
"ONE_TAP",
|
|
430
|
+
"ZERO_TAP"
|
|
431
|
+
];
|
|
432
|
+
function assertUpsertAuthBoolean(value, fieldName) {
|
|
433
|
+
if (typeof value !== "boolean") {
|
|
434
|
+
throw validationError(`Invalid ${HELPER_UPSERT_AUTH} input: ${fieldName} must be a boolean.`);
|
|
435
|
+
}
|
|
436
|
+
return value;
|
|
437
|
+
}
|
|
438
|
+
function assertCodeExpirationMinutes(value) {
|
|
439
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value) || value < 1 || value > 90) {
|
|
440
|
+
throw validationError(`Invalid ${HELPER_UPSERT_AUTH} input: codeExpirationMinutes must be an integer between 1 and 90.`);
|
|
441
|
+
}
|
|
442
|
+
return value;
|
|
443
|
+
}
|
|
444
|
+
function assertNonNegativeInteger(value, fieldName) {
|
|
445
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value) || value < 0) {
|
|
446
|
+
throw validationError(`Invalid ${HELPER_UPSERT_AUTH} input: ${fieldName} must be a non-negative integer.`);
|
|
447
|
+
}
|
|
448
|
+
return value;
|
|
449
|
+
}
|
|
450
|
+
function normalizeUpsertAuthSupportedApps(value) {
|
|
451
|
+
const apps = assertArray(value, "otpButton.supportedApps", 1, UPSERT_AUTH_SUPPORTED_APPS_MAX, HELPER_UPSERT_AUTH);
|
|
452
|
+
return apps.map((entry, index) => {
|
|
453
|
+
const record = assertPlainRecord(entry, HELPER_UPSERT_AUTH, `otpButton.supportedApps[${index}]`);
|
|
454
|
+
return {
|
|
455
|
+
package_name: assertString(record.packageName, `otpButton.supportedApps[${index}].packageName`, HELPER_UPSERT_AUTH, TEMPLATE_SHORT_TEXT_MAX_LENGTH),
|
|
456
|
+
signature_hash: assertString(record.signatureHash, `otpButton.supportedApps[${index}].signatureHash`, HELPER_UPSERT_AUTH, TEMPLATE_SHORT_TEXT_MAX_LENGTH)
|
|
457
|
+
};
|
|
458
|
+
});
|
|
459
|
+
}
|
|
460
|
+
export function buildUpsertAuthenticationTemplateBody(input) {
|
|
461
|
+
const record = assertPlainRecord(input, HELPER_UPSERT_AUTH);
|
|
462
|
+
const name = assertString(record.name, "name", HELPER_UPSERT_AUTH);
|
|
463
|
+
const langsArr = assertArray(record.languages, "languages", 1, UPSERT_AUTH_LANGUAGES_MAX, HELPER_UPSERT_AUTH);
|
|
464
|
+
const languages = langsArr.map((item, index) => assertString(item, `languages[${index}]`, HELPER_UPSERT_AUTH, 64));
|
|
465
|
+
const otpButtonRec = assertPlainRecord(record.otpButton, HELPER_UPSERT_AUTH, "otpButton");
|
|
466
|
+
const otpTypeRaw = assertString(otpButtonRec.otpType, "otpButton.otpType", HELPER_UPSERT_AUTH, 32);
|
|
467
|
+
const otpType = otpTypeRaw.toUpperCase();
|
|
468
|
+
if (!KNOWN_UPSERT_AUTH_OTP_TYPES.includes(otpType)) {
|
|
469
|
+
throw validationError(`Invalid ${HELPER_UPSERT_AUTH} input: otpButton.otpType must be one of COPY_CODE, ONE_TAP, ZERO_TAP.`);
|
|
470
|
+
}
|
|
471
|
+
if (otpButtonRec.text !== undefined) {
|
|
472
|
+
throw validationError(`Invalid ${HELPER_UPSERT_AUTH} input: otpButton.text is not allowed for authentication templates.`);
|
|
473
|
+
}
|
|
474
|
+
if (otpButtonRec.autofillText !== undefined) {
|
|
475
|
+
throw validationError(`Invalid ${HELPER_UPSERT_AUTH} input: otpButton.autofillText is not allowed for authentication templates.`);
|
|
476
|
+
}
|
|
477
|
+
const button = { type: "OTP", otp_type: otpType };
|
|
478
|
+
if (otpType === "COPY_CODE") {
|
|
479
|
+
if (otpButtonRec.supportedApps !== undefined) {
|
|
480
|
+
button.supported_apps = normalizeUpsertAuthSupportedApps(otpButtonRec.supportedApps);
|
|
481
|
+
}
|
|
482
|
+
} else {
|
|
483
|
+
if (otpButtonRec.supportedApps === undefined) {
|
|
484
|
+
throw validationError(`Invalid ${HELPER_UPSERT_AUTH} input: otpButton.supportedApps is required for ${otpType} buttons.`);
|
|
485
|
+
}
|
|
486
|
+
button.supported_apps = normalizeUpsertAuthSupportedApps(otpButtonRec.supportedApps);
|
|
487
|
+
}
|
|
488
|
+
const bodyComponent = { type: "BODY" };
|
|
489
|
+
if (record.addSecurityRecommendation !== undefined) {
|
|
490
|
+
bodyComponent.add_security_recommendation = assertUpsertAuthBoolean(record.addSecurityRecommendation, "addSecurityRecommendation");
|
|
491
|
+
}
|
|
492
|
+
const components = [bodyComponent];
|
|
493
|
+
if (record.codeExpirationMinutes !== undefined) {
|
|
494
|
+
const cem = assertCodeExpirationMinutes(record.codeExpirationMinutes);
|
|
495
|
+
components.push({ type: "FOOTER", code_expiration_minutes: cem });
|
|
496
|
+
}
|
|
497
|
+
components.push({ type: "BUTTONS", buttons: [button] });
|
|
498
|
+
const out = {
|
|
499
|
+
name,
|
|
500
|
+
languages,
|
|
501
|
+
category: "AUTHENTICATION",
|
|
502
|
+
components
|
|
503
|
+
};
|
|
504
|
+
if (record.messageSendTtlSeconds !== undefined) {
|
|
505
|
+
out.message_send_ttl_seconds = assertNonNegativeInteger(record.messageSendTtlSeconds, "messageSendTtlSeconds");
|
|
506
|
+
}
|
|
507
|
+
return out;
|
|
508
|
+
}
|
|
509
|
+
const upsertAuthenticationTemplateRaw = defineEndpoint({
|
|
510
|
+
method: "POST",
|
|
511
|
+
pathTemplate: "/{wabaId}/upsert_message_templates",
|
|
512
|
+
params: { wabaId: { in: "path", required: true } },
|
|
513
|
+
bodyContentType: "application/json",
|
|
514
|
+
buildBody: buildUpsertAuthenticationTemplateBody
|
|
515
|
+
});
|
|
516
|
+
export const upsertAuthenticationTemplate = Object.assign(async function upsertAuthenticationTemplate(client, params, body, opts) {
|
|
517
|
+
const record = assertPlainRecord(params, HELPER_UPSERT_AUTH, "params");
|
|
518
|
+
return upsertAuthenticationTemplateRaw(client, { wabaId: assertString(record.wabaId, "wabaId", HELPER_UPSERT_AUTH) }, body, opts);
|
|
519
|
+
}, { definition: upsertAuthenticationTemplateRaw.definition });
|
|
@@ -10,13 +10,26 @@ import {
|
|
|
10
10
|
normalizeComponents,
|
|
11
11
|
validationError
|
|
12
12
|
} from "./shared.js";
|
|
13
|
+
const TEMPLATE_VOICE_CALL_TEXT_MAX_LENGTH = 20;
|
|
14
|
+
const TEMPLATE_VOICE_CALL_TTL_MINUTES_MIN = 1440;
|
|
15
|
+
const TEMPLATE_VOICE_CALL_TTL_MINUTES_MAX = 43200;
|
|
16
|
+
function assertIntegerInRange(value, fieldName, helperName, min, max) {
|
|
17
|
+
if (typeof value !== "number" || !Number.isFinite(value) || !Number.isInteger(value) || value < min || value > max) {
|
|
18
|
+
throw validationError(`Invalid ${helperName} input: ${fieldName} must be an integer between ${min} and ${max}.`);
|
|
19
|
+
}
|
|
20
|
+
return value;
|
|
21
|
+
}
|
|
13
22
|
export function buildCreateMessageTemplateBody(input) {
|
|
14
23
|
const record = assertPlainRecord(input, "createMessageTemplate");
|
|
15
24
|
const out = mapCommonBodyFields(record, "createMessageTemplate");
|
|
16
25
|
out.name = assertString(record.name, "name", "createMessageTemplate");
|
|
17
26
|
out.language = assertString(record.language, "language", "createMessageTemplate", 64);
|
|
18
27
|
out.category = assertString(record.category, "category", "createMessageTemplate", 64);
|
|
19
|
-
|
|
28
|
+
if (record.components !== undefined) {
|
|
29
|
+
out.components = normalizeComponents(record.components, "createMessageTemplate", true);
|
|
30
|
+
} else if (record.libraryTemplateName === undefined && record.library_template_name === undefined) {
|
|
31
|
+
throw validationError("Invalid createMessageTemplate input: components must be provided unless libraryTemplateName is set.");
|
|
32
|
+
}
|
|
20
33
|
return out;
|
|
21
34
|
}
|
|
22
35
|
export function buildUpdateMessageTemplateBody(input) {
|
|
@@ -101,6 +114,13 @@ function normalizeButton(input, index) {
|
|
|
101
114
|
if (record.navigateScreen !== undefined)
|
|
102
115
|
out.navigate_screen = assertString(record.navigateScreen, "button.navigateScreen", "buildTemplateButtonComponent", TEMPLATE_SHORT_TEXT_MAX_LENGTH);
|
|
103
116
|
break;
|
|
117
|
+
case "VOICE_CALL":
|
|
118
|
+
out.type = "voice_call";
|
|
119
|
+
if (record.text !== undefined)
|
|
120
|
+
out.text = assertString(record.text, "button.text", "buildTemplateButtonComponent", TEMPLATE_VOICE_CALL_TEXT_MAX_LENGTH);
|
|
121
|
+
if (record.ttlMinutes !== undefined)
|
|
122
|
+
out.ttl_minutes = assertIntegerInRange(record.ttlMinutes, "button.ttlMinutes", "buildTemplateButtonComponent", TEMPLATE_VOICE_CALL_TTL_MINUTES_MIN, TEMPLATE_VOICE_CALL_TTL_MINUTES_MAX);
|
|
123
|
+
break;
|
|
104
124
|
case "OTP":
|
|
105
125
|
if (record.packageName !== undefined || record.signatureHash !== undefined) {
|
|
106
126
|
throw validationError("Invalid buildTemplateButtonComponent input: OTP buttons must nest packageName/signatureHash under supportedApps.");
|
|
@@ -1,7 +1,9 @@
|
|
|
1
1
|
export { createMessageTemplate, deleteMessageTemplate, getMessageTemplate, listMessageTemplates, updateMessageTemplate } from "./callables.js";
|
|
2
2
|
export { createTemplateGroup, deleteTemplateGroup, getTemplateGroup, getTemplateGroupAnalytics, listTemplateGroups, updateTemplateGroup } from "./groups.js";
|
|
3
|
+
export { compareTemplates, migrateTemplates, unpauseTemplate, archiveTemplates, unarchiveTemplates, upsertAuthenticationTemplate, buildUpsertAuthenticationTemplateBody, ARCHIVE_TEMPLATES_MAX_IDS, COMPARE_TEMPLATES_MAX_IDS, UPSERT_AUTH_LANGUAGES_MAX, UPSERT_AUTH_SUPPORTED_APPS_MAX, KNOWN_TEMPLATE_TOP_BLOCK_REASONS, KNOWN_UPSERT_AUTH_OTP_TYPES } from "./advanced.js";
|
|
3
4
|
export { buildCreateMessageTemplateBody, buildUpdateMessageTemplateBody, buildTemplateBodyComponent, buildTemplateButtonComponent, buildTemplateFooterComponent, buildTemplateHeaderComponent } from "./builders.js";
|
|
4
5
|
export { validateTemplateParameterCounts } from "./validation.js";
|
|
5
6
|
export type { GraphPaging } from "../wabaEndpoints.js";
|
|
6
7
|
export type { CreateMessageTemplateBody, DeleteMessageTemplateInput, GetMessageTemplateInput, ListMessageTemplatesInput, SendTemplateComponentForValidation, TemplateBodyComponentInput, TemplateButtonInput, TemplateButtonsComponentInput, TemplateButtonType, TemplateCategory, TemplateComponent, TemplateDefinitionForValidation, TemplateDetails, TemplateFooterComponentInput, TemplateHeaderComponentInput, TemplateHeaderFormat, TemplateLanguageCode, TemplateListResponse, TemplateMutationResponse, TemplateOtpType, TemplateParameterFormat, TemplateQualityScore, TemplateStatus, TemplateSupportedAppInput, UpdateMessageTemplateBody } from "./types.js";
|
|
7
8
|
export type { CreateTemplateGroupBody, DeleteTemplateGroupInput, GetTemplateGroupInput, ListTemplateGroupsInput, TemplateGroupAnalyticsInput, TemplateGroupAnalyticsPoint, TemplateGroupAnalyticsResponse, TemplateGroupBody, TemplateGroupDetails, TemplateGroupListResponse, TemplateGroupMutationResponse, UpdateTemplateGroupBody } from "./groups.js";
|
|
9
|
+
export type { ArchiveTemplatesInput, ArchiveTemplatesResponse, CompareTemplatesInput, FailedTemplateEntry, MigrateTemplatesInput, MigrateTemplatesResponse, MigratedTemplateEntry, TemplateTopBlockReason, TemplateUnpauseResult, TemplatesCompareResult, UnarchiveTemplatesInput, UnarchiveTemplatesResponse, UnpauseTemplateInput, UpsertAuthOtpButtonInput, UpsertAuthOtpType, UpsertAuthSupportedAppInput, UpsertAuthenticationTemplateBody, UpsertAuthenticationTemplateResponse, UpsertedAuthTemplateEntry } from "./advanced.js";
|
|
@@ -13,6 +13,21 @@ export {
|
|
|
13
13
|
listTemplateGroups,
|
|
14
14
|
updateTemplateGroup
|
|
15
15
|
} from "./groups.js";
|
|
16
|
+
export {
|
|
17
|
+
compareTemplates,
|
|
18
|
+
migrateTemplates,
|
|
19
|
+
unpauseTemplate,
|
|
20
|
+
archiveTemplates,
|
|
21
|
+
unarchiveTemplates,
|
|
22
|
+
upsertAuthenticationTemplate,
|
|
23
|
+
buildUpsertAuthenticationTemplateBody,
|
|
24
|
+
ARCHIVE_TEMPLATES_MAX_IDS,
|
|
25
|
+
COMPARE_TEMPLATES_MAX_IDS,
|
|
26
|
+
UPSERT_AUTH_LANGUAGES_MAX,
|
|
27
|
+
UPSERT_AUTH_SUPPORTED_APPS_MAX,
|
|
28
|
+
KNOWN_TEMPLATE_TOP_BLOCK_REASONS,
|
|
29
|
+
KNOWN_UPSERT_AUTH_OTP_TYPES
|
|
30
|
+
} from "./advanced.js";
|
|
16
31
|
export {
|
|
17
32
|
buildCreateMessageTemplateBody,
|
|
18
33
|
buildUpdateMessageTemplateBody,
|
|
@@ -186,13 +186,19 @@ export function mapCommonBodyFields(record, helperName) {
|
|
|
186
186
|
continue;
|
|
187
187
|
if (key === "parameterFormat")
|
|
188
188
|
out.parameter_format = assertString(value, "parameterFormat", helperName, 32);
|
|
189
|
+
else if (key === "libraryTemplateName")
|
|
190
|
+
out.library_template_name = assertString(value, "libraryTemplateName", helperName);
|
|
191
|
+
else if (key === "libraryTemplateBodyInputs")
|
|
192
|
+
out.library_template_body_inputs = safeJsonClone(value, helperName, "libraryTemplateBodyInputs");
|
|
193
|
+
else if (key === "libraryTemplateButtonInputs")
|
|
194
|
+
out.library_template_button_inputs = safeJsonClone(value, helperName, "libraryTemplateButtonInputs");
|
|
189
195
|
else if (key === "messageSendTtlSeconds") {
|
|
190
196
|
if (typeof value !== "number" || !Number.isInteger(value) || value < 0) {
|
|
191
197
|
throw validationError(`Invalid ${helperName} input: messageSendTtlSeconds must be a non-negative integer.`);
|
|
192
198
|
}
|
|
193
199
|
out.message_send_ttl_seconds = value;
|
|
194
200
|
} else if (key === "components") {
|
|
195
|
-
const components = normalizeComponents(value, helperName,
|
|
201
|
+
const components = normalizeComponents(value, helperName, false);
|
|
196
202
|
if (components !== undefined)
|
|
197
203
|
out.components = components;
|
|
198
204
|
} else {
|
|
@@ -6,7 +6,7 @@ export type TemplateParameterFormat = "POSITIONAL" | "NAMED";
|
|
|
6
6
|
export type TemplateQualityScore = "GREEN" | "YELLOW" | "RED" | "UNKNOWN" | string;
|
|
7
7
|
export type TemplateOtpType = "COPY_CODE" | "ONE_TAP" | "ZERO_TAP" | string;
|
|
8
8
|
export type TemplateHeaderFormat = "TEXT" | "IMAGE" | "VIDEO" | "DOCUMENT" | "LOCATION";
|
|
9
|
-
export type TemplateButtonType = "QUICK_REPLY" | "URL" | "PHONE_NUMBER" | "COPY_CODE" | "CATALOG" | "FLOW" | "OTP";
|
|
9
|
+
export type TemplateButtonType = "QUICK_REPLY" | "URL" | "PHONE_NUMBER" | "COPY_CODE" | "CATALOG" | "FLOW" | "OTP" | "VOICE_CALL";
|
|
10
10
|
export interface TemplateComponent {
|
|
11
11
|
readonly type: string;
|
|
12
12
|
readonly [key: string]: unknown;
|
|
@@ -54,7 +54,17 @@ export interface CreateMessageTemplateBody {
|
|
|
54
54
|
readonly name: string;
|
|
55
55
|
readonly language: TemplateLanguageCode;
|
|
56
56
|
readonly category: TemplateCategory | string;
|
|
57
|
-
|
|
57
|
+
/**
|
|
58
|
+
* Required for normal template creation. Optional when creating from a
|
|
59
|
+
* WhatsApp Template Library entry via `libraryTemplateName`.
|
|
60
|
+
*/
|
|
61
|
+
readonly components?: readonly TemplateComponent[];
|
|
62
|
+
/** Maps to Graph `library_template_name`. */
|
|
63
|
+
readonly libraryTemplateName?: string;
|
|
64
|
+
/** Maps to Graph `library_template_body_inputs`. */
|
|
65
|
+
readonly libraryTemplateBodyInputs?: readonly Record<string, unknown>[];
|
|
66
|
+
/** Maps to Graph `library_template_button_inputs`. */
|
|
67
|
+
readonly libraryTemplateButtonInputs?: readonly Record<string, unknown>[];
|
|
58
68
|
readonly parameterFormat?: TemplateParameterFormat;
|
|
59
69
|
readonly messageSendTtlSeconds?: number;
|
|
60
70
|
readonly [key: string]: unknown;
|
|
@@ -130,6 +140,11 @@ export type TemplateButtonInput = {
|
|
|
130
140
|
readonly zeroTapTermsAccepted?: boolean;
|
|
131
141
|
readonly supportedApps?: readonly TemplateSupportedAppInput[];
|
|
132
142
|
readonly [key: string]: unknown;
|
|
143
|
+
} | {
|
|
144
|
+
readonly type: "VOICE_CALL";
|
|
145
|
+
readonly text?: string;
|
|
146
|
+
readonly ttlMinutes?: number;
|
|
147
|
+
readonly [key: string]: unknown;
|
|
133
148
|
};
|
|
134
149
|
export interface TemplateButtonsComponentInput {
|
|
135
150
|
readonly buttons: readonly TemplateButtonInput[];
|
|
@@ -1,2 +1,3 @@
|
|
|
1
|
-
export { buildCreateMessageTemplateBody, buildUpdateMessageTemplateBody, buildTemplateBodyComponent, buildTemplateButtonComponent, buildTemplateFooterComponent, buildTemplateHeaderComponent, createMessageTemplate, createTemplateGroup, deleteMessageTemplate, deleteTemplateGroup, getMessageTemplate, getTemplateGroup, getTemplateGroupAnalytics, listMessageTemplates, listTemplateGroups, updateMessageTemplate, updateTemplateGroup, validateTemplateParameterCounts } from "./templates/index.js";
|
|
1
|
+
export { buildCreateMessageTemplateBody, buildUpdateMessageTemplateBody, buildTemplateBodyComponent, buildTemplateButtonComponent, buildTemplateFooterComponent, buildTemplateHeaderComponent, createMessageTemplate, createTemplateGroup, compareTemplates, migrateTemplates, archiveTemplates, unarchiveTemplates, upsertAuthenticationTemplate, buildUpsertAuthenticationTemplateBody, deleteMessageTemplate, deleteTemplateGroup, getMessageTemplate, getTemplateGroup, getTemplateGroupAnalytics, listMessageTemplates, listTemplateGroups, unpauseTemplate, updateMessageTemplate, updateTemplateGroup, validateTemplateParameterCounts, ARCHIVE_TEMPLATES_MAX_IDS, COMPARE_TEMPLATES_MAX_IDS, UPSERT_AUTH_LANGUAGES_MAX, UPSERT_AUTH_SUPPORTED_APPS_MAX, KNOWN_TEMPLATE_TOP_BLOCK_REASONS, KNOWN_UPSERT_AUTH_OTP_TYPES } from "./templates/index.js";
|
|
2
2
|
export type { CreateMessageTemplateBody, CreateTemplateGroupBody, DeleteMessageTemplateInput, DeleteTemplateGroupInput, GetMessageTemplateInput, GetTemplateGroupInput, GraphPaging, ListMessageTemplatesInput, ListTemplateGroupsInput, SendTemplateComponentForValidation, TemplateBodyComponentInput, TemplateButtonInput, TemplateButtonsComponentInput, TemplateButtonType, TemplateCategory, TemplateComponent, TemplateDefinitionForValidation, TemplateDetails, TemplateGroupAnalyticsInput, TemplateGroupAnalyticsPoint, TemplateGroupAnalyticsResponse, TemplateGroupBody, TemplateGroupDetails, TemplateGroupListResponse, TemplateGroupMutationResponse, TemplateFooterComponentInput, TemplateHeaderComponentInput, TemplateHeaderFormat, TemplateLanguageCode, TemplateListResponse, TemplateMutationResponse, TemplateParameterFormat, TemplateQualityScore, TemplateStatus, UpdateMessageTemplateBody, UpdateTemplateGroupBody } from "./templates/index.js";
|
|
3
|
+
export type { ArchiveTemplatesInput, ArchiveTemplatesResponse, CompareTemplatesInput, FailedTemplateEntry, MigrateTemplatesInput, MigrateTemplatesResponse, MigratedTemplateEntry, TemplateTopBlockReason, TemplateUnpauseResult, TemplatesCompareResult, UnarchiveTemplatesInput, UnarchiveTemplatesResponse, UnpauseTemplateInput, UpsertAuthOtpButtonInput, UpsertAuthOtpType, UpsertAuthSupportedAppInput, UpsertAuthenticationTemplateBody, UpsertAuthenticationTemplateResponse, UpsertedAuthTemplateEntry } from "./templates/index.js";
|