meta-cloud-api 3.7.1 → 3.9.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/dist/index.d.mts CHANGED
@@ -1,7 +1,81 @@
1
- import { Agent } from "node:https";
2
1
  import { IncomingHttpHeaders, IncomingMessage } from "node:http";
3
2
 
4
- //#region src/types/enums.d.ts
3
+ //#region src/utils/rateLimit.d.ts
4
+ /**
5
+ * Usage percentages reported by Meta. Each value is the share (0-100+) of the allowance used in the
6
+ * current rolling window.
7
+ */
8
+ interface RateLimitUsage {
9
+ /** Percentage of calls made (`call_count`). */
10
+ callCount?: number;
11
+ /** Percentage of total CPU time used (`total_cputime`). */
12
+ totalCputime?: number;
13
+ /** Percentage of total time used (`total_time`). */
14
+ totalTime?: number;
15
+ }
16
+ /** One entry of the `X-Business-Use-Case-Usage` header. */
17
+ interface BusinessUseCaseUsage extends RateLimitUsage {
18
+ /** The business object the entry belongs to (for WhatsApp, usually the WABA or phone number ID). */
19
+ businessId: string;
20
+ /** Rate limit type, e.g. `whatsapp_business_management` or `whatsapp`. */
21
+ type?: string;
22
+ /**
23
+ * `estimated_time_to_regain_access`: "Time, in minutes, until calls will no longer be throttled."
24
+ * `0` when not throttled.
25
+ */
26
+ estimatedTimeToRegainAccessMinutes?: number;
27
+ /** `ads_api_access_tier`, only sent for Marketing API use cases. */
28
+ adsApiAccessTier?: string;
29
+ }
30
+ /**
31
+ * Rate limit information parsed from a Graph API response.
32
+ *
33
+ * WhatsApp Cloud API responses carry `x-business-use-case-usage` (types
34
+ * `whatsapp_business_management` and `whatsapp`) and `x-app-usage`; throttled responses may add
35
+ * `Retry-After` (seconds).
36
+ */
37
+ interface RateLimitInfo {
38
+ /** Parsed `X-App-Usage` header (platform rate limits). */
39
+ appUsage?: RateLimitUsage;
40
+ /** Parsed `X-Business-Use-Case-Usage` header, flattened across business IDs. Empty when absent. */
41
+ businessUseCaseUsage: BusinessUseCaseUsage[];
42
+ /** Parsed `Retry-After` header in milliseconds (seconds or HTTP-date form). */
43
+ retryAfterMs?: number;
44
+ /**
45
+ * Highest usage percentage across every parsed metric, handy for alerting before Meta starts
46
+ * throttling (it throttles at 100).
47
+ */
48
+ maxUsagePercent?: number;
49
+ /**
50
+ * How long Meta asks you to wait, in milliseconds: the larger of `retryAfterMs` and the largest
51
+ * `estimatedTimeToRegainAccessMinutes`. Undefined when Meta gave no wait time.
52
+ */
53
+ retryDelayMs?: number;
54
+ }
55
+ /** Headers accepted by {@link parseRateLimitHeaders}. */
56
+ type RateLimitHeadersInput = Headers | Record<string, string | string[] | undefined> | {
57
+ get(name: string): string | null;
58
+ };
59
+ /**
60
+ * Parses a `Retry-After` value (delta-seconds or HTTP-date) into milliseconds.
61
+ * Returns undefined for missing or malformed values.
62
+ */
63
+ declare function parseRetryAfter(value: string | null | undefined, now?: number): number | undefined;
64
+ /**
65
+ * Parses Meta's rate limit headers (`X-App-Usage`, `X-Business-Use-Case-Usage`, `Retry-After`).
66
+ * Header names are matched case-insensitively. Malformed JSON or values are ignored, never thrown.
67
+ *
68
+ * Returns undefined when none of the headers are present.
69
+ *
70
+ * @see {@link https://developers.facebook.com/docs/graph-api/overview/rate-limiting/ | Graph API rate limiting}
71
+ *
72
+ * @example
73
+ * ```ts
74
+ * const info = parseRateLimitHeaders(response.headers);
75
+ * if ((info?.maxUsagePercent ?? 0) > 80) slowDown();
76
+ * ```
77
+ */
78
+ declare function parseRateLimitHeaders(headers: RateLimitHeadersInput | null | undefined): RateLimitInfo | undefined;
5
79
  declare namespace enums_d_exports {
6
80
  export { AudioMediaTypesEnum, BusinessVerticalEnum, ButtonPositionEnum, CategoryEnum, ComponentTypesEnum, ConversationTypesEnum, CurrencyCodesEnum, DataLocalizationRegionEnum, DocumentMediaTypesEnum, HttpMethodsEnum, ImageMediaTypesEnum, InteractiveTypesEnum, LanguagesEnum, MessageCategoryEnum, MessageTypesEnum, ParametersTypesEnum, ReferralSourceTypesEnum, RequestCodeMethodsEnum, StatusEnum, StickerMediaTypesEnum, SubTypeEnum, SystemChangeTypesEnum, TemplateStatusEnum, VideoMediaTypesEnum, WabaConfigEnum, WebhookTypesEnum };
7
81
  }
@@ -735,6 +809,68 @@ interface RetryConfig {
735
809
  * Defaults to 1000 (1 second).
736
810
  */
737
811
  initialDelayMs?: number;
812
+ /**
813
+ * Wait as long as Meta asks before retrying a throttled request. When a throttling response
814
+ * carries `Retry-After` (seconds) or `X-Business-Use-Case-Usage` with
815
+ * `estimated_time_to_regain_access` (minutes), the retry waits the larger of the backoff delay and
816
+ * that server delay, capped at {@link RetryConfig.maxServerDelayMs}. It never adds attempts.
817
+ * Defaults to `true`; set `false` to use the backoff delay only.
818
+ */
819
+ respectServerDelay?: boolean;
820
+ /**
821
+ * Upper bound in milliseconds for a server-provided wait. A longer wait is shortened to this
822
+ * value, so the retry may still be throttled; inspect `error.rateLimit` to reschedule instead.
823
+ * Defaults to 30000 (30 seconds).
824
+ */
825
+ maxServerDelayMs?: number;
826
+ }
827
+ /** Request details passed to {@link WhatsAppConfig.onRateLimitInfo}. */
828
+ interface RateLimitInfoContext {
829
+ /** HTTP method of the request. */
830
+ method: string;
831
+ /** Endpoint path or absolute URL as passed to the requester. */
832
+ endpoint: string;
833
+ /** HTTP status code of the response. */
834
+ statusCode: number;
835
+ }
836
+ /** Callback receiving rate limit information parsed from every response that carries it. */
837
+ type RateLimitInfoListener = (info: RateLimitInfo, context: RateLimitInfoContext) => void | Promise<void>;
838
+ /**
839
+ * Storage used to drop duplicate webhook deliveries. Meta retries deliveries,
840
+ * so the same message or status can arrive more than once.
841
+ *
842
+ * `setIfAbsent` must be atomic: store `key` for `ttlSeconds` only if it is not
843
+ * already there, and resolve `true` when it stored the key (first delivery) or
844
+ * `false` when the key already existed (duplicate). It maps 1:1 to Redis
845
+ * `SET key 1 NX EX ttlSeconds`, which replies `OK` only when the key was set.
846
+ *
847
+ * @example
848
+ * ```typescript
849
+ * const store: DedupeStore = {
850
+ * async setIfAbsent(key, ttlSeconds) {
851
+ * return (await redis.set(`wa:${key}`, '1', { NX: true, EX: ttlSeconds })) === 'OK';
852
+ * },
853
+ * };
854
+ * ```
855
+ */
856
+ interface DedupeStore {
857
+ /** Atomically store `key` for `ttlSeconds` if absent. Resolves `true` if stored, `false` if it existed. */
858
+ setIfAbsent(key: string, ttlSeconds: number): Promise<boolean>;
859
+ /** Optional read-only check. The webhook processor never calls it; it is there for inspection and tests. */
860
+ has?(key: string): Promise<boolean>;
861
+ }
862
+ /**
863
+ * Opt-in deduplication of webhook deliveries. See {@link DedupeStore}.
864
+ */
865
+ interface WebhookDedupeConfig {
866
+ /**
867
+ * Where seen keys are kept. Defaults to an in-memory store that is bounded
868
+ * and only sees deliveries made to this process: with several instances
869
+ * behind a load balancer, pass a shared store such as Redis.
870
+ */
871
+ store?: DedupeStore;
872
+ /** How long a key is remembered, in seconds. Defaults to 86400 (24 hours). */
873
+ ttlSeconds?: number;
738
874
  }
