@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.
Files changed (52) hide show
  1. package/README.md +1 -1
  2. package/dist/endpoints/businessManagement.d.ts +372 -1
  3. package/dist/endpoints/businessManagement.js +775 -5
  4. package/dist/endpoints/calling.d.ts +41 -1
  5. package/dist/endpoints/calling.js +100 -2
  6. package/dist/endpoints/flows/dataChannel.d.ts +139 -0
  7. package/dist/endpoints/flows/dataChannel.js +252 -0
  8. package/dist/endpoints/flows/flowDsl.d.ts +306 -0
  9. package/dist/endpoints/flows/flowDsl.js +610 -0
  10. package/dist/endpoints/flows/flowMediaUpload.d.ts +102 -0
  11. package/dist/endpoints/flows/flowMediaUpload.js +188 -0
  12. package/dist/endpoints/flows/index.d.ts +9 -1
  13. package/dist/endpoints/flows/index.js +70 -0
  14. package/dist/endpoints/flows/metricsMigration.d.ts +36 -0
  15. package/dist/endpoints/flows/metricsMigration.js +207 -0
  16. package/dist/endpoints/flows/types.d.ts +145 -0
  17. package/dist/endpoints/flows/types.js +14 -0
  18. package/dist/endpoints/flows.d.ts +2 -2
  19. package/dist/endpoints/flows.js +49 -1
  20. package/dist/endpoints/messages/builders-interactive.d.ts +9 -1
  21. package/dist/endpoints/messages/builders-interactive.js +49 -0
  22. package/dist/endpoints/messages/builders-template.d.ts +2 -1
  23. package/dist/endpoints/messages/builders-template.js +53 -2
  24. package/dist/endpoints/messages/deepLinks.d.ts +12 -0
  25. package/dist/endpoints/messages/deepLinks.js +38 -0
  26. package/dist/endpoints/messages/index.d.ts +4 -3
  27. package/dist/endpoints/messages/index.js +13 -2
  28. package/dist/endpoints/messages/types.d.ts +26 -3
  29. package/dist/endpoints/messages/validation.d.ts +7 -0
  30. package/dist/endpoints/messages/validation.js +12 -0
  31. package/dist/endpoints/oauth.d.ts +57 -0
  32. package/dist/endpoints/oauth.js +116 -0
  33. package/dist/endpoints/templates/advanced.d.ts +280 -0
  34. package/dist/endpoints/templates/advanced.js +519 -0
  35. package/dist/endpoints/templates/builders.js +21 -1
  36. package/dist/endpoints/templates/index.d.ts +2 -0
  37. package/dist/endpoints/templates/index.js +15 -0
  38. package/dist/endpoints/templates/shared.js +7 -1
  39. package/dist/endpoints/templates/types.d.ts +17 -2
  40. package/dist/endpoints/templates.d.ts +2 -1
  41. package/dist/endpoints/templates.js +14 -1
  42. package/dist/endpoints/wabaEndpoints.d.ts +4 -4
  43. package/dist/endpoints/wabaEndpoints.js +56 -0
  44. package/dist/index.d.ts +2 -1
  45. package/dist/index.js +1 -0
  46. package/dist/nodeMedia.d.ts +57 -0
  47. package/dist/nodeMedia.js +178 -0
  48. package/dist/subclients/phoneNumberClient.d.ts +92 -2
  49. package/dist/subclients/phoneNumberClient.js +133 -1
  50. package/dist/subclients/wabaClient.d.ts +82 -2
  51. package/dist/subclients/wabaClient.js +102 -2
  52. package/package.json +10 -3