739
875
  type WhatsAppConfig = {
740
876
  accessToken: string;
@@ -752,6 +888,36 @@ type WhatsAppConfig = {
752
888
  privatePem?: string;
753
889
  passphrase?: string; /** Automatic retry configuration for throttling errors. */
754
890
  retry?: RetryConfig;
891
+ /**
892
+ * Called with the parsed `X-App-Usage` / `X-Business-Use-Case-Usage` / `Retry-After` headers of
893
+ * every response (successful or not) that carries at least one of them. Errors thrown by the
894
+ * callback are ignored. See also `whatsapp.getLastRateLimitInfo()`.
895
+ */
896
+ onRateLimitInfo?: RateLimitInfoListener;
897
+ /**
898
+ * Reject webhook POSTs whose `X-Hub-Signature-256` header is not a valid
899
+ * HMAC-SHA256 of the raw body keyed with `appSecret`. Requires `appSecret`.
900
+ *
901
+ * Off by default for backward compatibility. Turn it on in production:
902
+ * without it anyone who knows your webhook URL can post fake messages.
903
+ *
904
+ * Express users must keep the raw body, since re-serialized JSON will not match:
905
+ * `app.use(express.json({ verify: (req, _res, buf) => { req.rawBody = buf.toString(); } }))`.
906
+ */
907
+ verifyWebhookSignature?: boolean;
908
+ /**
909
+ * Skip handlers for webhook deliveries that were already seen (Meta retries
910
+ * deliveries). Duplicates still get a 200 response. Used by
911
+ * `WebhookProcessor` and the framework adapters only.
912
+ *
913
+ * Keys: `message:<id>` for messages, `status:<id>:<status>` for statuses,
914
+ * and the call or echo ids for `calls`, `smb_message_echoes` and
915
+ * `message_echoes`. Other fields have no natural id and are never deduped.
916
+ *
917
+ * `true` uses the defaults (in-memory store, single instance only, 24 hour TTL).
918
+ * Off by default.
919
+ */
920
+ dedupe?: boolean | WebhookDedupeConfig;
755
921
  };
756
922
  type WabaConfigType = {
757
923
  /**
@@ -815,6 +981,10 @@ type WabaConfigType = {
815
981
  * Passed through from WhatsAppConfig.
816
982
  */
817
983
  retry?: RetryConfig;
984
+ /**
985
+ * Rate limit header listener. Passed through from WhatsAppConfig.
986
+ */
987
+ onRateLimitInfo?: RateLimitInfoListener;
818
988
  };
819
989
  //#endregion
820
990
  //#region src/types/request.d.ts
@@ -840,6 +1010,8 @@ interface GeneralHeaderInterface {
840
1010
  }
841
1011
  interface RequesterResponseInterface<T> {
842
1012
  json: () => Promise<T>;
1013
+ /** The underlying fetch `Response`, for non-JSON bodies such as media downloads. */
1014
+ rawResponse: () => Response;
843
1015
  }
844
1016
  interface ResponseSuccess {
845
1017
  success: boolean;
@@ -888,6 +1060,8 @@ declare class BaseAPI implements BaseClass {
888
1060
  protected client: RequesterClass;
889
1061
  constructor(config: WabaConfigType, client: RequesterClass);
890
1062
  protected sendJson<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
1063
+ /** Send a request and return the raw `Response` (for binary bodies). Errors still throw `WhatsAppError`s. */
1064
+ protected sendRaw(method: HttpMethodsEnum, endpoint: string, timeout: number): Promise<Response>;
891
1065
  protected sendFormData<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body?: any): Promise<T>;
892
1066
  protected sendUrlEncodedForm<T>(method: HttpMethodsEnum, endpoint: string, timeout: number, body: UrlEncodedFormBody): Promise<T>;
893
1067
  }
@@ -1701,7 +1875,7 @@ type GroupParticipantsRequest = {
1701
1875
  type UpdateGroupSettingsRequest = {
1702
1876
  subject?: string;
1703
1877
  description?: string;
1704
- profilePictureFile?: Blob | Buffer;
1878
+ profilePictureFile?: Blob | Uint8Array;
1705
1879
  };
1706
1880
  type GroupSettingsResponse = ResponseSuccess;
1707
1881
  interface GroupsClass {
@@ -2387,9 +2561,29 @@ type MediasResponse = {
2387
2561
  type UploadMediaResponse = {
2388
2562
  id: string;
2389
2563
  };
2564
+ /**
2565
+ * Media content accepted by `uploadMedia`.
2566
+ *
2567
+ * A `ReadableStream` is read fully into memory before the upload starts: Meta's endpoint takes
2568
+ * `multipart/form-data`, and `fetch` can only send a `FormData` part from a `Blob`.
2569
+ */
2570
+ type UploadMediaInput = Blob | File | Uint8Array | ArrayBuffer | ReadableStream<Uint8Array>;
2571
+ interface UploadMediaOptions {
2572
+ /**
2573
+ * MIME type sent as the `type` field and as the file part's content type, e.g. `image/jpeg`.
2574
+ * Required for `Uint8Array`, `ArrayBuffer` and `ReadableStream` input, and for a `Blob` without a
2575
+ * `type`. Overrides the `type` of a `Blob`/`File`.
2576
+ */
2577
+ type?: string;
2578
+ /** File name of the multipart part. Defaults to the `File` name, otherwise `file`. */
2579
+ filename?: string;
2580
+ /** Messaging product. Defaults to `'whatsapp'`. */
2581
+ messagingProduct?: string;
2582
+ }
2390
2583
  interface MediaClass {
2391
2584
  getMediaById(mediaId: string): Promise<MediaResponse>;
2392
2585
  uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
2586
+ uploadMedia(file: UploadMediaInput, options?: UploadMediaOptions): Promise<UploadMediaResponse>;
2393
2587
  deleteMedia(mediaId: string): Promise<ResponseSuccess>;
2394
2588
  downloadMedia(mediaUrl: string): Promise<Blob>;
2395
2589
  }
@@ -2751,9 +2945,9 @@ interface UploadMediaParams {
2751
2945
  */
2752
2946
  uploadId: string;
2753
2947
  /**
2754
- * The binary data of the file (Buffer).
2948
+ * The binary data of the file (`Uint8Array`; a Node.js `Buffer` works).
2755
2949
  */
2756
- file: Buffer;
2950
+ file: Uint8Array;
2757
2951
  }
2758
2952
  /**
2759
2953
  * Request parameters for getting upload handle.
@@ -2898,7 +3092,7 @@ declare class BusinessProfileClass extends BaseClass {
2898
3092
  * @param uploadId The ID of the upload session.
2899
3093
  * @param file The binary data of the file.
2900
3094
  */
2901
- uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
3095
+ uploadMedia(uploadId: string, file: Uint8Array): Promise<UploadBusinessProfileResponse>;
2902
3096
  /**
2903
3097
  * Get the upload handle information.
2904
3098
  * @param uploadId The ID of the upload session.
@@ -4634,6 +4828,65 @@ interface TrackingEventsWebhookValue {
4634
4828
  field: 'tracking_events';
4635
4829
  value: TrackingEventsValue;
4636
4830
  }
4831
+ /**
4832
+ * Known `user_actions[].action_type` values. Open enum: Meta adds values
4833
+ * without a breaking change, so ignore action types you do not recognize
4834
+ * instead of treating them as errors.
4835
+ *
4836
+ * - `marketing_messages_link_click` — the user tapped the body or call-to-action of a marketing message.
4837
+ * - `landing_page_view` — the tapped link opened its landing page in the WhatsApp In-App Browser.
4838
+ */
4839
+ type UserActionType = 'marketing_messages_link_click' | 'landing_page_view' | string;
4840
+ /**
4841
+ * Payload container for every user action on a marketing message. The name
4842
+ * reflects its original click-only use; branch on `action_type` to tell a
4843
+ * click from a landing page view.
4844
+ */
4845
+ interface MarketingMessagesLinkClickData {
4846
+ /**
4847
+ * Which part of the message was tapped: the call-to-action or the body.
4848
+ * Click events only — absent on a landing page view.
4849
+ */
4850
+ click_component?: 'cta' | 'body';
4851
+ /**
4852
+ * Product ID assigned in Ads Manager or the Marketing API.
4853
+ * Click events only — absent on a landing page view.
4854
+ */
4855
+ product_id?: string;
4856
+ /**
4857
+ * Unique identifier for the click that opened the In-App Browser; also
4858
+ * appended to the destination URL. Shared by the click event and its
4859
+ * landing page view, so use it to correlate them when `tracking_token`
4860
+ * is missing. The key is omitted (not null) when unavailable.
4861
+ */
4862
+ click_id?: string;
4863
+ /**
4864
+ * Internal Meta token for processing and tracking. A landing page view
4865
+ * carries the same `tracking_token` as its click event. The key is omitted
4866
+ * when unavailable.
4867
+ */
4868
+ tracking_token?: string;
4869
+ }
4870
+ interface UserAction {
4871
+ /** Name of the action. @see UserActionType */
4872
+ action_type: UserActionType;
4873
+ /** Unix timestamp, in seconds, of when Meta recorded the action */
4874
+ timestamp: string;
4875
+ /** Action payload. Present on click and landing page view actions. */
4876
+ marketing_messages_link_click_data?: MarketingMessagesLinkClickData;
4877
+ }
4878
+ /**
4879
+ * `messages` field value carrying marketing message user actions.
4880
+ * Neither event order nor pairing is guaranteed: a landing page view may
4881
+ * arrive before, after, or without its click event, and both correlation
4882
+ * keys can be absent.
4883
+ */
4884
+ interface UserActionsWebhookValue {
4885
+ messaging_product: 'whatsapp';
4886
+ metadata: WebhookMetadata;
4887
+ /** User actions on marketing messages */
4888
+ user_actions: UserAction[];
4889
+ }
4637
4890
  //#endregion
4638
4891
  //#region src/core/webhook/types/messageEchoes.d.ts
4639
4892
  /**
@@ -4790,6 +5043,12 @@ interface StatusWebhook {
4790
5043
  * utility or non-template message delivered inside an open group
4791
5044
  * customer service window; from October 1, 2026, a group service
4792
5045
  * delivery inside the business phone number's free tier.
5046
+ *
5047
+ * From October 1, 2026 reaction messages are the only service message
5048
+ * type that is never charged and do not count toward the free tier, and
5049
+ * eligible governments and non-profits keep service messages free beyond
5050
+ * the tier through December 31, 2027. Meta documents no distinct `type`
5051
+ * for those exemptions, so do not infer eligibility from this value.
4793
5052
  */
4794
5053
  type: 'regular' | 'free_customer_service' | 'free_entry_point' | 'free_group_customer_service';
4795
5054
  /**
@@ -5287,13 +5546,30 @@ interface ErrorWebhookValue {
5287
5546
  errors: Array<WebhookError>;
5288
5547
  }
5289
5548
  /**
5290
- * Union type for all webhook value types
5549
+ * Union type for all webhook value types delivered on the `messages` field.
5550
+ * `UserActionsWebhookValue` carries marketing message click and landing page
5551
+ * view actions (`user_actions`) instead of messages or statuses.
5291
5552
  */
5292
- type WebhookValue = MessageWebhookValue | StatusWebhookValue | ErrorWebhookValue;
5553
+ type WebhookValue = MessageWebhookValue | StatusWebhookValue | ErrorWebhookValue | UserActionsWebhookValue;
5293
5554
  /**
5294
5555
  * Union type for all webhook field values
5295
5556
  */
5296
5557
  type WebhookFieldValue = AccountUpdateWebhookValue | AccountReviewUpdateWebhookValue | AccountAlertsWebhookValue | AccountSettingsUpdateWebhookValue | AutomaticEventsWebhookValue | BusinessCapabilityUpdateWebhookValue | BusinessStatusUpdateWebhookValue | BusinessUsernameUpdatesWebhookValue | CallsWebhookValue | FlowsWebhookValue | GroupLifecycleUpdateWebhookValue | GroupParticipantsUpdateWebhookValue | GroupSettingsUpdateWebhookValue | GroupStatusUpdateWebhookValue | HistoryWebhookValue | MessageEchoesWebhookValue | MessageTemplateComponentsUpdateWebhookValue | MessageTemplateQualityUpdateWebhookValue | MessageTemplateStatusUpdateWebhookValue | MessagingHandoversWebhookValue | PartnerSolutionsWebhookValue | PaymentConfigurationUpdateWebhookValue | PhoneNumberNameUpdateWebhookValue | PhoneNumberQualityUpdateWebhookValue | SecurityWebhookValue | SmbAppStateSyncWebhookValue | SmbMessageEchoesWebhookValue | StandbyWebhookValue | TemplateCategoryUpdateWebhookValue | TemplateCorrectCategoryDetectionWebhookValue | TrackingEventsWebhookValue | UserPreferencesWebhookValue;
5558
+ /**
5559
+ * Maps every webhook field except `messages` to the type of its `value`.
5560
+ * `messages` is left out because the SDK splits it into messages, statuses and
5561
+ * user actions (see `onMessage`, `onStatus` and `onUserAction`).
5562
+ *
5563
+ * @example
5564
+ * ```typescript
5565
+ * type Calls = WebhookFieldValueMap['calls']; // CallsWebhookValue['value']
5566
+ * ```
5567
+ */
5568
+ type WebhookFieldValueMap = { [F in WebhookFieldValue['field']]: Extract<WebhookFieldValue, {
5569
+ field: F;
5570
+ }>['value'] };
5571
+ /** Webhook field names accepted by `WebhookProcessor.on()`: every field except `messages`. */
5572
+ type NonMessageWebhookField = keyof WebhookFieldValueMap;
5297
5573
  interface WebhookPayload {
5298
5574
  object: 'whatsapp_business_account';
5299
5575
  entry: Array<{
@@ -5384,6 +5660,11 @@ declare class WhatsAppError extends Error {
5384
5660
  declare class WhatsAppApiError extends WhatsAppError {
5385
5661
  readonly error: MetaErrorData;
5386
5662
  readonly statusCode?: number;
5663
+ /**
5664
+ * Rate limit headers of the failed response, when it carried any. Set by the SDK's requester;
5665
+ * use `rateLimit.retryDelayMs` to reschedule a throttled call.
5666
+ */
5667
+ rateLimit?: RateLimitInfo;
5387
5668
  constructor(message: string, error: MetaErrorData, statusCode?: number);
5388
5669
  }
5389
5670
  declare class WhatsAppAuthorizationError extends WhatsAppApiError {
@@ -6119,7 +6400,7 @@ interface FlowClass {
6119
6400
  * @returns Promise with the success status and validation errors
6120
6401
  */
6121
6402
  updateFlowJson(flowId: string, data: {
6122
- file: Blob | Buffer | object;
6403
+ file: Blob | Uint8Array | object;
6123
6404
  name?: string;
6124
6405
  }): Promise<UpdateFlowResponse>;
6125
6406
  /**
@@ -6130,7 +6411,7 @@ interface FlowClass {
6130
6411
  * @param flowJsonData - The Flow JSON content as a Buffer, JSON object, or Blob.
6131
6412
  * @returns Promise indicating if the JSON is valid and includes validation errors if any.
6132
6413
  */
6133
- validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
6414
+ validateFlowJson(flowId: string, flowJsonData: Blob | Uint8Array | object): Promise<ValidateFlowJsonResponse>;
6134
6415
  /**
6135
6416
  * Publish Flow
6136
6417
  *
@@ -6384,7 +6665,7 @@ declare class FlowApi extends BaseAPI implements FlowClass {
6384
6665
  * ```
6385
6666
  */
6386
6667
  updateFlowJson(flowId: string, data: {
6387
- file: Blob | Buffer | object;
6668
+ file: Blob | Uint8Array | object;
6388
6669
  name?: string;
6389
6670
  }): Promise<UpdateFlowResponse>;
6390
6671
  /**
@@ -6414,7 +6695,7 @@ declare class FlowApi extends BaseAPI implements FlowClass {
6414
6695
  * }
6415
6696
  * ```
6416
6697
  */
6417
- validateFlowJson(flowId: string, flowJsonData: Blob | Buffer | object): Promise<ValidateFlowJsonResponse>;
6698
+ validateFlowJson(flowId: string, flowJsonData: Blob | Uint8Array | object): Promise<ValidateFlowJsonResponse>;
6418
6699
  /**
6419
6700
  * Publish a flow.
6420
6701
  *
@@ -6744,11 +7025,24 @@ declare class MediaApi extends BaseAPI implements MediaClass {
6744
7025
  * messages containing that media. Media is automatically encrypted and stored
6745
7026
  * on Meta's servers.
6746
7027
  *
6747
- * **Endpoint:** `POST /{PHONE_NUMBER_ID}/media`
7028
+ * **Endpoint:** `POST /{PHONE_NUMBER_ID}/media` (`multipart/form-data` with `file`, `type` and
7029
+ * `messaging_product`)
7030
+ *
7031
+ * Accepts a `File`, `Blob`, `Uint8Array` (including a Node.js `Buffer`), `ArrayBuffer` or web
7032
+ * `ReadableStream<Uint8Array>` on every runtime. Pass the MIME type in `options.type` unless the
7033
+ * input is a `Blob`/`File` that already has one.
6748
7034
  *
6749
- * @param file - The `File` object to upload. The `type` property must match a supported MIME type.
6750
- * @param messagingProduct - The messaging product identifier (defaults to `'whatsapp'`)
7035
+ * **Memory:** a `ReadableStream` is read fully into a `Blob` before the request is sent. Meta
7036
+ * requires a multipart body and `fetch` only accepts `Blob` parts in `FormData`, so the upload is
7037
+ * not streamed end to end. Peak memory can exceed the file size (Meta caps media at 100 MB for
7038
+ * documents, 16 MB for audio/video, 5 MB for images). Buffering once also lets a throttled upload
7039
+ * be retried. Blob construction snapshots byte inputs; allow room for these copies.
7040
+ *
7041
+ * @param file - The content to upload
7042
+ * @param optionsOrMessagingProduct - Upload options, or the messaging product string (legacy form,
7043
+ * defaults to `'whatsapp'`)
6751
7044
  * @returns A promise resolving to the upload response containing the assigned `id` (media ID)
7045
+ * @throws WhatsAppValidationError when no MIME type is available or the input type is unsupported
6752
7046
  *
6753
7047
  * @see {@link https://developers.facebook.com/docs/whatsapp/cloud-api/reference/media#upload-media | Upload Media Reference}
6754
7048
  *
@@ -6756,11 +7050,14 @@ declare class MediaApi extends BaseAPI implements MediaClass {
6756
7050
  * ```ts
6757
7051
  * const file = new File([buffer], 'image.jpg', { type: 'image/jpeg' });
6758
7052
  * const { id } = await client.media.uploadMedia(file);
6759
- * // Use the media ID to send an image message
6760
- * await client.messages.image({ body: { id }, to: '1234567890' });
7053
+ *
7054
+ * // Bytes or a web stream (e.g. a fetch() body) need a MIME type
7055
+ * const res = await fetch('https://example.com/report.pdf');
7056
+ * await client.media.uploadMedia(res.body!, { type: 'application/pdf', filename: 'report.pdf' });
6761
7057
  * ```
6762
7058
  */
6763
7059
  uploadMedia(file: File, messagingProduct?: string): Promise<UploadMediaResponse>;
7060
+ uploadMedia(file: UploadMediaInput, options?: UploadMediaOptions): Promise<UploadMediaResponse>;
6764
7061
  /**
6765
7062
  * Deletes a media file from WhatsApp servers.
6766
7063
  *
@@ -8041,7 +8338,7 @@ declare class BusinessProfileApi extends BaseAPI implements BusinessProfileClass
8041
8338
  * );
8042
8339
  * ```
8043
8340
  */
8044
- uploadMedia(uploadId: string, file: Buffer): Promise<UploadBusinessProfileResponse>;
8341
+ uploadMedia(uploadId: string, file: Uint8Array): Promise<UploadBusinessProfileResponse>;
8045
8342
  /**
8046
8343
  * Get the upload handle for a completed upload.
8047
8344
  *
@@ -8775,7 +9072,7 @@ type EncryptionKeyPair = {
8775
9072
  */
8776
9073
  declare function generateEncryption(passphrase?: string): EncryptionKeyPair;
8777
9074
  /**
8778
- * Decrypt a WhatsApp Flow request
9075
+ * Decrypt a WhatsApp Flow request (Node.js only; see {@link decryptFlowRequestAsync} for every runtime)
8779
9076
  * @param body - Encrypted request body containing encrypted_aes_key, encrypted_flow_data, and initial_vector
8780
9077
  * @param config - WABA configuration containing FLOW_API_PRIVATE_PEM and FLOW_API_PASSPHRASE
8781
9078
  * @returns Decrypted flow request body, AES key buffer, and initial vector buffer
@@ -8787,7 +9084,7 @@ declare function decryptFlowRequest(body: any, config: WabaConfigType): {
8787
9084
  initialVectorBuffer: Buffer;
8788
9085
  };
8789
9086
  /**
8790
- * Encrypt a WhatsApp Flow response
9087
+ * Encrypt a WhatsApp Flow response (Node.js only; see {@link encryptFlowResponseAsync} for every runtime)
8791
9088
  * @param response - Response object to encrypt
8792
9089
  * @param aesKeyBuffer - AES key buffer from the decrypted request
8793
9090
  * @param initialVectorBuffer - Initial vector buffer from the decrypted request
@@ -8795,11 +9092,42 @@ declare function decryptFlowRequest(body: any, config: WabaConfigType): {
8795
9092
  * @throws {Error} If encryption fails
8796
9093
  */
8797
9094
  declare function encryptFlowResponse(response: any, aesKeyBuffer: Buffer, initialVectorBuffer: Buffer): string;
9095
+ /**
9096
+ * Result of {@link decryptFlowRequestAsync}. Pass `aesKeyBuffer` and
9097
+ * `initialVectorBuffer` to {@link encryptFlowResponseAsync}.
9098
+ */
9099
+ type DecryptedFlowRequest = {
9100
+ decryptedBody: FlowEndpointRequest;
9101
+ aesKeyBuffer: Uint8Array<ArrayBuffer>;
9102
+ initialVectorBuffer: Uint8Array<ArrayBuffer>;
9103
+ };
9104
+ /**
9105
+ * Decrypt a WhatsApp Flow request with Web Crypto. Works on Node.js, Bun, Deno,
9106
+ * Cloudflare Workers and Vercel Edge.
9107
+ *
9108
+ * On runtimes without `node:crypto` the private key must be an unencrypted
9109
+ * PKCS#8 PEM (`-----BEGIN PRIVATE KEY-----`); the passphrase is then ignored.
9110
+ *
9111
+ * @param body - Encrypted request body containing encrypted_aes_key, encrypted_flow_data, and initial_vector
9112
+ * @param config - WABA configuration containing FLOW_API_PRIVATE_PEM and (for encrypted keys) FLOW_API_PASSPHRASE
9113
+ * @throws {Error} If required encryption properties are missing or decryption fails
9114
+ */
9115
+ declare function decryptFlowRequestAsync(body: any, config: WabaConfigType): Promise<DecryptedFlowRequest>;
9116
+ /**
9117
+ * Encrypt a WhatsApp Flow response with Web Crypto. Works on every runtime.
9118
+ * @param response - Response object to encrypt
9119
+ * @param aesKeyBuffer - AES key from {@link decryptFlowRequestAsync} (a Node.js Buffer also works)
9120
+ * @param initialVectorBuffer - Initial vector from {@link decryptFlowRequestAsync} (a Node.js Buffer also works)
9121
+ * @returns Base64-encoded encrypted response
9122
+ */
9123
+ declare function encryptFlowResponseAsync(response: any, aesKeyBuffer: Uint8Array, initialVectorBuffer: Uint8Array): Promise<string>;
8798
9124
  //#endregion
8799
9125
  //#region src/utils/http/httpsClient.d.ts
8800
9126
  declare class HttpsClient implements HttpsClientClass {
8801
- agent: Agent;
8802
- constructor();
9127
+ /**
9128
+ * Kept for backwards compatibility. Requests go through the global `fetch`,
9129
+ * which manages its own connection pool, so there is nothing to clear.
9130
+ */
8803
9131
  clearSockets(): boolean;
8804
9132
  sendRequest(hostname: string, path: string, method: HttpMethodsEnum, headers: HeadersInit, timeout: number, body?: BodyInit | null): Promise<HttpsClientResponseClass>;
8805
9133
  }
@@ -8815,7 +9143,16 @@ declare class Requester implements RequesterClass {
8815
9143
  host: Readonly<string>;
8816
9144
  protocol: Readonly<string>;
8817
9145
  private retryConfig;
8818
- constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string, retryConfig?: RetryConfig);
9146
+ private onRateLimitInfo;
9147
+ private lastRateLimitInfo;
9148
+ constructor(apiVersion: string, phoneNumberId: number, accessToken: string, businessAcctId: string, userAgent: string, retryConfig?: RetryConfig, onRateLimitInfo?: RateLimitInfoListener);
9149
+ /**
9150
+ * Rate limit headers of the most recent response that carried any, or undefined.
9151
+ * With concurrent requests this is whichever response finished last; use the
9152
+ * `onRateLimitInfo` config callback to see every response.
9153
+ */
9154
+ getLastRateLimitInfo(): RateLimitInfo | undefined;
9155
+ private captureRateLimitInfo;
8819
9156
  buildHeader(contentType: string, additionalHeaders?: Record<string, string>): HeadersInit;
8820
9157
  buildCAPIPath(endpoint: string): string;
8821
9158
  private normalizeApiVersion;
@@ -8865,6 +9202,13 @@ declare class WhatsApp {
8865
9202
  updateTimeout(timeout: number): void;
8866
9203
  updateSenderNumberId(phoneNumberId: number): void;
8867
9204
  updateAccessToken(accessToken: string): void;
9205
+ /**
9206
+ * Rate limit headers (`X-App-Usage`, `X-Business-Use-Case-Usage`, `Retry-After`) of the most
9207
+ * recent response that carried any, or undefined before the first such response. With
9208
+ * concurrent requests this reflects whichever finished last; pass `onRateLimitInfo` in the
9209
+ * config to observe every response.
9210
+ */
9211
+ getLastRateLimitInfo(): RateLimitInfo | undefined;
8868
9212
  /**
8869
9213
  * Get SDK version
8870
9214
  */
@@ -8908,6 +9252,35 @@ declare class WhatsApp {
8908
9252
  generateEncryption(passphrase?: string): EncryptionKeyPair;
8909
9253
  }
8910
9254
  //#endregion
9255
+ //#region src/core/webhook/dedupe.d.ts
9256
+ interface MemoryDedupeStoreOptions {
9257
+ /** Most keys kept at once; the least recently seen key is dropped first. Defaults to 10,000. */
9258
+ maxEntries?: number;
9259
+ }
9260
+ /**
9261
+ * Bounded in-memory {@link DedupeStore} with per-key TTL and least recently
9262
+ * seen eviction. This is the default store for `dedupe`.
9263
+ *
9264
+ * Single instance only: it lives in this process's memory, so it does not see
9265
+ * deliveries handled by other instances and forgets everything on restart (and
9266
+ * on each cold start of a serverless function). Use a shared store such as
9267
+ * Redis when you run more than one instance.
9268
+ */
9269
+ declare class MemoryDedupeStore implements DedupeStore {
9270
+ private readonly maxEntries;
9271
+ /** key -> expiry time in ms. Map order doubles as recency order (oldest first). */
9272
+ private readonly entries;
9273
+ constructor(options?: MemoryDedupeStoreOptions);
9274
+ has(key: string): Promise<boolean>;
9275
+ setIfAbsent(key: string, ttlSeconds: number): Promise<boolean>;
9276
+ /** Number of keys currently held (expired keys may still be counted until evicted). */
9277
+ get size(): number;
9278
+ /** Forget every key. */
9279
+ clear(): void;
9280
+ private lookup;
9281
+ private evict;
9282
+ }
9283
+ //#endregion
8911
9284
  //#region src/core/webhook/utils/webhookUtils.d.ts
8912
9285
  /**
8913
9286
  * Processed message with metadata for handlers
@@ -8941,135 +9314,23 @@ type ProcessedStatus = {
8941
9314
  status: StatusWebhook;
8942
9315
  };
8943
9316
  /**
8944
- * Processed webhook field types for specialized handlers
9317
+ * Processed marketing message user action (link click or landing page view)
9318
+ * delivered as `user_actions` on the `messages` field. Marketing Messages API
9319
+ * for WhatsApp only. Branch on `action.action_type` and ignore unknown values.
8945
9320
  */
8946
- type ProcessedAccountUpdate = {
8947
- wabaId: string;
8948
- value: AccountUpdateWebhookValue['value'];
8949
- };
8950
- type ProcessedAccountReviewUpdate = {
8951
- wabaId: string;
8952
- value: AccountReviewUpdateWebhookValue['value'];
8953
- };
8954
- type ProcessedAccountAlerts = {
8955
- wabaId: string;
8956
- value: AccountAlertsWebhookValue['value'];
8957
- };
8958
- type ProcessedBusinessCapabilityUpdate = {
8959
- wabaId: string;
8960
- value: BusinessCapabilityUpdateWebhookValue['value'];
8961
- };
8962
- type ProcessedPhoneNumberNameUpdate = {
8963
- wabaId: string;
8964
- value: PhoneNumberNameUpdateWebhookValue['value'];
8965
- };
8966
- type ProcessedPhoneNumberQualityUpdate = {
8967
- wabaId: string;
8968
- value: PhoneNumberQualityUpdateWebhookValue['value'];
8969
- };
8970
- type ProcessedMessageTemplateStatusUpdate = {
8971
- wabaId: string;
8972
- value: MessageTemplateStatusUpdateWebhookValue['value'];
8973
- };
8974
- type ProcessedTemplateCategoryUpdate = {
8975
- wabaId: string;
8976
- value: TemplateCategoryUpdateWebhookValue['value'];
8977
- };
8978
- type ProcessedMessageTemplateQualityUpdate = {
8979
- wabaId: string;
8980
- value: MessageTemplateQualityUpdateWebhookValue['value'];
8981
- };
8982
- type ProcessedFlows = {
8983
- wabaId: string;
8984
- value: FlowsWebhookValue['value'];
8985
- };
8986
- type ProcessedSecurity = {
8987
- wabaId: string;
8988
- value: SecurityWebhookValue['value'];
8989
- };
8990
- type ProcessedHistory = {
8991
- wabaId: string;
8992
- value: HistoryWebhookValue['value'];
8993
- };
8994
- type ProcessedSmbMessageEchoes = {
8995
- wabaId: string;
8996
- value: SmbMessageEchoesWebhookValue['value'];
8997
- };
8998
- type ProcessedSmbAppStateSync = {
8999
- wabaId: string;
9000
- value: SmbAppStateSyncWebhookValue['value'];
9001
- };
9002
- type ProcessedAccountSettingsUpdate = {
9003
- wabaId: string;
9004
- value: AccountSettingsUpdateWebhookValue['value'];
9005
- };
9006
- type ProcessedAutomaticEvents = {
9007
- wabaId: string;
9008
- value: AutomaticEventsWebhookValue['value'];
9009
- };
9010
- type ProcessedBusinessStatusUpdate = {
9011
- wabaId: string;
9012
- value: BusinessStatusUpdateWebhookValue['value'];
9013
- };
9014
- type ProcessedBusinessUsernameUpdates = {
9015
- wabaId: string;
9016
- value: BusinessUsernameUpdatesWebhookValue['value'];
9017
- };
9018
- type ProcessedCalls = {
9019
- wabaId: string;
9020
- value: CallsWebhookValue['value'];
9021
- };
9022
- type ProcessedGroupLifecycleUpdate = {
9023
- wabaId: string;
9024
- value: GroupLifecycleUpdateWebhookValue['value'];
9025
- };
9026
- type ProcessedGroupParticipantsUpdate = {
9027
- wabaId: string;
9028
- value: GroupParticipantsUpdateWebhookValue['value'];
9029
- };
9030
- type ProcessedGroupSettingsUpdate = {
9031
- wabaId: string;
9032
- value: GroupSettingsUpdateWebhookValue['value'];
9033
- };
9034
- type ProcessedGroupStatusUpdate = {
9035
- wabaId: string;
9036
- value: GroupStatusUpdateWebhookValue['value'];
9037
- };
9038
- type ProcessedMessageEchoes = {
9039
- wabaId: string;
9040
- value: MessageEchoesWebhookValue['value'];
9041
- };
9042
- type ProcessedMessageTemplateComponentsUpdate = {
9043
- wabaId: string;
9044
- value: MessageTemplateComponentsUpdateWebhookValue['value'];
9045
- };
9046
- type ProcessedMessagingHandovers = {
9047
- wabaId: string;
9048
- value: MessagingHandoversWebhookValue['value'];
9049
- };
9050
- type ProcessedPartnerSolutions = {
9051
- wabaId: string;
9052
- value: PartnerSolutionsWebhookValue['value'];
9053
- };
9054
- type ProcessedPaymentConfigurationUpdate = {
9055
- wabaId: string;
9056
- value: PaymentConfigurationUpdateWebhookValue['value'];
9057
- };
9058
- type ProcessedStandby = {
9059
- wabaId: string;
9060
- value: StandbyWebhookValue['value'];
9061
- };
9062
- type ProcessedTemplateCorrectCategoryDetection = {
9321
+ type ProcessedUserAction = {
9063
9322
  wabaId: string;
9064
- value: TemplateCorrectCategoryDetectionWebhookValue['value'];
9065
- };
9066
- type ProcessedTrackingEvents = {
9067
- wabaId: string;
9068
- value: TrackingEventsWebhookValue['value'];
9323
+ phoneNumberId: string;
9324
+ displayPhoneNumber: string;
9325
+ action: UserAction;
9069
9326
  };
9070
- type ProcessedUserPreferences = {
9327
+ /**
9328
+ * What a handler for a non-`messages` webhook field receives: the WhatsApp
9329
+ * Business Account id and the change's `value`, typed by field name.
9330
+ */
9331
+ type ProcessedWebhookField<F extends NonMessageWebhookField> = {
9071
9332
  wabaId: string;
9072
- value: UserPreferencesWebhookValue['value'];
9333
+ value: WebhookFieldValueMap[F];
9073
9334
  };
9074
9335
  type TextProcessedMessage = ProcessedMessage & {
9075
9336
  message: Extract<WhatsAppMessage, {
@@ -9153,40 +9414,53 @@ type WebhookHandlerContext = {
9153
9414
  type WebhookHandler<TProcessed, TReturn = void> = (whatsapp: WhatsApp, processed: TProcessed, context: WebhookHandlerContext) => TReturn | Promise<TReturn>;
9154
9415
  type MessageHandler = WebhookHandler<ProcessedMessage>;
9155
9416
  type StatusHandler = WebhookHandler<ProcessedStatus>;
9417
+ type UserActionHandler = WebhookHandler<ProcessedUserAction>;
9156
9418
  type FlowHandler = WebhookHandler<FlowEndpointRequest, any>;
9157
9419
  type RawWebhookHandler = WebhookHandler<WebhookPayload>;
9158
- type AccountUpdateHandler = WebhookHandler<ProcessedAccountUpdate>;
9159
- type AccountReviewUpdateHandler = WebhookHandler<ProcessedAccountReviewUpdate>;
9160
- type AccountAlertsHandler = WebhookHandler<ProcessedAccountAlerts>;
9161
- type BusinessCapabilityUpdateHandler = WebhookHandler<ProcessedBusinessCapabilityUpdate>;
9162
- type PhoneNumberNameUpdateHandler = WebhookHandler<ProcessedPhoneNumberNameUpdate>;
9163
- type PhoneNumberQualityUpdateHandler = WebhookHandler<ProcessedPhoneNumberQualityUpdate>;
9164
- type MessageTemplateStatusUpdateHandler = WebhookHandler<ProcessedMessageTemplateStatusUpdate>;
9165
- type TemplateCategoryUpdateHandler = WebhookHandler<ProcessedTemplateCategoryUpdate>;
9166
- type MessageTemplateQualityUpdateHandler = WebhookHandler<ProcessedMessageTemplateQualityUpdate>;
9167
- type FlowsHandler = WebhookHandler<ProcessedFlows>;
9168
- type SecurityHandler = WebhookHandler<ProcessedSecurity>;
9169
- type HistoryHandler = WebhookHandler<ProcessedHistory>;
9170
- type SmbMessageEchoesHandler = WebhookHandler<ProcessedSmbMessageEchoes>;
9171
- type SmbAppStateSyncHandler = WebhookHandler<ProcessedSmbAppStateSync>;
9172
- type AccountSettingsUpdateHandler = WebhookHandler<ProcessedAccountSettingsUpdate>;
9173
- type AutomaticEventsHandler = WebhookHandler<ProcessedAutomaticEvents>;
9174
- type BusinessStatusUpdateHandler = WebhookHandler<ProcessedBusinessStatusUpdate>;
9175
- type BusinessUsernameUpdatesHandler = WebhookHandler<ProcessedBusinessUsernameUpdates>;
9176
- type CallsHandler = WebhookHandler<ProcessedCalls>;
9177
- type GroupLifecycleUpdateHandler = WebhookHandler<ProcessedGroupLifecycleUpdate>;
9178
- type GroupParticipantsUpdateHandler = WebhookHandler<ProcessedGroupParticipantsUpdate>;
9179
- type GroupSettingsUpdateHandler = WebhookHandler<ProcessedGroupSettingsUpdate>;
9180
- type GroupStatusUpdateHandler = WebhookHandler<ProcessedGroupStatusUpdate>;
9181
- type MessageEchoesHandler = WebhookHandler<ProcessedMessageEchoes>;
9182
- type MessageTemplateComponentsUpdateHandler = WebhookHandler<ProcessedMessageTemplateComponentsUpdate>;
9183
- type MessagingHandoversHandler = WebhookHandler<ProcessedMessagingHandovers>;
9184
- type PartnerSolutionsHandler = WebhookHandler<ProcessedPartnerSolutions>;
9185
- type PaymentConfigurationUpdateHandler = WebhookHandler<ProcessedPaymentConfigurationUpdate>;
9186
- type StandbyHandler = WebhookHandler<ProcessedStandby>;
9187
- type TemplateCorrectCategoryDetectionHandler = WebhookHandler<ProcessedTemplateCorrectCategoryDetection>;
9188
- type TrackingEventsHandler = WebhookHandler<ProcessedTrackingEvents>;
9189
- type UserPreferencesHandler = WebhookHandler<ProcessedUserPreferences>;
9420
+ /** Handler for a non-`messages` webhook field; `processed.value` is typed by the field name. */
9421
+ type WebhookFieldHandler<F extends NonMessageWebhookField> = WebhookHandler<ProcessedWebhookField<F>>;
9422
+ /** Registered field handlers keyed by field name, as kept by `WebhookProcessor`. */
9423
+ type WebhookFieldHandlerMap = ReadonlyMap<NonMessageWebhookField, AnyWebhookFieldHandler>;
9424
+ /**
9425
+ * Field handler with the field type erased, for storage in a map. `on()`
9426
+ * guarantees each stored handler matches its key.
9427
+ */
9428
+ type AnyWebhookFieldHandler = WebhookHandler<{
9429
+ wabaId: string;
9430
+ value: any;
9431
+ }>;
9432
+ type AccountUpdateHandler = WebhookFieldHandler<'account_update'>;
9433
+ type AccountReviewUpdateHandler = WebhookFieldHandler<'account_review_update'>;
9434
+ type AccountAlertsHandler = WebhookFieldHandler<'account_alerts'>;
9435
+ type BusinessCapabilityUpdateHandler = WebhookFieldHandler<'business_capability_update'>;
9436
+ type PhoneNumberNameUpdateHandler = WebhookFieldHandler<'phone_number_name_update'>;
9437
+ type PhoneNumberQualityUpdateHandler = WebhookFieldHandler<'phone_number_quality_update'>;
9438
+ type MessageTemplateStatusUpdateHandler = WebhookFieldHandler<'message_template_status_update'>;
9439
+ type TemplateCategoryUpdateHandler = WebhookFieldHandler<'template_category_update'>;
9440
+ type MessageTemplateQualityUpdateHandler = WebhookFieldHandler<'message_template_quality_update'>;
9441
+ type FlowsHandler = WebhookFieldHandler<'flows'>;
9442
+ type SecurityHandler = WebhookFieldHandler<'security'>;
9443
+ type HistoryHandler = WebhookFieldHandler<'history'>;
9444
+ type SmbMessageEchoesHandler = WebhookFieldHandler<'smb_message_echoes'>;
9445
+ type SmbAppStateSyncHandler = WebhookFieldHandler<'smb_app_state_sync'>;
9446
+ type AccountSettingsUpdateHandler = WebhookFieldHandler<'account_settings_update'>;
9447
+ type AutomaticEventsHandler = WebhookFieldHandler<'automatic_events'>;
9448
+ type BusinessStatusUpdateHandler = WebhookFieldHandler<'business_status_update'>;
9449
+ type BusinessUsernameUpdatesHandler = WebhookFieldHandler<'business_username_updates'>;
9450
+ type CallsHandler = WebhookFieldHandler<'calls'>;
9451
+ type GroupLifecycleUpdateHandler = WebhookFieldHandler<'group_lifecycle_update'>;
9452
+ type GroupParticipantsUpdateHandler = WebhookFieldHandler<'group_participants_update'>;
9453
+ type GroupSettingsUpdateHandler = WebhookFieldHandler<'group_settings_update'>;
9454
+ type GroupStatusUpdateHandler = WebhookFieldHandler<'group_status_update'>;
9455
+ type MessageEchoesHandler = WebhookFieldHandler<'message_echoes'>;
9456
+ type MessageTemplateComponentsUpdateHandler = WebhookFieldHandler<'message_template_components_update'>;
9457
+ type MessagingHandoversHandler = WebhookFieldHandler<'messaging_handovers'>;
9458
+ type PartnerSolutionsHandler = WebhookFieldHandler<'partner_solutions'>;
9459
+ type PaymentConfigurationUpdateHandler = WebhookFieldHandler<'payment_configuration_update'>;
9460
+ type StandbyHandler = WebhookFieldHandler<'standby'>;
9461
+ type TemplateCorrectCategoryDetectionHandler = WebhookFieldHandler<'template_correct_category_detection'>;
9462
+ type TrackingEventsHandler = WebhookFieldHandler<'tracking_events'>;
9463
+ type UserPreferencesHandler = WebhookFieldHandler<'user_preferences'>;
9190
9464
  type TextMessageHandler = WebhookHandler<TextProcessedMessage>;
9191
9465
  type ImageMessageHandler = WebhookHandler<ImageProcessedMessage>;
9192
9466
  type VideoMessageHandler = WebhookHandler<VideoProcessedMessage>;
@@ -9201,15 +9475,11 @@ type ReactionMessageHandler = WebhookHandler<ReactionProcessedMessage>;
9201
9475
  type OrderMessageHandler = WebhookHandler<OrderProcessedMessage>;
9202
9476
  type SystemMessageHandler = WebhookHandler<SystemProcessedMessage>;
9203
9477
  /**
9204
- * Process webhook messages
9478
+ * Named handler options accepted by {@link processWebhookMessages}, one per
9479
+ * webhook field except `messages`. Kept for backward compatibility; new code
9480
+ * can pass `fieldHandlers` instead.
9205
9481
  */
9206
- declare function processWebhookMessages(request: Request, whatsapp: WhatsApp, handlers: {
9207
- messageHandlers: Map<MessageTypesEnum, MessageHandler>;
9208
- statusHandler?: StatusHandler;
9209
- preProcessHandler?: MessageHandler;
9210
- postProcessHandler?: MessageHandler;
9211
- rawHandler?: RawWebhookHandler;
9212
- rawHandlerFields?: WebhookFieldType[];
9482
+ type WebhookFieldHandlerOptions = {
9213
9483
  accountUpdateHandler?: AccountUpdateHandler;
9214
9484
  accountReviewUpdateHandler?: AccountReviewUpdateHandler;
9215
9485
  accountAlertsHandler?: AccountAlertsHandler;
@@ -9242,11 +9512,52 @@ declare function processWebhookMessages(request: Request, whatsapp: WhatsApp, ha
9242
9512
  templateCorrectCategoryDetectionHandler?: TemplateCorrectCategoryDetectionHandler;
9243
9513
  trackingEventsHandler?: TrackingEventsHandler;
9244
9514
  userPreferencesHandler?: UserPreferencesHandler;
9245
- }): Promise<Response>;
9515
+ };
9516
+ /** Dedupe settings for {@link processWebhookMessages}. */
9517
+ type WebhookDedupeOptions = {
9518
+ store: DedupeStore; /** Defaults to 86400 (24 hours). */
9519
+ ttlSeconds?: number;
9520
+ };
9521
+ /** Options for {@link processWebhookMessages}. */
9522
+ type ProcessWebhookOptions = WebhookSignatureOptions & {
9523
+ /** Skip handlers for deliveries already seen. Duplicates still get a 200 response. */dedupe?: WebhookDedupeOptions;
9524
+ };
9525
+ /**
9526
+ * Process webhook messages
9527
+ */
9528
+ declare function processWebhookMessages(request: Request, whatsapp: WhatsApp, handlers: {
9529
+ messageHandlers: Map<MessageTypesEnum, MessageHandler>;
9530
+ statusHandler?: StatusHandler;
9531
+ userActionHandler?: UserActionHandler;
9532
+ preProcessHandler?: MessageHandler;
9533
+ postProcessHandler?: MessageHandler;
9534
+ rawHandler?: RawWebhookHandler;
9535
+ rawHandlerFields?: WebhookFieldType[];
9536
+ /**
9537
+ * Handlers for non-`messages` fields keyed by field name. Takes
9538
+ * precedence over the named `xxxHandler` option for the same field.
9539
+ */
9540
+ fieldHandlers?: WebhookFieldHandlerMap;
9541
+ } & WebhookFieldHandlerOptions, options?: ProcessWebhookOptions): Promise<Response>;
9246
9542
  /**
9247
9543
  * Handle flow requests
9248
9544
  */
9249
9545
  declare function processFlowRequest(request: Request, config: WabaConfigType, whatsapp: WhatsApp, flowHandlers: Map<FlowTypeEnum, FlowHandler>): Promise<Response>;
9546
+ type WebhookSignatureOptions = {
9547
+ /** Meta App Secret used as the HMAC key. */appSecret?: string; /** When true, reject requests without a valid `X-Hub-Signature-256`. */
9548
+ verifySignature?: boolean;
9549
+ };
9550
+ /**
9551
+ * Check an `X-Hub-Signature-256` header (`sha256=<hex>`) against the raw
9552
+ * request body using Web Crypto, so it works on every runtime. Constant-time;
9553
+ * resolves to false instead of throwing on malformed or wrong-length input.
9554
+ */
9555
+ declare function verifyWebhookSignature(rawBody: string, signatureHeader: string | null, appSecret: string): Promise<boolean>;
9556
+ /**
9557
+ * Synchronous variant of {@link verifyWebhookSignature}. Needs `node:crypto`
9558
+ * (Node.js >= 20.12, Bun, Deno); prefer the async variant on edge runtimes.
9559
+ */
9560
+ declare function isValidWebhookSignature(rawBody: string, signatureHeader: string | null, appSecret: string): boolean;
9250
9561
  /**
9251
9562
  * Constructs a full URL from framework-specific request headers and URL
9252
9563
  * @param headers - Request headers containing host and protocol information
@@ -9266,52 +9577,56 @@ declare class WebhookProcessor {
9266
9577
  private client;
9267
9578
  private messageHandlers;
9268
9579
  private statusHandler;
9580
+ private userActionHandler;
9269
9581
  private preProcessHandler;
9270
9582
  private postProcessHandler;
9271
9583
  private rawHandler;
9272
9584
  private flowHandlers;
9273
- private accountUpdateHandler;
9274
- private accountReviewUpdateHandler;
9275
- private accountAlertsHandler;
9276
- private businessCapabilityUpdateHandler;
9277
- private phoneNumberNameUpdateHandler;
9278
- private phoneNumberQualityUpdateHandler;
9279
- private messageTemplateStatusUpdateHandler;
9280
- private templateCategoryUpdateHandler;
9281
- private messageTemplateQualityUpdateHandler;
9282
- private flowsHandler;
9283
- private securityHandler;
9284
- private historyHandler;
9285
- private smbMessageEchoesHandler;
9286
- private smbAppStateSyncHandler;
9287
- private accountSettingsUpdateHandler;
9288
- private automaticEventsHandler;
9289
- private businessStatusUpdateHandler;
9290
- private businessUsernameUpdatesHandler;
9291
- private callsHandler;
9292
- private groupLifecycleUpdateHandler;
9293
- private groupParticipantsUpdateHandler;
9294
- private groupSettingsUpdateHandler;
9295
- private groupStatusUpdateHandler;
9296
- private messageEchoesHandler;
9297
- private messageTemplateComponentsUpdateHandler;
9298
- private messagingHandoversHandler;
9299
- private partnerSolutionsHandler;
9300
- private paymentConfigurationUpdateHandler;
9301
- private standbyHandler;
9302
- private templateCorrectCategoryDetectionHandler;
9303
- private trackingEventsHandler;
9304
- private userPreferencesHandler;
9585
+ /** Handlers for every webhook field except `messages`, keyed by field name. */
9586
+ private fieldHandlers;
9587
+ private verifySignature;
9588
+ private dedupe;
9305
9589
  constructor(config: WhatsAppConfig);
9306
9590
  processVerification(mode: string | null, token: string | null, challenge: string | null): Promise<WebhookResponse>;
9307
9591
  processWebhook(request: Request): Promise<WebhookResponse>;
9308
9592
  processFlow(request: Request): Promise<WebhookResponse>;
9309
9593
  onMessage(type: MessageTypesEnum | string, handler: MessageHandler): void;
9310
9594
  onStatus(handler: StatusHandler): void;
9595
+ /**
9596
+ * Register a handler for marketing message user actions delivered as
9597
+ * `user_actions` on the `messages` webhook field (Marketing Messages API
9598
+ * for WhatsApp only): `marketing_messages_link_click` and
9599
+ * `landing_page_view`. `action_type` is an open enum — ignore unknown values.
9600
+ * @see https://developers.facebook.com/documentation/business-messaging/whatsapp/marketing-messages/track-landing-page-views
9601
+ */
9602
+ onUserAction(handler: UserActionHandler): void;
9311
9603
  onMessagePreProcess(handler: MessageHandler): void;
9312
9604
  onMessagePostProcess(handler: MessageHandler): void;
9313
9605
  onRaw(handler: RawWebhookHandler, fields?: WebhookFieldType[]): void;
9314
9606
  onFlow(type: FlowTypeEnum, handler: FlowHandler): void;
9607
+ /**
9608
+ * Register a handler for any webhook field except `messages`. The type of
9609
+ * `processed.value` follows from the field name. Replaces any handler
9610
+ * already registered for that field, including one set with the matching
9611
+ * `onXxx` method (for example `onCalls` is `on('calls', handler)`).
9612
+ *
9613
+ * `messages` is not accepted: use `onMessage`, the typed message methods
9614
+ * (`onText`, ...), `onStatus` or `onUserAction`, which split that field
9615
+ * into messages, statuses and user actions.
9616
+ *
9617
+ * @example
9618
+ * ```typescript
9619
+ * processor.on('calls', async (whatsapp, { value }) => {
9620
+ * for (const call of value.calls) console.log(call.id, call.event);
9621
+ * });
9622
+ * ```
9623
+ */
9624
+ on<F extends NonMessageWebhookField>(field: F, handler: WebhookFieldHandler<F>): void;
9625
+ /**
9626
+ * Remove the handler for a webhook field registered with `on()` or the
9627
+ * matching `onXxx` method. `messages` is not accepted (see {@link on}).
9628
+ */
9629
+ off(field: NonMessageWebhookField): void;
9315
9630
  /**
9316
9631
  * Register a handler for text messages
9317
9632
  * @param handler Type-safe handler that receives text messages with guaranteed text field
@@ -9543,6 +9858,10 @@ declare class WebhookProcessor {
9543
9858
  * Remove the status handler
9544
9859
  */
9545
9860
  offStatus(): void;
9861
+ /**
9862
+ * Remove the user action handler
9863
+ */
9864
+ offUserAction(): void;
9546
9865
  /**
9547
9866
  * Remove the raw webhook handler
9548
9867
  */
@@ -9605,9 +9924,116 @@ declare function expressWebhookHandler(config: ExpressWebhookConfig): {
9605
9924
  destroy: () => void;
9606
9925
  };
9607
9926
  //#endregion
9927
+ //#region src/core/webhook/frameworks/fastify/fastify.d.ts
9928
+ interface FastifyWebhookRequest {
9929
+ method: string;
9930
+ url: string;
9931
+ headers: Record<string, string | string[] | undefined>;
9932
+ body?: unknown;
9933
+ query?: unknown;
9934
+ /**
9935
+ * The unparsed request body. Fastify does not keep it by default: set it in
9936
+ * a content-type parser or with the `fastify-raw-body` plugin. Required for
9937
+ * `verifyWebhookSignature: true`, because re-serializing the parsed body
9938
+ * does not reproduce the bytes Meta signed.
9939
+ */
9940
+ rawBody?: string | Uint8Array;
9941
+ }
9942
+ interface FastifyWebhookReply {
9943
+ code(statusCode: number): FastifyWebhookReply;
9944
+ header(name: string, value: string): FastifyWebhookReply;
9945
+ send(payload?: any): FastifyWebhookReply;
9946
+ }
9947
+ interface FastifyWebhookConfig extends WhatsAppConfig {}
9948
+ /** The object returned by {@link fastifyWebhookHandler}. */
9949
+ type FastifyWebhookHandlers = ReturnType<typeof createHandlers$2>;
9950
+ /**
9951
+ * Fastify webhook handler.
9952
+ *
9953
+ * @example
9954
+ * const wa = fastifyWebhookHandler(config);
9955
+ * wa.processor.onText(async (whatsapp, { message }) => { ... });
9956
+ * app.get('/webhook', wa.GET);
9957
+ * app.post('/webhook', wa.POST);
9958
+ * app.post('/flow', wa.flow);
9959
+ */
9960
+ declare function fastifyWebhookHandler(config: FastifyWebhookConfig): FastifyWebhookHandlers;
9961
+ declare function createHandlers$2(config: FastifyWebhookConfig, key: string): {
9962
+ GET: (request: FastifyWebhookRequest, reply: FastifyWebhookReply) => Promise<FastifyWebhookReply>;
9963
+ POST: (request: FastifyWebhookRequest, reply: FastifyWebhookReply) => Promise<FastifyWebhookReply>;
9964
+ webhook: (request: FastifyWebhookRequest, reply: FastifyWebhookReply) => Promise<FastifyWebhookReply>;
9965
+ flow: (request: FastifyWebhookRequest, reply: FastifyWebhookReply) => Promise<FastifyWebhookReply>;
9966
+ processor: WebhookProcessor;
9967
+ /**
9968
+ * Destroy this handler instance: removes all registered handlers
9969
+ * and clears it from the singleton cache so the next call creates a fresh instance.
9970
+ */
9971
+ destroy: () => void;
9972
+ };
9973
+ //#endregion
9974
+ //#region src/core/webhook/frameworks/hono/hono.d.ts
9975
+ /**
9976
+ * The part of Hono's `Context` this adapter uses, typed locally so `hono` is
9977
+ * not a dependency. Any Hono `Context` satisfies it: `c.req.raw` is the
9978
+ * underlying web `Request`.
9979
+ */
9980
+ interface HonoWebhookContext {
9981
+ req: {
9982
+ raw: Request; /** Hono's cached body reader, used when middleware already consumed `raw`. */
9983
+ text?: () => Promise<string>;
9984
+ };
9985
+ }
9986
+ interface HonoWebhookConfig extends WhatsAppConfig {}
9987
+ /** The object returned by {@link honoWebhookHandler}. */
9988
+ type HonoWebhookHandlers = ReturnType<typeof createHandlers$1>;
9989
+ /**
9990
+ * Hono webhook handler. Works on every runtime Hono runs on (Node.js, Bun,
9991
+ * Deno, Cloudflare Workers, Vercel Edge).
9992
+ *
9993
+ * @example
9994
+ * const wa = honoWebhookHandler(config);
9995
+ * wa.processor.onText(async (whatsapp, { message }) => { ... });
9996
+ * app.get('/webhook', wa.GET);
9997
+ * app.post('/webhook', wa.POST);
9998
+ * app.post('/flow', wa.flow);
9999
+ */
10000
+ declare function honoWebhookHandler(config: HonoWebhookConfig): HonoWebhookHandlers;
10001
+ declare function createHandlers$1(config: HonoWebhookConfig, key: string): {
10002
+ GET: (c: HonoWebhookContext) => Promise<Response>;
10003
+ POST: (c: HonoWebhookContext) => Promise<Response>;
10004
+ webhook: (c: HonoWebhookContext) => Promise<Response>;
10005
+ flow: (c: HonoWebhookContext) => Promise<Response>;
10006
+ processor: WebhookProcessor;
10007
+ /**
10008
+ * Destroy this handler instance: removes all registered handlers
10009
+ * and clears it from the singleton cache so the next call creates a fresh instance.
10010
+ */
10011
+ destroy: () => void;
10012
+ };
10013
+ //#endregion
9608
10014
  //#region src/core/webhook/frameworks/nextjs-app/nextjs-app.d.ts
9609
10015
  interface NextJsAppWebhookConfig extends WhatsAppConfig {}
9610
- declare function nextjsAppWebhookHandler(config: NextJsAppWebhookConfig): any;
10016
+ /** The object returned by {@link nextjsAppWebhookHandler}. */
10017
+ type NextJsAppWebhookHandlers = ReturnType<typeof createHandlers>;
10018
+ declare function nextjsAppWebhookHandler(config: NextJsAppWebhookConfig): NextJsAppWebhookHandlers;
10019
+ declare function createHandlers(config: NextJsAppWebhookConfig, key: string): {
10020
+ GET: (request: Request) => Promise<Response>;
10021
+ POST: (request: Request) => Promise<Response>;
10022
+ webhook: {
10023
+ GET: (request: Request) => Promise<Response>;
10024
+ POST: (request: Request) => Promise<Response>;
10025
+ };
10026
+ flow: {
10027
+ GET: (request: Request) => Promise<Response>;
10028
+ POST: (request: Request) => Promise<Response>;
10029
+ };
10030
+ processor: WebhookProcessor;
10031
+ /**
10032
+ * Destroy this handler instance: removes all registered handlers
10033
+ * and clears it from the singleton cache so the next call creates a fresh instance.
10034
+ */
10035
+ destroy: () => void;
10036
+ };
9611
10037
  //#endregion
9612
10038
  //#region src/core/webhook/frameworks/nextjs-page/nextjs-page.d.ts
9613
10039
  interface BaseApiRequest extends BaseRequest {
@@ -9658,7 +10084,14 @@ declare function nextjsPagesWebhookHandler<TRequest extends BaseApiRequest, TRes
9658
10084
  declare function extractMessageText(message: WhatsAppMessage): string;
9659
10085
  //#endregion
9660
10086
  //#region src/core/webhook/utils/generateXHub256Sig.d.ts
10087
+ /**
10088
+ * Compute the hex HMAC-SHA256 that Meta sends in `X-Hub-Signature-256`
10089
+ * (without the `sha256=` prefix). Needs `node:crypto`; use
10090
+ * {@link generateXHub256SigAsync} on edge runtimes.
10091
+ */
9661
10092
  declare const generateXHub256Sig: (body: string, appSecret: string) => string;
10093
+ /** Web Crypto variant of {@link generateXHub256Sig}; works on every runtime. */
10094
+ declare const generateXHub256SigAsync: (body: string, appSecret: string) => Promise<string>;
9662
10095
  //#endregion
9663
10096
  //#region src/core/webhook/utils/messageHelpers.d.ts
9664
10097
  declare function isTextMessage(msg: WhatsAppMessage): msg is TextMessage;
@@ -9780,16 +10213,136 @@ declare function buildFieldsQueryString(fields?: string[] | string): string;
9780
10213
  */
9781
10214
  declare function formatConfigTable(config: WabaConfigType): string;
9782
10215
  //#endregion
10216
+ //#region src/utils/customerServiceWindow.d.ts
10217
+ /**
10218
+ * Length of the customer service window: 24 hours.
10219
+ *
10220
+ * "When a WhatsApp user messages you or calls you, a 24-hour timer called a customer service window
10221
+ * starts. If the user messages or calls you again before the timer expires, the timer resets to
10222
+ * 24 hours. [...] When the window closes, you can only send pre-approved template messages."
10223
+ *
10224
+ * @see {@link https://developers.facebook.com/documentation/business-messaging/whatsapp/messages/send-messages/ | Send messages: customer service windows}
10225
+ */
10226
+ declare const CUSTOMER_SERVICE_WINDOW_MS: number;
10227
+ /**
10228
+ * SDK fallback length of a free entry point (FEP) window: 72 hours.
10229
+ * Prefer the expiry supplied by Meta; this fallback does not establish billing eligibility.
10230
+ *
10231
+ * @see {@link https://developers.facebook.com/documentation/business-messaging/whatsapp/pricing/ | Pricing: free entry point windows}
10232
+ */
10233
+ declare const FREE_ENTRY_POINT_WINDOW_MS: number;
10234
+ /**
10235
+ * Longest free entry point window Meta documents: up to 7 days for conversations started from an
10236
+ * ad that clicks to WhatsApp.
10237
+ *
10238
+ * @see {@link https://developers.facebook.com/documentation/business-messaging/whatsapp/pricing/ | Pricing: free entry point windows}
10239
+ */
10240
+ declare const MAX_FREE_ENTRY_POINT_WINDOW_MS: number;
10241
+ /**
10242
+ * A point in time accepted by the window helpers:
10243
+ * - `Date`
10244
+ * - `number`: Unix epoch in milliseconds, or in seconds when below `1e11` (before the year 5138 in
10245
+ * seconds, before March 1973 in milliseconds), so both `Date.now()` and webhook timestamps work
10246
+ * - `string`: a numeric string such as the webhook `messages[].timestamp` (`"1727856000"`, Unix
10247
+ * seconds, same rule as numbers), or any string `Date.parse` understands (ISO 8601)
10248
+ */
10249
+ type WindowTimestamp = Date | number | string;
10250
+ /** State of a messaging window at a given instant. */
10251
+ interface MessagingWindow {
10252
+ /** True while the window is open (`now < expiresAt`). */
10253
+ isOpen: boolean;
10254
+ /** When the window closes, or `null` when there is no window (no inbound message yet). */
10255
+ expiresAt: Date | null;
10256
+ /** Milliseconds until the window closes, `0` once closed. Never more than the window length. */
10257
+ remainingMs: number;
10258
+ }
10259
+ interface CustomerServiceWindowOptions {
10260
+ /** The instant to evaluate. Defaults to `Date.now()`. */
10261
+ now?: WindowTimestamp;
10262
+ /**
10263
+ * Treat the window as closing this many milliseconds early. Use it to absorb clock drift between
10264
+ * your servers and Meta and the time a send spends in flight. Defaults to `0`.
10265
+ */
10266
+ safetyMarginMs?: number;
10267
+ }
10268
+ interface FreeEntryPointWindowOptions extends CustomerServiceWindowOptions {
10269
+ /**
10270
+ * Window length. Defaults to {@link FREE_ENTRY_POINT_WINDOW_MS} (72 hours). Meta may keep a
10271
+ * click-to-WhatsApp ad window open for up to {@link MAX_FREE_ENTRY_POINT_WINDOW_MS} (7 days)
10272
+ * without saying how long a given window lasts, so prefer `expiresAt` when you have it.
10273
+ */
10274
+ durationMs?: number;
10275
+ /**
10276
+ * Exact expiry when known, for example the status webhook's `conversation.expiration_timestamp`
10277
+ * (Unix seconds). Overrides `durationMs`.
10278
+ */
10279
+ expiresAt?: WindowTimestamp;
10280
+ }
10281
+ /**
10282
+ * Returns the state of the 24-hour customer service window opened by the user's last inbound
10283
+ * message (or call).
10284
+ *
10285
+ * Free-form (non-template) messages can only be sent while it is open; outside it only approved
10286
+ * template messages are delivered (Meta rejects others with error `131047`). The window is exactly
10287
+ * 24 hours from the user's last message: at `lastInboundAt + 24h` it is closed.
10288
+ *
10289
+ * Pass the webhook message `timestamp` (Unix seconds string) of the latest message from the user.
10290
+ * Messages you send do not extend the window. Pass `null`/`undefined` when the user has never
10291
+ * messaged you; that returns a closed window with `expiresAt: null`.
10292
+ *
10293
+ * A free entry point window does not reopen this window: "the customer service window is independent
10294
+ * of the FEP window, so if the customer service window closes, you will only be able to send template
10295
+ * messages." Use {@link getFreeEntryPointWindow} for the pricing side.
10296
+ *
10297
+ * @throws WhatsAppValidationError when a timestamp or `safetyMarginMs` is malformed.
10298
+ *
10299
+ * @see {@link https://developers.facebook.com/documentation/business-messaging/whatsapp/messages/send-messages/ | Send messages: customer service windows}
10300
+ * @see {@link https://developers.facebook.com/documentation/business-messaging/whatsapp/pricing/ | Pricing}
10301
+ *
10302
+ * @example
10303
+ * ```ts
10304
+ * const { isOpen, expiresAt } = getCustomerServiceWindow(message.timestamp);
10305
+ * if (!isOpen) await sendTemplateInstead();
10306
+ * ```
10307
+ */
10308
+ declare function getCustomerServiceWindow(lastInboundAt: WindowTimestamp | null | undefined, options?: CustomerServiceWindowOptions): MessagingWindow;
10309
+ /**
10310
+ * True when a free-form (non-template) message can be sent: the customer service window opened by
10311
+ * the user's last inbound message is still open. See {@link getCustomerServiceWindow}.
10312
+ *
10313
+ * @throws WhatsAppValidationError when a timestamp or `safetyMarginMs` is malformed.
10314
+ */
10315
+ declare function canSendFreeformMessage(lastInboundAt: WindowTimestamp | null | undefined, options?: CustomerServiceWindowOptions): boolean;
10316
+ /**
10317
+ * Returns the state of a free entry point (FEP) window.
10318
+ *
10319
+ * For eligible click-to-WhatsApp ad traffic, replying within the customer service window opens
10320
+ * a billing window from the time of your reply. Pass that first reply time as `openedAt`.
10321
+ *
10322
+ * Meta documents windows lasting up to 7 days for ads that click to WhatsApp. This helper uses
10323
+ * a 72-hour fallback estimate. Pass `expiresAt` (the status webhook's
10324
+ * `conversation.expiration_timestamp`) when you have it, or set `durationMs`.
10325
+ *
10326
+ * This is a billing window only. It does not allow free-form messages after the customer service
10327
+ * window closes; check {@link canSendFreeformMessage} for that.
10328
+ *
10329
+ * @throws WhatsAppValidationError when a timestamp, `durationMs` or `safetyMarginMs` is malformed.
10330
+ *
10331
+ * @see {@link https://developers.facebook.com/documentation/business-messaging/whatsapp/pricing/ | Pricing: free entry point windows}
10332
+ */
10333
+ declare function getFreeEntryPointWindow(openedAt: WindowTimestamp | null | undefined, options?: FreeEntryPointWindowOptions): MessagingWindow;
10334
+ //#endregion
9783
10335
  //#region src/utils/logger.d.ts
9784
10336
  declare class Logger implements LoggerInterface {
9785
10337
  private name;
9786
- private debug;
10338
+ private debugEnabled;
9787
10339
  constructor(name: string, debug?: boolean);
9788
10340
  private formatData;
9789
10341
  log(...data: any[]): void;
9790
10342
  error(...data: any[]): void;
9791
10343
  warn(...data: any[]): void;
9792
10344
  info(...data: any[]): void;
10345
+ debug(...data: any[]): void;
9793
10346
  }
9794
10347
  //#endregion
9795
10348
  //#region src/utils/objectToQueryString.d.ts
@@ -9836,5 +10389,5 @@ declare function isFlowErrorRequest(request: FlowEndpointRequest): request is Fl
9836
10389
  */
9837
10390
  declare function isFlowPingRequest(request: FlowEndpointRequest): request is FlowHealthCheckRequest;
9838
10391
  //#endregion
9839
- export { AUTHORIZATION_ERROR_CODES, type AcceptCallRequest, AcceptSolutionRequest, AccountMode, AddPhoneNumbersRequest, type ApiPermissionErrorCode, AssignedUserRequest, AssignedUsersListParams, type AudioMediaObject, AudioMediaTypes, AudioMediaTypesEnum, AudioMediaTypesType, type AudioMessage, type AudioMessageHandler, type AudioProcessedMessage, type AuthenticationTemplateOptions, BLOCK_USER_ERROR_CODES, type BaseApiRequest, type BaseApiResponse, type BaseClass, BlockUserObject, BlockUsersApi, BlockUsersClass, BlockUsersRequest, BlockUsersResponse, BlockedUserInfo, type BodyOptions, BusinessApi, BusinessClass, BusinessComplianceInfoResponse, BusinessFieldsParam, BusinessGraphListResponse, BusinessGraphObject, BusinessListParams, BusinessProfileApi, type BusinessProfileClass, type BusinessProfileData, type BusinessProfileField, type BusinessProfileFieldsParam, type BusinessProfileResponse, BusinessVerticalEnum, type ButtonMessage, type ButtonMessageHandler, type ButtonOptions, ButtonPosition, ButtonPositionEnum, ButtonPositionType, type ButtonProcessedMessage, CALLING_ERROR_CODES, type CallAction, type CallActionResponse, type CallAnnouncementLanguage, type CallCaptureStatus, type CallHours, type CallHoursDay, type CallHoursStatus, type CallIconVisibility, type CallPermission, type CallPermissionAction, type CallPermissionLimit, type CallPermissionsResponse, type CallRecordingConfig, type CallSdpType, type CallSession, type CallTranscriptionConfig, type CallbackPermissionStatus, CallingApi, type CallingClass, type CallingSettings, type CallingSettingsResponse, type CallingStatus, CarouselCard, type CarouselOptions, CatalogButton, type CatalogTemplateOptions, Category, CategoryEnum, CategoryType, CodeVerificationStatus, CommerceApi, type CommerceClass, type CommerceSetting, type CommerceSettingsResponse, ComponentType, ComponentTypeType, ComponentTypes, ComponentTypesEnum, ContactBookApi, ContactBookClass, type ContactInfo, type ContactObject, type ContactsMessage, type ContactsMessageHandler, type ContactsProcessedMessage, ConversationTypes, ConversationTypesEnum, ConversationTypesType, ConversationalAutomationRequest, ConversationalAutomationResponse, ConversationalCommand, ConversationalPrompt, CopyCodeButton, type CouponTemplateOptions, type CreateFlowResponse, CreateOBOMobilityIntentRequest, CreatePhoneNumberRequest, CreatePhoneNumberResponse, type CreateQrCodeRequest, CreateScheduleRequest, type CreateUploadSessionParams, CreateWhatsAppBusinessSolutionRequest, CurrencyCodesEnum, type CurrencyParameter, CursorPaginationParams, Cursors, DataLocalizationRegion, DataLocalizationRegionEnum, DataLocalizationRegionType, type DateTimeParameter, DeleteContactBookEntryParams, DeleteContactBookEntryResponse, type DirectSendCategory, type DirectSendConfig, type DirectSendOptions, type DocumentMediaObject, DocumentMediaTypes, DocumentMediaTypesEnum, DocumentMediaTypesType, type DocumentMessage, type DocumentMessageHandler, type DocumentProcessedMessage, type EncryptedMessageRequest, type EncryptedMessagesResponse, EncryptionApi, type EncryptionClass, type EncryptionKeyPair, type EncryptionPublicKeyResponse, type ErrorWebhookValue, type ExpressRequest, type ExpressResponse, type ExpressWebhookConfig, FLOW_ERROR_CODES, FailedUserInfo, type Flow, FlowActionEnum, FlowApi, type FlowAsset, type FlowAssetsResponse, FlowButton, FlowCategoryEnum, type FlowClass, type FlowDataExchangeRequest, type FlowDataExchangeResponse, type FlowDecryptedRequestResponse, type FlowEncryptedRequestPayload, type FlowEndpointRequest, type FlowEndpointResponse, type FlowErrorNotificationRequest, type FlowErrorNotificationResponse, type FlowHandler, type FlowHealthCheckRequest, type FlowHealthCheckResponse, type FlowHttpRequest, type FlowMigrationFailure, type FlowMigrationResponse, type FlowMigrationResult, type FlowPreview, type FlowPreviewResponse, FlowStatusEnum, type FlowSuccessScreenResponse, type FlowType, FlowTypeEnum, type FlowValidationError, type FlowValidationErrorPointer, type FlowsListResponse, type FooterOptions, GROUP_ERROR_CODES, type GeneralHeaderInterface, type GeneralMessageBody, type GeneralRequestBody, type GetUploadHandleParams, GraphObject, type GroupCreateRequest, type GroupCreateResponse, type GroupInfoField, type GroupInfoFieldsParam, type GroupInfoResponse, type GroupInviteLinkResponse, type GroupJoinApprovalMode, type GroupJoinRequest, type GroupJoinRequestError, type GroupJoinRequestFailure, type GroupJoinRequestsActionResponse, type GroupJoinRequestsResponse, type GroupListParams, type GroupListResponse, type GroupMessage, type GroupParticipant, type GroupParticipantInput, type GroupParticipantsRequest, type GroupSettingsResponse, GroupsApi, type GroupsClass, type HeaderOptions, HealthStatus, HealthStatusEntity, type HolidaySchedule, HostPlatform, HttpMethods, HttpMethodsEnum, HttpMethodsType, type HttpsClientClass, type HttpsClientResponseClass, INTEGRITY_ERROR_CODES, type ImageMediaObject, ImageMediaTypes, ImageMediaTypesEnum, ImageMediaTypesType, type ImageMessage, type ImageMessageHandler, type ImageProcessedMessage, type InitiateCallRequest, type InitiateCallResponse, type InteractiveButtonReplyMessage, type InteractiveListReplyMessage, type InteractiveMessage, type InteractiveMessageHandler, type InteractiveObject, type InteractiveProcessedMessage, type InteractiveReply, InteractiveTypes, InteractiveTypesEnum, InteractiveTypesType, Languages, LanguagesEnum, LanguagesType, type LimitedTimeOfferOptions, type LimitedTimeOfferTemplateOptions, ListBlockedUsersParams, ListBlockedUsersResponse, type LocationInfo, type LocationMessage, type LocationMessageHandler, type LocationObject, type LocationParameter, type LocationProcessedMessage, Logger, type LoggerInterface, MPMButton, type MPMTemplateOptions, type MarketingMessageBidSpec, type MarketingMessageRequest, MarketingMessagesApi, type MarketingMessagesClass, MediaApi, type MediaCardCarouselTemplateOptions, MediaCarouselCard, MediaClass, type MediaInfo, type MediaParameter, MediaResponse, MediasResponse, MessagesApi as MessageApi, MessagesApi, MessageCategory, MessageCategoryEnum, MessageCategoryType, type MessageHandler, MessageHistoryApi, MessageHistoryClass, MessageHistoryEventListParams, MessageHistoryFieldsParam, MessageHistoryItem, MessageHistoryListParams, MessageHistoryResponse, type MessageRecipientType, type MessageRequestBody, type MessageRequestParams, type MessageStatus, MessageTemplateObject, MessageTemplateRequestBody, MessageTypes, MessageTypesEnum, MessageTypesType, type MessageWebhookValue, type MessagesClass, type MessagesResponse, MessagingLimitTier, type MetaError, type MetaErrorData, type MetaErrorDetail, type NextFunction, type NextJsAppWebhookConfig, type NextJsWebhookConfig, OTPButton, type OTPTemplateOptions, OfficialBusinessAccountAction, OfficialBusinessAccountApplicationData, OfficialBusinessAccountStatusResponse, OnboardPartnersToMMLiteRequest, type OrderInfo, type OrderMessage, type OrderMessageHandler, type OrderProcessedMessage, type Pagination, type PaginationCursors, type Paging, PagingCursors, PagingInfo, ParametersTypes, ParametersTypesEnum, ParametersTypesType, PassThreadControlParams, type PaymentConfiguration, type PaymentConfigurationCode, type PaymentConfigurationCreateRequest, type PaymentConfigurationCreateResponse, type PaymentConfigurationDeleteRequest, type PaymentConfigurationOauthLinkRequest, type PaymentConfigurationOauthLinkResponse, type PaymentConfigurationProvider, type PaymentConfigurationStatus, type PaymentConfigurationUpdateRequest, type PaymentConfigurationUpdateResponse, type PaymentConfigurationsResponse, PaymentsApi, type PaymentsClass, PhoneNumberApi, PhoneNumberButton, PhoneNumberClass, PhoneNumberField, PhoneNumberFieldsParam, PhoneNumberFilter, PhoneNumberResponse, PhoneNumberSettingsFieldsParam, PhoneNumberSettingsParams, PhoneNumberSettingsResponse, PhoneNumberSort, PhoneNumberStatus, PhoneNumbersListParams, PhoneNumbersResponse, PlatformType, type PreAcceptCallRequest, type ProcessedMessage, type ProcessedStatus, type ProductCardCarouselTemplateOptions, ProductCarouselCard, type ProductParameter, type ProductSection, QrCodeApi, type QrCodeClass, type QrCodeResponse, type QrCodesResponse, QualityRating, QualityScore, QuickReplyButton, type ReactionInfo, type ReactionMessage, type ReactionMessageHandler, type ReactionParams, type ReactionProcessedMessage, ReferralSourceTypes, ReferralSourceTypesEnum, ReferralSourceTypesType, RegistrationApi, type RegistrationClass, type RegistrationRequest, type RejectCallRequest, RejectSolutionRequest, ReleaseThreadControlParams, RemoveAssignedUserRequest, RequestCodeMethods, RequestCodeMethodsEnum, RequestCodeMethodsType, RequestPreVerifiedPhoneNumberCodeRequest, RequestVerificationCodeRequest, type RequesterClass, type RequesterResponseInterface, type ResponseData, type ResponseHeaderValue, type ResponseHeaders, type ResponseJSONBody, type ResponsePagination, type ResponseSuccess, SEND_MESSAGE_ERROR_CODES, SPMButton, type SPMTemplateOptions, SetOBOMobilityIntentRequest, SetSolutionMigrationIntentRequest, SharePreVerifiedPhoneNumberRequest, type SipServer, type SipSettings, type SipStatus, SolutionDeactivationRequest, SolutionFieldsParam, SolutionGraphObject, SolutionListParams, SolutionListResponse, SolutionMigrationIntent, SolutionsApi, SolutionsClass, Status, StatusEnum, type StatusHandler, type StatusParams, type StatusResponse, StatusType, type StatusWebhook, type StatusWebhookValue, type StickerMediaObject, StickerMediaTypes, StickerMediaTypesEnum, StickerMediaTypesType, type StickerMessage, type StickerMessageHandler, type StickerProcessedMessage, SubType, SubTypeEnum, SubTypeType, SystemChangeTypes, SystemChangeTypesEnum, SystemChangeTypesType, type SystemMessage, type SystemMessageHandler, type SystemProcessedMessage, THROTTLING_ERROR_CODES, TakeThreadControlParams, TemplateApi, TemplateBidSpec, TemplateBody, TemplateButton, TemplateButtons, TemplateCarousel, TemplateClass, TemplateDeleteParams, TemplateFooter, TemplateFormat, TemplateGetParams, TemplateHeader, TemplateHeaderExample, TemplateLimitedTimeOffer, TemplateOptimizationSpec, type TemplateOptions, type TemplateParameter, TemplateRequestBody, TemplateResponse, TemplateStatus, TemplateStatusEnum, TemplateStatusType, type TerminateCallRequest, type TextMessage, type TextMessageHandler, type TextMessageParams, type TextObject, type TextParameter, type TextProcessedMessage, ThreadControlApi, ThreadControlBaseParams, ThreadControlClass, ThreadControlResponse, ThreadControlRole, ThreadControlUserIdentifier, Throughput, ThroughputLevel, ThroughputResponse, TwoStepVerificationApi, type TwoStepVerificationClass, TwoStepVerificationParams, type TwoStepVerificationRequest, URLButton, UnblockUsersRequest, UnifiedCertStatus, type UnsupportedMessage, UpdateBusinessComplianceInfoRequest, type UpdateBusinessProfileRequest, type UpdateCallingSettingsRequest, type UpdateCommerceSettingsRequest, type UpdateFlowResponse, type UpdateGroupSettingsRequest, UpdateOfficialBusinessAccountStatusRequest, UpdatePhoneNumberSettingsRequest, UpdatePhoneNumberStatusRequest, type UpdateQrCodeRequest, UpdateUsernameRequest, UpdateWabaAccountRequest, UpdateWabaSubscription, UpdateWhatsAppBusinessProfileRequest, type UploadBusinessProfileResponse, type UploadHandle, type UploadMediaParams, UploadMediaResponse, type UploadSession, type UploadSessionResponse, UsernameResponse, UsernameStatus, UsernameSuggestionsResponse, UsernameTransferAction, type ValidateFlowJsonResponse, VerifyCodeRequest, VerifyPreVerifiedPhoneNumberCodeRequest, type VideoMediaObject, VideoMediaTypes, VideoMediaTypesEnum, VideoMediaTypesType, type VideoMessage, type VideoMessageHandler, type VideoProcessedMessage, WABAClass, WHATSAPP_ERROR_CODES, WabaAccount, WabaAccountFields, WabaAccountFieldsParam, WabaAccountReviewStatus, WabaAccountStatus, WabaApi, WabaBusinessVerificationStatus, WabaConfigEnum, type WabaConfigType, WabaFieldsParam, WabaGraphObject, WabaHealthStatus, WabaHealthStatusCanSendMessage, WabaHealthStatusEntity, WabaHealthStatusError, WabaListParams, WabaListResponse, WabaSubscription, WabaSubscriptions, type WebhookContact, type WebhookEvent, type WebhookHandlerContext, type WebhookMessage, type WebhookPayload, WebhookProcessor, type WebhookResponse, WebhookTypes, WebhookTypesEnum, WebhookTypesType, type WebhookValue, type WeeklyOperatingHours, WhatsApp, WhatsAppApiError, WhatsAppAuthorizationError, WhatsAppBlockUserError, WhatsAppCallingError, type WhatsAppConfig, WhatsAppError, type WhatsAppErrorCode, WhatsAppFlowError, WhatsAppGroupError, WhatsAppIntegrityError, type WhatsAppMessage, WhatsAppNetworkError, WhatsAppSendMessageError, WhatsAppThrottlingError, WhatsAppUnknownError, WhatsAppValidationError, buildFieldsQueryString, constructFullUrl, createAuthenticationTemplate, createCatalogTemplate, createCouponTemplate, createLimitedTimeOfferTemplate, createMPMTemplate, createMediaCardCarouselTemplate, createOTPTemplate, createProductCardCarouselTemplate, createSPMTemplate, createTemplate, createWhatsAppApiError, decryptFlowRequest, encryptFlowResponse, expressWebhookHandler, extractMessageText, formatConfigTable, generateEncryption, generateXHub256Sig, getContactsInfo, getInteractiveReply, getLocationInfo, getMediaInfo, getOrderInfo, getReactionInfo, isApiPermissionErrorCode, isAudioMessage, isAuthorizationErrorCode, isBlockUserErrorCode, isButtonMessage, isButtonReply, isCallingErrorCode, isContactsMessage, isDocumentMessage, isFlowDataExchangeRequest, isFlowErrorCode, isFlowErrorRequest, isFlowPingRequest, isGroupErrorCode, isImageMessage, isIntegrityErrorCode, isInteractiveMessage, isListReply, isLocationMessage, isMetaError, isNfmReply, isOrderMessage, isReactionMessage, isSendMessageErrorCode, isStickerMessage, isSystemMessage, isTextMessage, isThrottlingErrorCode, isVideoMessage, isWhatsAppApiErrorResponse, isWhatsAppAuthorizationError, isWhatsAppBlockUserError, isWhatsAppCallingError, isWhatsAppErrorCode, isWhatsAppFlowError, isWhatsAppGroupError, isWhatsAppIntegrityError, isWhatsAppSendMessageError, isWhatsAppThrottlingError, nextjsAppWebhookHandler, nextjsPagesWebhookHandler, normalizeMetaError, objectToQueryString, processFlowRequest, processWebhookMessages };
10392
+ export { AUTHORIZATION_ERROR_CODES, type AcceptCallRequest, AcceptSolutionRequest, AccountMode, AddPhoneNumbersRequest, type ApiPermissionErrorCode, AssignedUserRequest, AssignedUsersListParams, type AudioMediaObject, AudioMediaTypes, AudioMediaTypesEnum, AudioMediaTypesType, type AudioMessage, type AudioMessageHandler, type AudioProcessedMessage, type AuthenticationTemplateOptions, BLOCK_USER_ERROR_CODES, type BaseApiRequest, type BaseApiResponse, type BaseClass, BlockUserObject, BlockUsersApi, BlockUsersClass, BlockUsersRequest, BlockUsersResponse, BlockedUserInfo, type BodyOptions, BusinessApi, BusinessClass, BusinessComplianceInfoResponse, BusinessFieldsParam, BusinessGraphListResponse, BusinessGraphObject, BusinessListParams, BusinessProfileApi, type BusinessProfileClass, type BusinessProfileData, type BusinessProfileField, type BusinessProfileFieldsParam, type BusinessProfileResponse, type BusinessUseCaseUsage, BusinessVerticalEnum, type ButtonMessage, type ButtonMessageHandler, type ButtonOptions, ButtonPosition, ButtonPositionEnum, ButtonPositionType, type ButtonProcessedMessage, CALLING_ERROR_CODES, CUSTOMER_SERVICE_WINDOW_MS, type CallAction, type CallActionResponse, type CallAnnouncementLanguage, type CallCaptureStatus, type CallHours, type CallHoursDay, type CallHoursStatus, type CallIconVisibility, type CallPermission, type CallPermissionAction, type CallPermissionLimit, type CallPermissionsResponse, type CallRecordingConfig, type CallSdpType, type CallSession, type CallTranscriptionConfig, type CallbackPermissionStatus, CallingApi, type CallingClass, type CallingSettings, type CallingSettingsResponse, type CallingStatus, CarouselCard, type CarouselOptions, CatalogButton, type CatalogTemplateOptions, Category, CategoryEnum, CategoryType, CodeVerificationStatus, CommerceApi, type CommerceClass, type CommerceSetting, type CommerceSettingsResponse, ComponentType, ComponentTypeType, ComponentTypes, ComponentTypesEnum, ContactBookApi, ContactBookClass, type ContactInfo, type ContactObject, type ContactsMessage, type ContactsMessageHandler, type ContactsProcessedMessage, ConversationTypes, ConversationTypesEnum, ConversationTypesType, ConversationalAutomationRequest, ConversationalAutomationResponse, ConversationalCommand, ConversationalPrompt, CopyCodeButton, type CouponTemplateOptions, type CreateFlowResponse, CreateOBOMobilityIntentRequest, CreatePhoneNumberRequest, CreatePhoneNumberResponse, type CreateQrCodeRequest, CreateScheduleRequest, type CreateUploadSessionParams, CreateWhatsAppBusinessSolutionRequest, CurrencyCodesEnum, type CurrencyParameter, CursorPaginationParams, Cursors, type CustomerServiceWindowOptions, DataLocalizationRegion, DataLocalizationRegionEnum, DataLocalizationRegionType, type DateTimeParameter, type DecryptedFlowRequest, type DedupeStore, DeleteContactBookEntryParams, DeleteContactBookEntryResponse, type DirectSendCategory, type DirectSendConfig, type DirectSendOptions, type DocumentMediaObject, DocumentMediaTypes, DocumentMediaTypesEnum, DocumentMediaTypesType, type DocumentMessage, type DocumentMessageHandler, type DocumentProcessedMessage, type EncryptedMessageRequest, type EncryptedMessagesResponse, EncryptionApi, type EncryptionClass, type EncryptionKeyPair, type EncryptionPublicKeyResponse, type ErrorWebhookValue, type ExpressRequest, type ExpressResponse, type ExpressWebhookConfig, FLOW_ERROR_CODES, FREE_ENTRY_POINT_WINDOW_MS, FailedUserInfo, type FastifyWebhookConfig, type FastifyWebhookHandlers, type FastifyWebhookReply, type FastifyWebhookRequest, type Flow, FlowActionEnum, FlowApi, type FlowAsset, type FlowAssetsResponse, FlowButton, FlowCategoryEnum, type FlowClass, type FlowDataExchangeRequest, type FlowDataExchangeResponse, type FlowDecryptedRequestResponse, type FlowEncryptedRequestPayload, type FlowEndpointRequest, type FlowEndpointResponse, type FlowErrorNotificationRequest, type FlowErrorNotificationResponse, type FlowHandler, type FlowHealthCheckRequest, type FlowHealthCheckResponse, type FlowHttpRequest, type FlowMigrationFailure, type FlowMigrationResponse, type FlowMigrationResult, type FlowPreview, type FlowPreviewResponse, FlowStatusEnum, type FlowSuccessScreenResponse, type FlowType, FlowTypeEnum, type FlowValidationError, type FlowValidationErrorPointer, type FlowsListResponse, type FooterOptions, type FreeEntryPointWindowOptions, GROUP_ERROR_CODES, type GeneralHeaderInterface, type GeneralMessageBody, type GeneralRequestBody, type GetUploadHandleParams, GraphObject, type GroupCreateRequest, type GroupCreateResponse, type GroupInfoField, type GroupInfoFieldsParam, type GroupInfoResponse, type GroupInviteLinkResponse, type GroupJoinApprovalMode, type GroupJoinRequest, type GroupJoinRequestError, type GroupJoinRequestFailure, type GroupJoinRequestsActionResponse, type GroupJoinRequestsResponse, type GroupListParams, type GroupListResponse, type GroupMessage, type GroupParticipant, type GroupParticipantInput, type GroupParticipantsRequest, type GroupSettingsResponse, GroupsApi, type GroupsClass, type HeaderOptions, HealthStatus, HealthStatusEntity, type HolidaySchedule, type HonoWebhookConfig, type HonoWebhookContext, type HonoWebhookHandlers, HostPlatform, HttpMethods, HttpMethodsEnum, HttpMethodsType, type HttpsClientClass, type HttpsClientResponseClass, INTEGRITY_ERROR_CODES, type ImageMediaObject, ImageMediaTypes, ImageMediaTypesEnum, ImageMediaTypesType, type ImageMessage, type ImageMessageHandler, type ImageProcessedMessage, type InitiateCallRequest, type InitiateCallResponse, type InteractiveButtonReplyMessage, type InteractiveListReplyMessage, type InteractiveMessage, type InteractiveMessageHandler, type InteractiveObject, type InteractiveProcessedMessage, type InteractiveReply, InteractiveTypes, InteractiveTypesEnum, InteractiveTypesType, Languages, LanguagesEnum, LanguagesType, type LimitedTimeOfferOptions, type LimitedTimeOfferTemplateOptions, ListBlockedUsersParams, ListBlockedUsersResponse, type LocationInfo, type LocationMessage, type LocationMessageHandler, type LocationObject, type LocationParameter, type LocationProcessedMessage, Logger, type LoggerInterface, MAX_FREE_ENTRY_POINT_WINDOW_MS, MPMButton, type MPMTemplateOptions, type MarketingMessageBidSpec, type MarketingMessageRequest, MarketingMessagesApi, type MarketingMessagesClass, type MarketingMessagesLinkClickData, MediaApi, type MediaCardCarouselTemplateOptions, MediaCarouselCard, MediaClass, type MediaInfo, type MediaParameter, MediaResponse, MediasResponse, MemoryDedupeStore, type MemoryDedupeStoreOptions, MessagesApi as MessageApi, MessagesApi, MessageCategory, MessageCategoryEnum, MessageCategoryType, type MessageHandler, MessageHistoryApi, MessageHistoryClass, MessageHistoryEventListParams, MessageHistoryFieldsParam, MessageHistoryItem, MessageHistoryListParams, MessageHistoryResponse, type MessageRecipientType, type MessageRequestBody, type MessageRequestParams, type MessageStatus, MessageTemplateObject, MessageTemplateRequestBody, MessageTypes, MessageTypesEnum, MessageTypesType, type MessageWebhookValue, type MessagesClass, type MessagesResponse, MessagingLimitTier, type MessagingWindow, type MetaError, type MetaErrorData, type MetaErrorDetail, type NextFunction, type NextJsAppWebhookConfig, type NextJsAppWebhookHandlers, type NextJsWebhookConfig, type NonMessageWebhookField, OTPButton, type OTPTemplateOptions, OfficialBusinessAccountAction, OfficialBusinessAccountApplicationData, OfficialBusinessAccountStatusResponse, OnboardPartnersToMMLiteRequest, type OrderInfo, type OrderMessage, type OrderMessageHandler, type OrderProcessedMessage, type Pagination, type PaginationCursors, type Paging, PagingCursors, PagingInfo, ParametersTypes, ParametersTypesEnum, ParametersTypesType, PassThreadControlParams, type PaymentConfiguration, type PaymentConfigurationCode, type PaymentConfigurationCreateRequest, type PaymentConfigurationCreateResponse, type PaymentConfigurationDeleteRequest, type PaymentConfigurationOauthLinkRequest, type PaymentConfigurationOauthLinkResponse, type PaymentConfigurationProvider, type PaymentConfigurationStatus, type PaymentConfigurationUpdateRequest, type PaymentConfigurationUpdateResponse, type PaymentConfigurationsResponse, PaymentsApi, type PaymentsClass, PhoneNumberApi, PhoneNumberButton, PhoneNumberClass, PhoneNumberField, PhoneNumberFieldsParam, PhoneNumberFilter, PhoneNumberResponse, PhoneNumberSettingsFieldsParam, PhoneNumberSettingsParams, PhoneNumberSettingsResponse, PhoneNumberSort, PhoneNumberStatus, PhoneNumbersListParams, PhoneNumbersResponse, PlatformType, type PreAcceptCallRequest, type ProcessWebhookOptions, type ProcessedMessage, type ProcessedStatus, type ProcessedUserAction, type ProcessedWebhookField, type ProductCardCarouselTemplateOptions, ProductCarouselCard, type ProductParameter, type ProductSection, QrCodeApi, type QrCodeClass, type QrCodeResponse, type QrCodesResponse, QualityRating, QualityScore, QuickReplyButton, type RateLimitHeadersInput, type RateLimitInfo, type RateLimitInfoContext, type RateLimitInfoListener, type RateLimitUsage, type ReactionInfo, type ReactionMessage, type ReactionMessageHandler, type ReactionParams, type ReactionProcessedMessage, ReferralSourceTypes, ReferralSourceTypesEnum, ReferralSourceTypesType, RegistrationApi, type RegistrationClass, type RegistrationRequest, type RejectCallRequest, RejectSolutionRequest, ReleaseThreadControlParams, RemoveAssignedUserRequest, RequestCodeMethods, RequestCodeMethodsEnum, RequestCodeMethodsType, RequestPreVerifiedPhoneNumberCodeRequest, RequestVerificationCodeRequest, type RequesterClass, type RequesterResponseInterface, type ResponseData, type ResponseHeaderValue, type ResponseHeaders, type ResponseJSONBody, type ResponsePagination, type ResponseSuccess, type RetryConfig, SEND_MESSAGE_ERROR_CODES, SPMButton, type SPMTemplateOptions, SetOBOMobilityIntentRequest, SetSolutionMigrationIntentRequest, SharePreVerifiedPhoneNumberRequest, type SipServer, type SipSettings, type SipStatus, SolutionDeactivationRequest, SolutionFieldsParam, SolutionGraphObject, SolutionListParams, SolutionListResponse, SolutionMigrationIntent, SolutionsApi, SolutionsClass, Status, StatusEnum, type StatusHandler, type StatusParams, type StatusResponse, StatusType, type StatusWebhook, type StatusWebhookValue, type StickerMediaObject, StickerMediaTypes, StickerMediaTypesEnum, StickerMediaTypesType, type StickerMessage, type StickerMessageHandler, type StickerProcessedMessage, SubType, SubTypeEnum, SubTypeType, SystemChangeTypes, SystemChangeTypesEnum, SystemChangeTypesType, type SystemMessage, type SystemMessageHandler, type SystemProcessedMessage, THROTTLING_ERROR_CODES, TakeThreadControlParams, TemplateApi, TemplateBidSpec, TemplateBody, TemplateButton, TemplateButtons, TemplateCarousel, TemplateClass, TemplateDeleteParams, TemplateFooter, TemplateFormat, TemplateGetParams, TemplateHeader, TemplateHeaderExample, TemplateLimitedTimeOffer, TemplateOptimizationSpec, type TemplateOptions, type TemplateParameter, TemplateRequestBody, TemplateResponse, TemplateStatus, TemplateStatusEnum, TemplateStatusType, type TerminateCallRequest, type TextMessage, type TextMessageHandler, type TextMessageParams, type TextObject, type TextParameter, type TextProcessedMessage, ThreadControlApi, ThreadControlBaseParams, ThreadControlClass, ThreadControlResponse, ThreadControlRole, ThreadControlUserIdentifier, Throughput, ThroughputLevel, ThroughputResponse, TwoStepVerificationApi, type TwoStepVerificationClass, TwoStepVerificationParams, type TwoStepVerificationRequest, URLButton, UnblockUsersRequest, UnifiedCertStatus, type UnsupportedMessage, UpdateBusinessComplianceInfoRequest, type UpdateBusinessProfileRequest, type UpdateCallingSettingsRequest, type UpdateCommerceSettingsRequest, type UpdateFlowResponse, type UpdateGroupSettingsRequest, UpdateOfficialBusinessAccountStatusRequest, UpdatePhoneNumberSettingsRequest, UpdatePhoneNumberStatusRequest, type UpdateQrCodeRequest, UpdateUsernameRequest, UpdateWabaAccountRequest, UpdateWabaSubscription, UpdateWhatsAppBusinessProfileRequest, type UploadBusinessProfileResponse, type UploadHandle, UploadMediaInput, UploadMediaOptions, type UploadMediaParams, UploadMediaResponse, type UploadSession, type UploadSessionResponse, type UserAction, type UserActionHandler, type UserActionType, type UserActionsWebhookValue, UsernameResponse, UsernameStatus, UsernameSuggestionsResponse, UsernameTransferAction, type ValidateFlowJsonResponse, VerifyCodeRequest, VerifyPreVerifiedPhoneNumberCodeRequest, type VideoMediaObject, VideoMediaTypes, VideoMediaTypesEnum, VideoMediaTypesType, type VideoMessage, type VideoMessageHandler, type VideoProcessedMessage, WABAClass, WHATSAPP_ERROR_CODES, WabaAccount, WabaAccountFields, WabaAccountFieldsParam, WabaAccountReviewStatus, WabaAccountStatus, WabaApi, WabaBusinessVerificationStatus, WabaConfigEnum, type WabaConfigType, WabaFieldsParam, WabaGraphObject, WabaHealthStatus, WabaHealthStatusCanSendMessage, WabaHealthStatusEntity, WabaHealthStatusError, WabaListParams, WabaListResponse, WabaSubscription, WabaSubscriptions, type WebhookContact, type WebhookDedupeConfig, type WebhookDedupeOptions, type WebhookEvent, type WebhookFieldHandler, type WebhookFieldHandlerMap, type WebhookFieldHandlerOptions, type WebhookFieldType, type WebhookFieldValue, type WebhookFieldValueMap, type WebhookHandlerContext, type WebhookMessage, type WebhookPayload, WebhookProcessor, type WebhookResponse, type WebhookSignatureOptions, WebhookTypes, WebhookTypesEnum, WebhookTypesType, type WebhookValue, type WeeklyOperatingHours, WhatsApp, WhatsApp as default, WhatsAppApiError, WhatsAppAuthorizationError, WhatsAppBlockUserError, WhatsAppCallingError, type WhatsAppConfig, WhatsAppError, type WhatsAppErrorCode, WhatsAppFlowError, WhatsAppGroupError, WhatsAppIntegrityError, type WhatsAppMessage, WhatsAppNetworkError, WhatsAppSendMessageError, WhatsAppThrottlingError, WhatsAppUnknownError, WhatsAppValidationError, type WindowTimestamp, buildFieldsQueryString, canSendFreeformMessage, constructFullUrl, createAuthenticationTemplate, createCatalogTemplate, createCouponTemplate, createLimitedTimeOfferTemplate, createMPMTemplate, createMediaCardCarouselTemplate, createOTPTemplate, createProductCardCarouselTemplate, createSPMTemplate, createTemplate, createWhatsAppApiError, decryptFlowRequest, decryptFlowRequestAsync, encryptFlowResponse, encryptFlowResponseAsync, expressWebhookHandler, extractMessageText, fastifyWebhookHandler, formatConfigTable, generateEncryption, generateXHub256Sig, generateXHub256SigAsync, getContactsInfo, getCustomerServiceWindow, getFreeEntryPointWindow, getInteractiveReply, getLocationInfo, getMediaInfo, getOrderInfo, getReactionInfo, honoWebhookHandler, isApiPermissionErrorCode, isAudioMessage, isAuthorizationErrorCode, isBlockUserErrorCode, isButtonMessage, isButtonReply, isCallingErrorCode, isContactsMessage, isDocumentMessage, isFlowDataExchangeRequest, isFlowErrorCode, isFlowErrorRequest, isFlowPingRequest, isGroupErrorCode, isImageMessage, isIntegrityErrorCode, isInteractiveMessage, isListReply, isLocationMessage, isMetaError, isNfmReply, isOrderMessage, isReactionMessage, isSendMessageErrorCode, isStickerMessage, isSystemMessage, isTextMessage, isThrottlingErrorCode, isValidWebhookSignature, isVideoMessage, isWhatsAppApiErrorResponse, isWhatsAppAuthorizationError, isWhatsAppBlockUserError, isWhatsAppCallingError, isWhatsAppErrorCode, isWhatsAppFlowError, isWhatsAppGroupError, isWhatsAppIntegrityError, isWhatsAppSendMessageError, isWhatsAppThrottlingError, nextjsAppWebhookHandler, nextjsPagesWebhookHandler, normalizeMetaError, objectToQueryString, parseRateLimitHeaders, parseRetryAfter, processFlowRequest, processWebhookMessages, verifyWebhookSignature };
9840
10393
  //# sourceMappingURL=index.d.mts.map