@@ -0,0 +1,57 @@
1
+ import { type EndpointInvokeOptions } from "../endpoint.js";
2
+ import type { GraphClient } from "../client.js";
3
+ /**
4
+ * Input for the Embedded Signup code→token exchange. All three fields are
5
+ * required. `clientSecret` and `code` are SECRETS and are never echoed in
6
+ * validation error messages.
7
+ */
8
+ export interface ExchangeBusinessAccessTokenInput {
9
+ readonly clientId: string;
10
+ readonly clientSecret: string;
11
+ readonly code: string;
12
+ }
13
+ /**
14
+ * Response shape for `GET /oauth/access_token`. The Graph API returns
15
+ * `access_token` (NOT `business_token` — pywa's docstring is wrong per the
16
+ * reference). All fields are optional with an index signature for tolerance.
17
+ */
18
+ export interface BusinessAccessTokenResponse {
19
+ readonly access_token?: string;
20
+ readonly token_type?: string;
21
+ readonly expires_in?: number;
22
+ readonly [key: string]: unknown;
23
+ }
24
+ type WireParams = Record<string, string>;
25
+ /**
26
+ * Normalize the camelCase {@link ExchangeBusinessAccessTokenInput} into the
27
+ * Graph wire query params `{ client_id, client_secret, code }`. Each field is
28
+ * validated with {@link assertBoundedSecretString}; secret values are never
29
+ * echoed in any thrown error message.
30
+ */
31
+ export declare function normalizeExchangeBusinessAccessTokenParams(input: ExchangeBusinessAccessTokenInput): WireParams;
32
+ /**
33
+ * Minimal opts sanitizer mirroring
34
+ * `sanitizeBusinessManagementOptions` (which is not exported from
35
+ * businessManagement.ts): validates `opts` is a plain object, passes
36
+ * `signal` through, and routes `headers` through {@link sanitizeHeaders}.
37
+ */
38
+ export declare function sanitizeOauthOptions(opts: EndpointInvokeOptions | undefined, helperName: string): EndpointInvokeOptions | undefined;
39
+ /**
40
+ * Exchange an Embedded Signup `code` for a business access token.
41
+ *
42
+ * Wraps `GET /oauth/access_token` with query params `client_id`,
43
+ * `client_secret`, and `code` (all required, all secrets except client_id).
44
+ * The returned object carries `access_token` on success.
45
+ *
46
+ * `client_secret` and `code` are SECRETS and are never echoed in validation
47
+ * error messages; the same applies to the returned `access_token` (which is
48
+ * not validated by this helper beyond being part of the response).
49
+ */
50
+ export declare const exchangeBusinessAccessToken: ((client: GraphClient, params: ExchangeBusinessAccessTokenInput, body?: never, opts?: EndpointInvokeOptions) => Promise<BusinessAccessTokenResponse>) & {
51
+ definition: import("../endpoint.js").EndpointDefinition<{
52
+ client_id: string;
53
+ client_secret: string;
54
+ code: string;
55
+ }, never, BusinessAccessTokenResponse>;
56
+ };
57
+ export {};
@@ -0,0 +1,116 @@
1
+ import { defineEndpoint } from "../endpoint.js";
2
+ import { GraphRequestValidationError } from "../errors.js";
3
+ import {
4
+ assertPlainDataRecord,
5
+ ownDataValue as ownInternalDataValue
6
+ } from "../internal/validation/records.js";
7
+ import { sanitizeHeaderInit } from "../internal/validation/headers.js";
8
+ const MAX_CLIENT_ID_LENGTH = 64;
9
+ const MAX_CLIENT_SECRET_LENGTH = 4096;
10
+ const MAX_CODE_LENGTH = 4096;
11
+ function validationError(message, cause) {
12
+ return new GraphRequestValidationError(message, cause);
13
+ }
14
+ function wrapValidation(message, fn) {
15
+ try {
16
+ return fn();
17
+ } catch (error) {
18
+ if (error instanceof GraphRequestValidationError)
19
+ throw error;
20
+ throw validationError(message, error);
21
+ }
22
+ }
23
+ function assertPlainRecord(value, helperName, path = "params") {
24
+ try {
25
+ return assertPlainDataRecord(value, {
26
+ helperName,
27
+ path,
28
+ rejectFunctionsSymbolsBigInts: true
29
+ });
30
+ } catch (error) {
31
+ if (error instanceof GraphRequestValidationError)
32
+ throw error;
33
+ throw validationError(`Invalid ${helperName} input: ${path} could not be inspected.`, error);
34
+ }
35
+ }
36
+ function ownDataValue(record, key, helperName, required) {
37
+ return ownInternalDataValue(record, key, {
38
+ helperName,
39
+ path: key,
40
+ required
41
+ });
42
+ }
43
+ function assertBoundedSecretString(value, fieldName, _helperName, maxLength) {
44
+ if (typeof value !== "string") {
45
+ throw validationError(`${fieldName} must be a non-empty string.`);
46
+ }
47
+ if (value.length === 0 || value.trim().length === 0) {
48
+ throw validationError(`${fieldName} must be a non-empty string.`);
49
+ }
50
+ for (let index = 0;index < value.length; index += 1) {
51
+ const code = value.charCodeAt(index);
52
+ if (code < 32 || code === 127) {
53
+ throw validationError(`${fieldName} must not contain control characters.`);
54
+ }
55
+ }
56
+ if (value.length > maxLength) {
57
+ throw validationError(`${fieldName} length must not exceed ${maxLength}.`);
58
+ }
59
+ return value;
60
+ }
61
+ export function normalizeExchangeBusinessAccessTokenParams(input) {
62
+ const helperName = "exchangeBusinessAccessToken";
63
+ const record = assertPlainRecord(input, "exchangeBusinessAccessToken");
64
+ return {
65
+ client_id: assertBoundedSecretString(ownDataValue(record, "clientId", "exchangeBusinessAccessToken", true), "clientId", "exchangeBusinessAccessToken", MAX_CLIENT_ID_LENGTH),
66
+ client_secret: assertBoundedSecretString(ownDataValue(record, "clientSecret", "exchangeBusinessAccessToken", true), "clientSecret", "exchangeBusinessAccessToken", MAX_CLIENT_SECRET_LENGTH),
67
+ code: assertBoundedSecretString(ownDataValue(record, "code", "exchangeBusinessAccessToken", true), "code", "exchangeBusinessAccessToken", MAX_CODE_LENGTH)
68
+ };
69
+ }
70
+ function sanitizeHeaders(headers, helperName) {
71
+ return sanitizeHeaderInit(headers, {
72
+ helperName,
73
+ path: "opts.headers",
74
+ invalidTypeMessage: `Invalid ${helperName} input: opts.headers must be a plain object.`,
75
+ inspectMessage: `Invalid ${helperName} input: opts.headers could not be inspected.`,
76
+ descriptorInspectMessage: `Invalid ${helperName} input: opts.headers descriptors could not be inspected.`,
77
+ accessorMessage: `Invalid ${helperName} options: headers must not use accessors.`,
78
+ nonStringValueMessage: `Invalid ${helperName} options: header values must be strings.`,
79
+ unsafePrototypeKeyMessage: `Invalid ${helperName} input: opts.headers contains an unsafe prototype key.`,
80
+ invalidKeyMessage: `Invalid ${helperName} input: opts.headers contains an invalid key.`,
81
+ symbolAccessorMessage: `Invalid ${helperName} input: opts.headers must not use symbol-keyed accessors.`,
82
+ symbolKeyMessage: `Invalid ${helperName} input: opts.headers must not contain symbol keys.`,
83
+ ownToJSONMessage: `Invalid ${helperName} input: opts.headers must not define toJSON.`
84
+ });
85
+ }
86
+ export function sanitizeOauthOptions(opts, helperName) {
87
+ if (opts === undefined)
88
+ return;
89
+ const record = assertPlainRecord(opts, helperName, "opts");
90
+ const out = {};
91
+ const signal = ownDataValue(record, "signal", helperName, false);
92
+ const headers = ownDataValue(record, "headers", helperName, false);
93
+ if (signal !== undefined)
94
+ out.signal = signal;
95
+ if (headers !== undefined)
96
+ out.headers = sanitizeHeaders(headers, helperName);
97
+ return out;
98
+ }
99
+ function assertNoBody(body, helperName) {
100
+ if (body !== undefined) {
101
+ throw validationError(`Invalid ${helperName} input: GET endpoints do not accept a body.`);
102
+ }
103
+ }
104
+ const exchangeBusinessAccessTokenRaw = defineEndpoint({
105
+ method: "GET",
106
+ pathTemplate: "/oauth/access_token",
107
+ params: {
108
+ client_id: { in: "query", required: true },
109
+ client_secret: { in: "query", required: true },
110
+ code: { in: "query", required: true }
111
+ }
112
+ });
113
+ export const exchangeBusinessAccessToken = Object.assign(async function exchangeBusinessAccessToken(client, params, body, opts) {
114
+ assertNoBody(body, "exchangeBusinessAccessToken");
115
+ return exchangeBusinessAccessTokenRaw(client, normalizeExchangeBusinessAccessTokenParams(params), undefined, sanitizeOauthOptions(opts, "exchangeBusinessAccessToken"));
116
+ }, { definition: exchangeBusinessAccessTokenRaw.definition });
@@ -0,0 +1,280 @@
1
+ import type { EndpointInvokeOptions } from "../../endpoint.js";
2
+ import type { GraphClient } from "../../client.js";
3
+ /**
4
+ * Canonical top-block-reason enum values documented by Meta and mirrored
5
+ * by pywa's `TopBlockReasonType`. Unknown values are preserved as raw
6
+ * strings (see {@link TemplatesCompareResult.topBlockReason}).
7
+ */
8
+ export declare const KNOWN_TEMPLATE_TOP_BLOCK_REASONS: readonly ["NO_LONGER_NEEDED", "NO_REASON", "NO_REASON_GIVEN", "NO_SIGN_UP", "OFFENSIVE_MESSAGES", "OTHER", "OTP_DID_NOT_REQUEST", "SPAM", "UNKNOWN_BLOCK_REASON", "UNKNOWN"];
9
+ export type TemplateTopBlockReason = (typeof KNOWN_TEMPLATE_TOP_BLOCK_REASONS)[number];
10
+ /**
11
+ * Normalized result of `GET /{templateId}/compare`.
12
+ *
13
+ * Mirrors pywa's `TemplatesCompareResult`:
14
+ * - `blockRate`: template ids ordered by relative BLOCK_RATE metric.
15
+ * - `timesSent`: map of template id -> send count (MESSAGE_SENDS).
16
+ * - `topBlockReason`: map of template id -> top block reason string.
17
+ *
18
+ * Unknown response fields (and the raw `data` array) are preserved via the
19
+ * index signature because the Meta response shape is only partially
20
+ * documented and pywa's parsing has known discrepancies.
21
+ */
22
+ export interface TemplatesCompareResult {
23
+ readonly blockRate?: readonly string[];
24
+ readonly timesSent?: Readonly<Record<string, number>>;
25
+ readonly topBlockReason?: Readonly<Record<string, string>>;
26
+ /** Raw Graph `data` array, preserved verbatim for forward-compat. */
27
+ readonly data?: readonly unknown[];
28
+ readonly [key: string]: unknown;
29
+ }
30
+ export interface CompareTemplatesInput {
31
+ readonly templateId: string;
32
+ /** One or more additional template ids to compare against. */
33
+ readonly templateIds: readonly string[];
34
+ /** Unix timestamp (seconds) as a string, per pywa. */
35
+ readonly start: string;
36
+ /** Unix timestamp (seconds) as a string, per pywa. */
37
+ readonly end: string;
38
+ }
39
+ /**
40
+ * Result of `POST /{templateId}/unpause`. The endpoint is UNVERIFIED and
41
+ * the shape is inferred from pywa; unknown fields are preserved.
42
+ */
43
+ export interface TemplateUnpauseResult {
44
+ readonly success: boolean;
45
+ readonly reason?: string;
46
+ readonly [key: string]: unknown;
47
+ }
48
+ export interface UnpauseTemplateInput {
49
+ readonly templateId: string;
50
+ }
51
+ /** Cap on the number of comparison template ids (defensive finite cap). */
52
+ export declare const COMPARE_TEMPLATES_MAX_IDS = 200;
53
+ interface CompareRawResponse {
54
+ readonly data?: readonly unknown[];
55
+ readonly [key: string]: unknown;
56
+ }
57
+ declare const compareTemplatesRaw: import("../../endpoint.js").EndpointCallable<{
58
+ templateId: string;
59
+ template_ids: string;
60
+ start: string;
61
+ end: string;
62
+ }, never, CompareRawResponse>;
63
+ export declare const compareTemplates: {
64
+ (client: GraphClient, params: CompareTemplatesInput, body?: never, opts?: EndpointInvokeOptions): Promise<TemplatesCompareResult>;
65
+ readonly definition: typeof compareTemplatesRaw.definition;
66
+ };
67
+ declare const unpauseTemplateRaw: import("../../endpoint.js").EndpointCallable<{
68
+ templateId: string;
69
+ }, never, TemplateUnpauseResult>;
70
+ export declare const unpauseTemplate: {
71
+ (client: GraphClient, params: UnpauseTemplateInput, body?: never, opts?: EndpointInvokeOptions): Promise<TemplateUnpauseResult>;
72
+ readonly definition: typeof unpauseTemplateRaw.definition;
73
+ };
74
+ export interface MigrateTemplatesInput {
75
+ readonly destinationWabaId: string;
76
+ readonly sourceWabaId: string;
77
+ /** Optional zero-based page number (Meta examples use `0`). */
78
+ readonly pageNumber?: number;
79
+ }
80
+ /**
81
+ * A successfully migrated template entry inside
82
+ * {@link MigrateTemplatesResponse.migratedTemplates}. Meta returns bare id
83
+ * strings; pywa returns objects. Unknown per-entry fields are preserved.
84
+ */
85
+ export interface MigratedTemplateEntry {
86
+ readonly id: string;
87
+ readonly [key: string]: unknown;
88
+ }
89
+ /**
90
+ * A failed migration entry inside
91
+ * {@link MigrateTemplatesResponse.failedTemplates}. Normalized from both
92
+ * Meta's map form (`{ id: reason }`) and pywa's list form
93
+ * (`[{ id, reason }]`). Unknown per-entry fields are preserved.
94
+ */
95
+ export interface FailedTemplateEntry {
96
+ readonly id: string;
97
+ readonly reason: string;
98
+ readonly [key: string]: unknown;
99
+ }
100
+ /**
101
+ * Normalized result of `POST /{destinationWabaId}/migrate_message_templates`.
102
+ * Snake-case `migrated_templates` / `failed_templates` are camelCased; the
103
+ * two `failed_templates` shapes (Meta map vs pywa list) are both normalized
104
+ * into {@link failedTemplates}. Unknown response fields are preserved via
105
+ * the index signature because the Meta response shape is only partially
106
+ * documented.
107
+ */
108
+ export interface MigrateTemplatesResponse {
109
+ readonly migratedTemplates?: readonly MigratedTemplateEntry[];
110
+ readonly failedTemplates?: readonly FailedTemplateEntry[];
111
+ readonly [key: string]: unknown;
112
+ }
113
+ interface MigrateTemplatesRawResponse {
114
+ readonly migrated_templates?: readonly unknown[];
115
+ readonly failed_templates?: unknown;
116
+ readonly [key: string]: unknown;
117
+ }
118
+ declare const migrateTemplatesRaw: import("../../endpoint.js").EndpointCallable<{
119
+ destinationWabaId: string;
120
+ source_waba_id: string;
121
+ page_number?: string;
122
+ }, never, MigrateTemplatesRawResponse>;
123
+ export declare const migrateTemplates: {
124
+ (client: GraphClient, params: MigrateTemplatesInput, body?: never, opts?: EndpointInvokeOptions): Promise<MigrateTemplatesResponse>;
125
+ readonly definition: typeof migrateTemplatesRaw.definition;
126
+ };
127
+ /** Cap on the number of template ids per archive/unarchive call (Meta max). */
128
+ export declare const ARCHIVE_TEMPLATES_MAX_IDS = 100;
129
+ export interface ArchiveTemplatesInput {
130
+ readonly wabaId: string;
131
+ readonly templateIds: readonly string[];
132
+ }
133
+ export interface UnarchiveTemplatesInput {
134
+ readonly wabaId: string;
135
+ readonly templateIds: readonly string[];
136
+ }
137
+ /**
138
+ * Normalized result of
139
+ * `POST https://api.facebook.com/{wabaId}/message_templates/archive`.
140
+ *
141
+ * `archivedTemplates` is always present (possibly empty) and contains the
142
+ * bare id strings of templates that were successfully archived. Meta returns
143
+ * bare id strings; pywa returns objects — both are normalized to strings.
144
+ *
145
+ * `failedTemplates` is always present (possibly empty) and maps the id of
146
+ * each template that failed to archive to a human-readable reason string.
147
+ * Both the Meta map form (`{ id: reason }`) and the pywa list form
148
+ * (`[{ id, reason }]`) are normalized into this map.
149
+ *
150
+ * Unknown top-level response fields are preserved via the index signature
151
+ * because the Meta response shape is only partially documented.
152
+ */
153
+ export interface ArchiveTemplatesResponse {
154
+ readonly archivedTemplates: readonly string[];
155
+ readonly failedTemplates: Record<string, string>;
156
+ readonly [key: string]: unknown;
157
+ }
158
+ /**
159
+ * Normalized result of
160
+ * `POST https://api.facebook.com/{wabaId}/message_templates/unarchive`.
161
+ * Shape mirrors {@link ArchiveTemplatesResponse} with `unarchivedTemplates`.
162
+ */
163
+ export interface UnarchiveTemplatesResponse {
164
+ readonly unarchivedTemplates: readonly string[];
165
+ readonly failedTemplates: Record<string, string>;
166
+ readonly [key: string]: unknown;
167
+ }
168
+ /**
169
+ * `POST https://api.facebook.com/{wabaId}/message_templates/archive`
170
+ * (WATS-160B). Bulk-archive up to
171
+ * {@link ARCHIVE_TEMPLATES_MAX_IDS} message templates on a WABA. Mirrors
172
+ * pywa's `WhatsApp.archive_templates`. Uses `GraphClient.requestRaw` (not
173
+ * `defineEndpoint`) because the endpoint lives on api.facebook.com, not
174
+ * graph.facebook.com. See REFERENCE-153.md §5.
175
+ */
176
+ export declare function archiveTemplates(client: GraphClient, params: ArchiveTemplatesInput, _body?: never, opts?: EndpointInvokeOptions): Promise<ArchiveTemplatesResponse>;
177
+ /**
178
+ * `POST https://api.facebook.com/{wabaId}/message_templates/unarchive`
179
+ * (WATS-160B). Bulk-unarchive up to
180
+ * {@link ARCHIVE_TEMPLATES_MAX_IDS} message templates on a WABA. Mirrors
181
+ * pywa's `WhatsApp.unarchive_templates`. Uses `GraphClient.requestRaw` (not
182
+ * `defineEndpoint`) because the endpoint lives on api.facebook.com, not
183
+ * graph.facebook.com. See REFERENCE-153.md §5.
184
+ */
185
+ export declare function unarchiveTemplates(client: GraphClient, params: UnarchiveTemplatesInput, _body?: never, opts?: EndpointInvokeOptions): Promise<UnarchiveTemplatesResponse>;
186
+ /** Finite cap on the number of languages per upsert call (defensive bound). */
187
+ export declare const UPSERT_AUTH_LANGUAGES_MAX = 100;
188
+ /** Finite cap on supportedApps per OTP button (matches generic builder). */
189
+ export declare const UPSERT_AUTH_SUPPORTED_APPS_MAX = 10;
190
+ /** Allowed OTP button types for authentication template upsert. */
191
+ export type UpsertAuthOtpType = "COPY_CODE" | "ONE_TAP" | "ZERO_TAP";
192
+ export declare const KNOWN_UPSERT_AUTH_OTP_TYPES: readonly UpsertAuthOtpType[];
193
+ /**
194
+ * A single supported-app entry on an OTP button. `packageName` /
195
+ * `signatureHash` are mapped to the Graph wire fields `package_name` /
196
+ * `signature_hash`. Unknown fields are not forwarded (stricter than the
197
+ * generic OTP builder).
198
+ */
199
+ export interface UpsertAuthSupportedAppInput {
200
+ readonly packageName: string;
201
+ readonly signatureHash: string;
202
+ }
203
+ /**
204
+ * The OTP button descriptor for auth-template upsert. Stricter than the
205
+ * generic {@link TemplateButtonInput} OTP variant: `text` and
206
+ * `autofillText` are NOT permitted here (the upsert auth endpoint rejects
207
+ * them), and `supportedApps` is required for ONE_TAP / ZERO_TAP but
208
+ * optional for COPY_CODE.
209
+ */
210
+ export interface UpsertAuthOtpButtonInput {
211
+ readonly otpType: UpsertAuthOtpType;
212
+ readonly supportedApps?: readonly UpsertAuthSupportedAppInput[];
213
+ }
214
+ /**
215
+ * Public camelCase body for {@link upsertAuthenticationTemplate}. Stricter
216
+ * than {@link CreateMessageTemplateBody}: `languages` is an array, the
217
+ * OTP button is a single dedicated descriptor, and only the auth-specific
218
+ * optional fields (`addSecurityRecommendation`, `codeExpirationMinutes`,
219
+ * `messageSendTtlSeconds`) are exposed.
220
+ */
221
+ export interface UpsertAuthenticationTemplateBody {
222
+ readonly name: string;
223
+ readonly languages: readonly string[];
224
+ readonly otpButton: UpsertAuthOtpButtonInput;
225
+ readonly addSecurityRecommendation?: boolean;
226
+ readonly codeExpirationMinutes?: number;
227
+ readonly messageSendTtlSeconds?: number;
228
+ }
229
+ /**
230
+ * A single entry in the {@link UpsertAuthenticationTemplateResponse.data}
231
+ * array. `id`, `status`, and `language` are typed; all other fields Meta
232
+ * returns are preserved via the index signature.
233
+ */
234
+ export interface UpsertedAuthTemplateEntry {
235
+ readonly id?: string;
236
+ readonly status?: string;
237
+ readonly language?: string;
238
+ readonly [key: string]: unknown;
239
+ }
240
+ /**
241
+ * Response of `POST /{wabaId}/upsert_message_templates`. Mirrors the
242
+ * CreatedTemplates-ish shape: a `data` array of per-language results plus
243
+ * any unknown top-level fields Meta returns.
244
+ */
245
+ export interface UpsertAuthenticationTemplateResponse {
246
+ readonly data?: readonly UpsertedAuthTemplateEntry[];
247
+ readonly [key: string]: unknown;
248
+ }
249
+ /**
250
+ * Build the Graph request body for auth-template upsert from the public
251
+ * camelCase {@link UpsertAuthenticationTemplateBody}. Performs all
252
+ * validation (descriptor-safe via `assertPlainRecord`, finite caps,
253
+ * otpType enum, OTP-button strictness, codeExpirationMinutes range,
254
+ * messageSendTtlSeconds non-negative integer) so bad input throws a
255
+ * `GraphRequestValidationError` before any transport call.
256
+ */
257
+ export declare function buildUpsertAuthenticationTemplateBody(input: UpsertAuthenticationTemplateBody): Record<string, unknown>;
258
+ declare const upsertAuthenticationTemplateRaw: import("../../endpoint.js").EndpointCallable<{
259
+ wabaId: string;
260
+ }, UpsertAuthenticationTemplateBody, UpsertAuthenticationTemplateResponse>;
261
+ /**
262
+ * `POST /{wabaId}/upsert_message_templates` (WATS-160C). Upserts an
263
+ * authentication message template (one or more languages) on a WABA.
264
+ * Mirrors pywa's `WhatsApp.upsert_authentication_template`. Stricter than
265
+ * {@link createMessageTemplate}: the body is a fixed camelCase descriptor
266
+ * that the helper translates into the Graph AUTHENTICATION component
267
+ * layout (BODY + optional FOOTER + BUTTONS with a single OTP button).
268
+ *
269
+ * All validation (descriptor-safe params/body, finite caps, otpType enum,
270
+ * OTP-button strictness, codeExpirationMinutes range, messageSendTtlSeconds
271
+ * non-negative integer) throws a `GraphRequestValidationError` before any
272
+ * transport call.
273
+ */
274
+ export declare const upsertAuthenticationTemplate: {
275
+ (client: GraphClient, params: {
276
+ readonly wabaId: string;
277
+ }, body: UpsertAuthenticationTemplateBody, opts?: EndpointInvokeOptions): Promise<UpsertAuthenticationTemplateResponse>;
278
+ readonly definition: typeof upsertAuthenticationTemplateRaw.definition;
279
+ };
280
+ export {};