meta-cloud-api 0.2.24 → 0.2.26

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/{BusinessProfileApi-CNU7GpJK.d.ts → BusinessProfileApi-Dt8jkESv.d.ts} +2 -2
  2. package/dist/{EncryptionApi-r6_0rWwx.d.ts → EncryptionApi-CwGwcpiZ.d.ts} +1 -1
  3. package/dist/{FlowApi-BhpWbli2.d.ts → FlowApi-bENOxS_4.d.ts} +1 -1
  4. package/dist/{MediaApi-DM3WohTN.d.ts → MediaApi-DvAoklbt.d.ts} +1 -1
  5. package/dist/{MessageApi-Cr3Q6qg4.d.ts → MessageApi-vNrieuce.d.ts} +2 -2
  6. package/dist/{PhoneNumberApi-Dc2KKn0M.d.ts → PhoneNumberApi-DiGL3drr.d.ts} +1 -1
  7. package/dist/{QrCodeApi-z9XTnlcP.d.ts → QrCodeApi-BYUCrcp3.d.ts} +1 -1
  8. package/dist/{RegistrationApi-CYrP_F0R.d.ts → RegistrationApi-CS9TCeHz.d.ts} +2 -2
  9. package/dist/{TemplateApi-Bjc2IfNX.d.ts → TemplateApi-DfzQkRxJ.d.ts} +2 -2
  10. package/dist/{TwoStepVerificationApi-nJ12648J.d.ts → TwoStepVerificationApi-B2pZzlUJ.d.ts} +1 -1
  11. package/dist/{WabaApi-BIP6G4pB.d.ts → WabaApi-GGQLjvio.d.ts} +1 -1
  12. package/dist/{base--LmzWHx3.d.ts → base-DwevK2tJ.d.ts} +1 -1
  13. package/dist/chunk-4C666HHU.js +2 -0
  14. package/dist/{chunk-M2GC5VFJ.js.map → chunk-4C666HHU.js.map} +1 -1
  15. package/dist/{chunk-XQDM2WBV.js → chunk-HEVRZRB4.js} +3 -3
  16. package/dist/{chunk-XQDM2WBV.js.map → chunk-HEVRZRB4.js.map} +1 -1
  17. package/dist/chunk-QMNPAR5X.js +3 -0
  18. package/dist/chunk-QMNPAR5X.js.map +1 -0
  19. package/dist/chunk-SMHCU5MN.js +2 -0
  20. package/dist/chunk-SMHCU5MN.js.map +1 -0
  21. package/dist/core/webhook/index.d.ts +151 -273
  22. package/dist/core/webhook/index.js +1 -1
  23. package/dist/core/whatsapp/index.d.ts +13 -13
  24. package/dist/core/whatsapp/index.js +1 -1
  25. package/dist/{enums-CI7vzKhn.d.ts → enums-iedeomKw.d.ts} +1 -0
  26. package/dist/features/encryption/index.d.ts +4 -4
  27. package/dist/features/encryption/index.js +1 -1
  28. package/dist/features/flow/index.d.ts +4 -4
  29. package/dist/features/flow/index.js +1 -1
  30. package/dist/features/media/index.d.ts +4 -4
  31. package/dist/features/media/index.js +1 -1
  32. package/dist/features/messages/index.d.ts +4 -4
  33. package/dist/features/messages/index.js +1 -1
  34. package/dist/features/phone/index.d.ts +4 -4
  35. package/dist/features/phone/index.js +1 -1
  36. package/dist/features/profile/index.d.ts +4 -4
  37. package/dist/features/profile/index.js +1 -1
  38. package/dist/features/qrCode/index.d.ts +4 -4
  39. package/dist/features/qrCode/index.js +1 -1
  40. package/dist/features/registration/index.d.ts +4 -4
  41. package/dist/features/registration/index.js +1 -1
  42. package/dist/features/template/index.d.ts +4 -4
  43. package/dist/features/template/index.js +1 -1
  44. package/dist/features/twoStepVerification/index.d.ts +4 -4
  45. package/dist/features/twoStepVerification/index.js +1 -1
  46. package/dist/features/waba/index.d.ts +4 -4
  47. package/dist/features/waba/index.js +1 -1
  48. package/dist/index.d.ts +14 -21
  49. package/dist/index.js +1 -1
  50. package/dist/index.js.map +1 -1
  51. package/dist/shared/types/config.d.ts +1 -1
  52. package/dist/shared/types/enums.d.ts +1 -1
  53. package/dist/shared/types/enums.js +1 -1
  54. package/dist/shared/utils/isMetaError.js +1 -1
  55. package/package.json +1 -44
  56. package/dist/chunk-2NCV35XS.js +0 -2
  57. package/dist/chunk-2NCV35XS.js.map +0 -1
  58. package/dist/chunk-FYHBS7Q5.js +0 -4
  59. package/dist/chunk-FYHBS7Q5.js.map +0 -1
  60. package/dist/chunk-M2GC5VFJ.js +0 -2
@@ -1,25 +1,18 @@
1
- import { M as MessageTypesEnum } from '../../enums-CI7vzKhn.js';
2
- import { WhatsAppConfig, WabaConfigType } from '../../shared/types/config.js';
3
- import { IncomingMessage } from 'http';
4
- import { c as FlowEndpointRequest, m as FlowTypeEnum } from '../../FlowApi-BhpWbli2.js';
1
+ import { M as MessageTypesEnum } from '../../enums-iedeomKw.js';
2
+ import { c as FlowEndpointRequest, m as FlowTypeEnum } from '../../FlowApi-bENOxS_4.js';
3
+ import { WabaConfigType, WhatsAppConfig } from '../../shared/types/config.js';
5
4
  import { WhatsApp } from '../whatsapp/index.js';
6
- import { Request as Request$1, Response as Response$1 } from 'express';
7
- import { FastifyRequest, FastifyReply } from 'fastify';
8
- import { NestInterceptor, ExecutionContext, CallHandler } from '@nestjs/common';
9
- import { Observable } from 'rxjs';
10
- import { NextApiRequest, NextApiResponse } from 'next';
11
- import { NextRequest } from 'next/server';
12
- import '../../base--LmzWHx3.js';
13
- import '../../MessageApi-Cr3Q6qg4.js';
14
- import '../../MediaApi-DM3WohTN.js';
15
- import '../../BusinessProfileApi-CNU7GpJK.js';
16
- import '../../EncryptionApi-r6_0rWwx.js';
17
- import '../../PhoneNumberApi-Dc2KKn0M.js';
18
- import '../../RegistrationApi-CYrP_F0R.js';
19
- import '../../TemplateApi-Bjc2IfNX.js';
20
- import '../../QrCodeApi-z9XTnlcP.js';
21
- import '../../TwoStepVerificationApi-nJ12648J.js';
22
- import '../../WabaApi-BIP6G4pB.js';
5
+ import '../../base-DwevK2tJ.js';
6
+ import '../../MessageApi-vNrieuce.js';
7
+ import '../../MediaApi-DvAoklbt.js';
8
+ import '../../BusinessProfileApi-Dt8jkESv.js';
9
+ import '../../EncryptionApi-CwGwcpiZ.js';
10
+ import '../../PhoneNumberApi-DiGL3drr.js';
11
+ import '../../RegistrationApi-CS9TCeHz.js';
12
+ import '../../TemplateApi-DfzQkRxJ.js';
13
+ import '../../QrCodeApi-BYUCrcp3.js';
14
+ import '../../TwoStepVerificationApi-B2pZzlUJ.js';
15
+ import '../../WabaApi-GGQLjvio.js';
23
16
  import 'https';
24
17
 
25
18
  interface WebhookContact {
@@ -477,6 +470,117 @@ interface WebhookMessage {
477
470
  */
478
471
  text: string;
479
472
  };
473
+ statuses?: {
474
+ /**
475
+ * The phone number ID that received the status update
476
+ */
477
+ phoneNumberId: string;
478
+ /**
479
+ * The display phone number that received the status update
480
+ */
481
+ displayPhoneNumber: string;
482
+ /**
483
+ * Arbitrary string included in sent message
484
+ */
485
+ biz_opaque_callback_data?: string;
486
+ /**
487
+ * Information about the conversation
488
+ */
489
+ conversation?: {
490
+ /**
491
+ * Represents the ID of the conversation the given status notification belongs to
492
+ */
493
+ id: string;
494
+ /**
495
+ * Describes conversation category
496
+ */
497
+ origin: {
498
+ /**
499
+ * Indicates conversation category. This can also be referred to as a conversation entry point
500
+ * - authentication: Conversation opened by business sending template categorized as AUTHENTICATION
501
+ * - marketing: Conversation opened by business sending template categorized as MARKETING
502
+ * - utility: Conversation opened by business sending template categorized as UTILITY
503
+ * - service: Conversation opened by business replying to customer within service window
504
+ * - referral_conversion: Free entry point conversation
505
+ */
506
+ type: 'authentication' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
507
+ };
508
+ /**
509
+ * Date when the conversation expires. Only present for messages with status 'sent'
510
+ */
511
+ expiration_timestamp?: string;
512
+ };
513
+ /**
514
+ * Array of error objects describing the error
515
+ */
516
+ errors?: Array<{
517
+ /**
518
+ * Error code
519
+ */
520
+ code: number;
521
+ /**
522
+ * Error code title
523
+ */
524
+ title: string;
525
+ /**
526
+ * Error code message
527
+ */
528
+ message: string;
529
+ /**
530
+ * Error details object
531
+ */
532
+ error_data?: {
533
+ /**
534
+ * Describes the error details
535
+ */
536
+ details: string;
537
+ };
538
+ }>;
539
+ /**
540
+ * The ID for the message that the business sent to a customer
541
+ */
542
+ id: string;
543
+ /**
544
+ * Pricing information for the message/conversation
545
+ */
546
+ pricing?: {
547
+ /**
548
+ * Indicates if the given message or conversation is billable
549
+ * @deprecated This field is deprecated. Visit the WhatsApp Changelog for more information.
550
+ */
551
+ billable?: boolean;
552
+ /**
553
+ * Indicates the conversation category:
554
+ * - authentication: Authentication conversation
555
+ * - authentication_international: Authentication-international conversation
556
+ * - marketing: Marketing conversation
557
+ * - utility: Utility conversation
558
+ * - service: Service conversation
559
+ * - referral_conversion: Free entry point conversation
560
+ */
561
+ category: 'authentication' | 'authentication_international' | 'marketing' | 'utility' | 'service' | 'referral_conversion';
562
+ /**
563
+ * Type of pricing model used by the business. Current supported value is CBP
564
+ */
565
+ pricing_model: 'CBP';
566
+ };
567
+ /**
568
+ * The customer's WhatsApp ID. Business can respond to customer using this ID.
569
+ * This ID may not match the customer's phone number.
570
+ */
571
+ recipient_id: string;
572
+ /**
573
+ * Status of the message:
574
+ * - delivered: Message has been delivered
575
+ * - read: Message has been read by the customer
576
+ * - sent: Message has been sent to the customer
577
+ */
578
+ status: 'delivered' | 'read' | 'sent';
579
+ /**
580
+ * Unix timestamp for the status message
581
+ */
582
+ timestamp: string;
583
+ };
480
584
  /**
481
585
  * The original message data as received from the webhook
482
586
  */
@@ -507,125 +611,6 @@ declare enum MessageStatus {
507
611
  READ = "read",
508
612
  SENT = "sent"
509
613
  }
510
- /**
511
- * Event field enum for webhook events
512
- */
513
- declare enum EventField {
514
- MESSAGES = "messages",
515
- STATUSES = "statuses",
516
- MESSAGE_TEMPLATE_STATUS_UPDATE = "message_template_status_update",
517
- PHONE_NUMBER_QUALITY_UPDATE = "phone_number_quality_update",
518
- PHONE_NUMBER_NAME_UPDATE = "phone_number_name_update",
519
- UNKNOWN = "unknown"
520
- }
521
-
522
- interface IRequest extends IncomingMessage {
523
- body: any;
524
- query: Record<string, any>;
525
- method?: string;
526
- }
527
- interface IResponse {
528
- status: (code: number) => IResponse;
529
- send: (body: any) => IResponse | void;
530
- json: (body: any) => IResponse | void;
531
- end: () => void;
532
- }
533
- /**
534
- * Webhook handler for WhatsApp Cloud API
535
- */
536
- declare class WebhookHandler {
537
- private config;
538
- private client;
539
- private messageHandlers;
540
- private eventHandlers;
541
- private preProcessHandler;
542
- private postProcessHandler;
543
- private flowHandlers;
544
- /**
545
- * Create a new WebhookHandler
546
- * @param config The WhatsApp configuration
547
- */
548
- constructor(config: WhatsAppConfig);
549
- /**
550
- * Handle a GET request for webhook verification
551
- */
552
- handleVerificationRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): void;
553
- handleVerificationRequest<Req extends IRequest>(req: Req): string;
554
- /**
555
- * Handle a POST request for webhook events
556
- */
557
- handleWebhookRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): Promise<void>;
558
- handleWebhookRequest<Req extends IRequest>(req: Req): Promise<{
559
- success: boolean;
560
- errors?: string[];
561
- }>;
562
- /**
563
- * Handle webhook requests (both verification and events)
564
- */
565
- handleRequest<Req extends IRequest, Res extends IResponse>(req: Req, res: Res): void | Promise<void>;
566
- handleRequest<Req extends IRequest>(req: Req): string | Promise<{
567
- success: boolean;
568
- errors?: string[];
569
- }>;
570
- /**
571
- * Process incoming messages
572
- */
573
- private processMessages;
574
- /**
575
- * Process other webhook events
576
- */
577
- private processEvent;
578
- /**
579
- * Register a message handler for a specific message type
580
- */
581
- onMessage(type: MessageTypesEnum, handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void;
582
- /**
583
- * Register an event handler for a specific field
584
- */
585
- onEvent(field: string, handler: (event: WebhookEvent) => void | Promise<void>): void;
586
- /**
587
- * Register a pre-process handler that runs before all message handlers
588
- */
589
- onMessagePreProcess(handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void;
590
- /**
591
- * Register a post-process handler that runs after all message handlers
592
- */
593
- onMessagePostProcess(handler: (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>): void;
594
- handleFlowRequest<Req extends IRequest & {
595
- rawBody: string;
596
- }, Res extends IResponse>(req: Req, res: Res): Promise<void>;
597
- handleFlowRequest<Req extends IRequest & {
598
- rawBody: string;
599
- }>(req: Req): Promise<{
600
- statusCode: number;
601
- body: any;
602
- headers?: Record<string, string>;
603
- }>;
604
- /**
605
- * Validate the request signature
606
- */
607
- isRequestSignatureValid(req: IRequest & {
608
- rawBody: string;
609
- }): boolean;
610
- /**
611
- * Decrypt a flow request
612
- */
613
- decryptRequest(body: any): {
614
- decryptedBody: FlowEndpointRequest;
615
- aesKeyBuffer: Buffer;
616
- initialVectorBuffer: Buffer;
617
- };
618
- /**
619
- * Encrypt a flow response
620
- */
621
- private encryptResponse;
622
- /**
623
- * Register a flow handler for a specific flow type
624
- */
625
- onFlow(type: FlowTypeEnum, handler: (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>): void;
626
- }
627
-
628
- declare const generateXHub256Sig: (body: string, appSecret: string) => string;
629
614
 
630
615
  interface WebhookRequest {
631
616
  method: string;
@@ -640,18 +625,16 @@ interface WebhookResponse {
640
625
  headers?: Record<string, string>;
641
626
  }
642
627
  type MessageHandler = (whatsapp: WhatsApp, message: WebhookMessage) => void | Promise<void>;
643
- type EventHandler = (event: WebhookEvent) => void | Promise<void>;
644
628
  type FlowHandler = (whatsapp: WhatsApp, request: FlowEndpointRequest) => any | Promise<any>;
645
629
  /**
646
630
  * Pure function to handle webhook verification
647
631
  */
648
- declare function verifyWebhook(request: WebhookRequest, verificationToken: string): WebhookResponse;
632
+ declare function verifyWebhook(request: Pick<WebhookRequest, 'query'>, verificationToken: string): WebhookResponse;
649
633
  /**
650
634
  * Pure function to process webhook messages
651
635
  */
652
636
  declare function processWebhookMessages(request: WebhookRequest, whatsapp: WhatsApp, handlers: {
653
637
  messageHandlers: Map<MessageTypesEnum, MessageHandler>;
654
- eventHandlers: Map<string, EventHandler>;
655
638
  preProcessHandler?: MessageHandler;
656
639
  postProcessHandler?: MessageHandler;
657
640
  }): Promise<WebhookResponse>;
@@ -661,151 +644,46 @@ declare function processWebhookMessages(request: WebhookRequest, whatsapp: Whats
661
644
  declare function processFlowRequest(request: WebhookRequest, config: WabaConfigType, whatsapp: WhatsApp, flowHandlers: Map<FlowTypeEnum, FlowHandler>): Promise<WebhookResponse>;
662
645
 
663
646
  /**
664
- * Create Express.js adapter for webhook handlers
647
+ * Framework-agnostic WebhookHandler using pure functions
665
648
  */
666
- declare function createExpressAdapter(): {
667
- /**
668
- * Handle webhook verification requests
669
- */
670
- handleVerification: (handler: (request: WebhookRequest) => WebhookResponse) => (req: Request$1, res: Response$1) => void;
649
+ declare class WebhookHandler {
650
+ private config;
651
+ private client;
652
+ private messageHandlers;
653
+ private preProcessHandler;
654
+ private postProcessHandler;
655
+ private flowHandlers;
656
+ constructor(config: WhatsAppConfig);
671
657
  /**
672
- * Handle webhook POST requests
658
+ * Handle webhook verification (framework-agnostic)
673
659
  */
674
- handleWebhook: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request$1, res: Response$1) => Promise<void>;
660
+ handleVerification: (request: Pick<WebhookRequest, "query">) => WebhookResponse;
675
661
  /**
676
- * Handle flow requests
662
+ * Handle webhook messages (framework-agnostic)
677
663
  */
678
- handleFlow: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request$1, res: Response$1) => Promise<void>;
664
+ handleWebhook: (request: WebhookRequest) => Promise<WebhookResponse>;
679
665
  /**
680
- * Universal handler that routes based on method
666
+ * Handle flow requests (framework-agnostic)
681
667
  */
682
- handleRequest: (handlers: {
683
- verification: (request: WebhookRequest) => WebhookResponse;
684
- webhook: (request: WebhookRequest) => Promise<WebhookResponse>;
685
- }) => (req: Request$1, res: Response$1) => Promise<void>;
686
- };
687
-
688
- /**
689
- * Create Fastify adapter for webhook handlers
690
- */
691
- declare function createFastifyAdapter(): {
668
+ handleFlow: (request: WebhookRequest) => Promise<WebhookResponse>;
692
669
  /**
693
- * Handle webhook verification requests
670
+ * Register a message handler for a specific message type
694
671
  */
695
- handleVerification: (handler: (request: WebhookRequest) => WebhookResponse) => (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
672
+ onMessage(type: MessageTypesEnum, handler: MessageHandler): void;
696
673
  /**
697
- * Handle webhook POST requests
674
+ * Register a pre-process handler that runs before all message handlers
698
675
  */
699
- handleWebhook: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
676
+ onMessagePreProcess(handler: MessageHandler): void;
700
677
  /**
701
- * Handle flow requests
678
+ * Register a post-process handler that runs after all message handlers
702
679
  */
703
- handleFlow: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
680
+ onMessagePostProcess(handler: MessageHandler): void;
704
681
  /**
705
- * Universal handler that routes based on method
682
+ * Register a flow handler for a specific flow type
706
683
  */
707
- handleRequest: (handlers: {
708
- verification: (request: WebhookRequest) => WebhookResponse;
709
- webhook: (request: WebhookRequest) => Promise<WebhookResponse>;
710
- }) => (req: FastifyRequest, reply: FastifyReply) => Promise<void>;
711
- };
712
-
713
- /**
714
- * Custom parameter decorator to inject WebhookRequest
715
- */
716
- declare const WebhookReq: (...dataOrPipes: unknown[]) => ParameterDecorator;
717
- /**
718
- * Interceptor to handle WebhookResponse conversion
719
- */
720
- declare class WebhookResponseInterceptor implements NestInterceptor<WebhookResponse, void> {
721
- intercept(context: ExecutionContext, next: CallHandler<WebhookResponse>): Observable<void>;
684
+ onFlow(type: FlowTypeEnum, handler: FlowHandler): void;
722
685
  }
723
- /**
724
- * Create NestJS adapter for webhook handlers
725
- */
726
- declare function createNestJSAdapter(): {
727
- /**
728
- * Handle webhook verification requests
729
- */
730
- handleVerification: (handler: (request: WebhookRequest) => WebhookResponse) => (req: Request$1, res: Response$1) => void;
731
- /**
732
- * Handle webhook POST requests
733
- */
734
- handleWebhook: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request$1, res: Response$1) => Promise<void>;
735
- /**
736
- * Handle flow requests
737
- */
738
- handleFlow: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request$1, res: Response$1) => Promise<void>;
739
- /**
740
- * Universal handler that routes based on method
741
- */
742
- handleRequest: (handlers: {
743
- verification: (request: WebhookRequest) => WebhookResponse;
744
- webhook: (request: WebhookRequest) => Promise<WebhookResponse>;
745
- }) => (req: Request$1, res: Response$1) => Promise<void>;
746
- /**
747
- * Create controller method decorator for webhook verification
748
- */
749
- createVerificationHandler: (handler: (request: WebhookRequest) => WebhookResponse) => (target: any, propertyName: string, descriptor: PropertyDescriptor) => void;
750
- /**
751
- * Create controller method decorator for webhook POST handling
752
- */
753
- createWebhookHandler: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (target: any, propertyName: string, descriptor: PropertyDescriptor) => void;
754
- };
755
-
756
- /**
757
- * Create Next.js Pages Router adapter for webhook handlers
758
- * For App Router, use createNextJSRouteHandlerAdapter instead
759
- */
760
- declare function createNextJSAdapter(): {
761
- /**
762
- * Handle webhook verification requests
763
- */
764
- handleVerification: (handler: (request: WebhookRequest) => WebhookResponse) => (req: NextApiRequest, res: NextApiResponse) => void;
765
- /**
766
- * Handle webhook POST requests
767
- */
768
- handleWebhook: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
769
- /**
770
- * Handle flow requests
771
- */
772
- handleFlow: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
773
- /**
774
- * Universal handler that routes based on method
775
- */
776
- handleRequest: (handlers: {
777
- verification: (request: WebhookRequest) => WebhookResponse;
778
- webhook: (request: WebhookRequest) => Promise<WebhookResponse>;
779
- }) => (req: NextApiRequest, res: NextApiResponse) => Promise<void>;
780
- };
781
686
 
782
- /**
783
- * Create Next.js Route Handler adapter for webhook handlers
784
- */
785
- declare function createNextJSRouteHandlerAdapter(): {
786
- /**
787
- * Handle webhook verification requests (GET)
788
- */
789
- handleVerification: (handler: (request: WebhookRequest) => WebhookResponse) => (req: NextRequest) => Response;
790
- /**
791
- * Handle webhook POST requests
792
- */
793
- handleWebhook: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request) => Promise<Response>;
794
- /**
795
- * Handle flow requests
796
- */
797
- handleFlow: (handler: (request: WebhookRequest) => Promise<WebhookResponse>) => (req: Request) => Promise<Response>;
798
- /**
799
- * Universal handler that creates separate GET and POST handlers
800
- * Usage: export const { GET, POST } = adapter.createHandlers({ verification, webhook })
801
- */
802
- createHandlers: (handlers: {
803
- verification: (request: WebhookRequest) => WebhookResponse;
804
- webhook: (request: WebhookRequest) => Promise<WebhookResponse>;
805
- }) => {
806
- GET: (req: NextRequest) => Response;
807
- POST: (req: Request) => Promise<Response>;
808
- };
809
- };
687
+ declare const generateXHub256Sig: (body: string, appSecret: string) => string;
810
688
 
811
- export { EventField, type EventHandler, type FlowHandler, type IRequest, type IResponse, type MessageHandler, MessageStatus, type WebhookContact, type WebhookEvent, WebhookHandler, type WebhookMessage, WebhookReq, type WebhookRequest, type WebhookResponse, WebhookResponseInterceptor, createExpressAdapter, createFastifyAdapter, createNestJSAdapter, createNextJSAdapter, createNextJSRouteHandlerAdapter, generateXHub256Sig, processFlowRequest, processWebhookMessages, verifyWebhook };
689
+ export { type FlowHandler, type MessageHandler, MessageStatus, type WebhookContact, type WebhookEvent, WebhookHandler, type WebhookMessage, type WebhookRequest, type WebhookResponse, generateXHub256Sig, processFlowRequest, processWebhookMessages, verifyWebhook };
@@ -1,2 +1,2 @@
1
- export{b as EventField,a as MessageStatus,c as WebhookHandler,j as WebhookReq,k as WebhookResponseInterceptor,h as createExpressAdapter,i as createFastifyAdapter,l as createNestJSAdapter,m as createNextJSAdapter,n as createNextJSRouteHandlerAdapter,d as generateXHub256Sig,g as processFlowRequest,f as processWebhookMessages,e as verifyWebhook}from'../../chunk-FYHBS7Q5.js';import'../../chunk-XQDM2WBV.js';import'../../chunk-3MO3BTBC.js';import'../../chunk-R36L2XYO.js';import'../../chunk-GT3XQN7Y.js';import'../../chunk-O2OTHNWM.js';import'../../chunk-7NQLQPLH.js';import'../../chunk-UQPD6GIF.js';import'../../chunk-5JGM556C.js';import'../../chunk-2NJVBJUN.js';import'../../chunk-XPPDOFBN.js';import'../../chunk-KFPOVYEJ.js';import'../../chunk-7GL74SXM.js';import'../../chunk-A264MT4Q.js';import'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
1
+ export{a as MessageStatus,e as WebhookHandler,f as generateXHub256Sig,d as processFlowRequest,c as processWebhookMessages,b as verifyWebhook}from'../../chunk-QMNPAR5X.js';import'../../chunk-HEVRZRB4.js';import'../../chunk-3MO3BTBC.js';import'../../chunk-R36L2XYO.js';import'../../chunk-GT3XQN7Y.js';import'../../chunk-O2OTHNWM.js';import'../../chunk-7NQLQPLH.js';import'../../chunk-UQPD6GIF.js';import'../../chunk-5JGM556C.js';import'../../chunk-2NJVBJUN.js';import'../../chunk-XPPDOFBN.js';import'../../chunk-KFPOVYEJ.js';import'../../chunk-7GL74SXM.js';import'../../chunk-A264MT4Q.js';import'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-SMHCU5MN.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1,17 +1,17 @@
1
- import { M as MessagesApi } from '../../MessageApi-Cr3Q6qg4.js';
1
+ import { M as MessagesApi } from '../../MessageApi-vNrieuce.js';
2
2
  import { WhatsAppConfig, WabaConfigType } from '../../shared/types/config.js';
3
- import { c as MediaApi } from '../../MediaApi-DM3WohTN.js';
4
- import { B as BusinessProfileApi } from '../../BusinessProfileApi-CNU7GpJK.js';
5
- import { E as EncryptionApi } from '../../EncryptionApi-r6_0rWwx.js';
6
- import { F as FlowApi } from '../../FlowApi-BhpWbli2.js';
7
- import { P as PhoneNumberApi } from '../../PhoneNumberApi-Dc2KKn0M.js';
8
- import { R as RegistrationApi } from '../../RegistrationApi-CYrP_F0R.js';
9
- import { T as TemplateApi } from '../../TemplateApi-Bjc2IfNX.js';
10
- import { Q as QrCodeApi } from '../../QrCodeApi-z9XTnlcP.js';
11
- import { T as TwoStepVerificationApi } from '../../TwoStepVerificationApi-nJ12648J.js';
12
- import { W as WabaApi } from '../../WabaApi-BIP6G4pB.js';
13
- import { H as HttpMethodsEnum, l as SDKEnums } from '../../enums-CI7vzKhn.js';
14
- import { a as RequesterClass } from '../../base--LmzWHx3.js';
3
+ import { c as MediaApi } from '../../MediaApi-DvAoklbt.js';
4
+ import { B as BusinessProfileApi } from '../../BusinessProfileApi-Dt8jkESv.js';
5
+ import { E as EncryptionApi } from '../../EncryptionApi-CwGwcpiZ.js';
6
+ import { F as FlowApi } from '../../FlowApi-bENOxS_4.js';
7
+ import { P as PhoneNumberApi } from '../../PhoneNumberApi-DiGL3drr.js';
8
+ import { R as RegistrationApi } from '../../RegistrationApi-CS9TCeHz.js';
9
+ import { T as TemplateApi } from '../../TemplateApi-DfzQkRxJ.js';
10
+ import { Q as QrCodeApi } from '../../QrCodeApi-BYUCrcp3.js';
11
+ import { T as TwoStepVerificationApi } from '../../TwoStepVerificationApi-B2pZzlUJ.js';
12
+ import { W as WabaApi } from '../../WabaApi-GGQLjvio.js';
13
+ import { H as HttpMethodsEnum, l as SDKEnums } from '../../enums-iedeomKw.js';
14
+ import { a as RequesterClass } from '../../base-DwevK2tJ.js';
15
15
  import { Agent } from 'https';
16
16
 
17
17
  type ResponseHeaderValue = string | string[] | undefined;
@@ -1,2 +1,2 @@
1
- export{b as WhatsApp}from'../../chunk-XQDM2WBV.js';import'../../chunk-3MO3BTBC.js';import'../../chunk-R36L2XYO.js';import'../../chunk-GT3XQN7Y.js';import'../../chunk-O2OTHNWM.js';import'../../chunk-7NQLQPLH.js';import'../../chunk-UQPD6GIF.js';import'../../chunk-5JGM556C.js';import'../../chunk-2NJVBJUN.js';import'../../chunk-XPPDOFBN.js';import'../../chunk-KFPOVYEJ.js';import'../../chunk-7GL74SXM.js';import'../../chunk-A264MT4Q.js';import'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
1
+ export{b as WhatsApp}from'../../chunk-HEVRZRB4.js';import'../../chunk-3MO3BTBC.js';import'../../chunk-R36L2XYO.js';import'../../chunk-GT3XQN7Y.js';import'../../chunk-O2OTHNWM.js';import'../../chunk-7NQLQPLH.js';import'../../chunk-UQPD6GIF.js';import'../../chunk-5JGM556C.js';import'../../chunk-2NJVBJUN.js';import'../../chunk-XPPDOFBN.js';import'../../chunk-KFPOVYEJ.js';import'../../chunk-7GL74SXM.js';import'../../chunk-A264MT4Q.js';import'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-SMHCU5MN.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -30,6 +30,7 @@ declare enum MessageTypesEnum {
30
30
  Order = "order",
31
31
  System = "system",
32
32
  Unknown = "unknown",
33
+ Statuses = "statuses",
33
34
  '*' = "*"
34
35
  }
35
36
  declare enum ParametersTypesEnum {
@@ -1,8 +1,8 @@
1
- import { E as EncryptionApi } from '../../EncryptionApi-r6_0rWwx.js';
2
- export { a as EncryptionClass, b as EncryptionPublicKeyResponse } from '../../EncryptionApi-r6_0rWwx.js';
3
- import '../../base--LmzWHx3.js';
1
+ import { E as EncryptionApi } from '../../EncryptionApi-CwGwcpiZ.js';
2
+ export { a as EncryptionClass, b as EncryptionPublicKeyResponse } from '../../EncryptionApi-CwGwcpiZ.js';
3
+ import '../../base-DwevK2tJ.js';
4
4
  import '../../shared/types/config.js';
5
- import '../../enums-CI7vzKhn.js';
5
+ import '../../enums-iedeomKw.js';
6
6
 
7
7
 
8
8
 
@@ -1,2 +1,2 @@
1
- export{a as EncryptionApi,b as default}from'../../chunk-7NQLQPLH.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
1
+ export{a as EncryptionApi,b as default}from'../../chunk-7NQLQPLH.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-SMHCU5MN.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
- import { F as FlowApi } from '../../FlowApi-BhpWbli2.js';
2
- export { C as CreateFlowResponse, a as Flow, e as FlowActionEnum, f as FlowAssetsResponse, g as FlowCategoryEnum, b as FlowClass, c as FlowEndpointRequest, d as FlowEndpointResponse, h as FlowMigrationResponse, i as FlowPreviewResponse, k as FlowStatusEnum, l as FlowValidationError, j as FlowsListResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse } from '../../FlowApi-BhpWbli2.js';
3
- import '../../base--LmzWHx3.js';
1
+ import { F as FlowApi } from '../../FlowApi-bENOxS_4.js';
2
+ export { C as CreateFlowResponse, a as Flow, e as FlowActionEnum, f as FlowAssetsResponse, g as FlowCategoryEnum, b as FlowClass, c as FlowEndpointRequest, d as FlowEndpointResponse, h as FlowMigrationResponse, i as FlowPreviewResponse, k as FlowStatusEnum, l as FlowValidationError, j as FlowsListResponse, U as UpdateFlowResponse, V as ValidateFlowJsonResponse } from '../../FlowApi-bENOxS_4.js';
3
+ import '../../base-DwevK2tJ.js';
4
4
  import '../../shared/types/config.js';
5
- import '../../enums-CI7vzKhn.js';
5
+ import '../../enums-iedeomKw.js';
6
6
 
7
7
 
8
8
 
@@ -1,2 +1,2 @@
1
- export{a as FlowApi,b as default}from'../../chunk-A264MT4Q.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
1
+ export{a as FlowApi,b as default}from'../../chunk-A264MT4Q.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-SMHCU5MN.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
- import { c as MediaApi } from '../../MediaApi-DM3WohTN.js';
2
- export { M as MediaClass, a as MediaResponse, b as MediasResponse, U as UploadMediaResponse } from '../../MediaApi-DM3WohTN.js';
3
- import '../../base--LmzWHx3.js';
1
+ import { c as MediaApi } from '../../MediaApi-DvAoklbt.js';
2
+ export { M as MediaClass, a as MediaResponse, b as MediasResponse, U as UploadMediaResponse } from '../../MediaApi-DvAoklbt.js';
3
+ import '../../base-DwevK2tJ.js';
4
4
  import '../../shared/types/config.js';
5
- import '../../enums-CI7vzKhn.js';
5
+ import '../../enums-iedeomKw.js';
6
6
 
7
7
 
8
8
 
@@ -1,2 +1,2 @@
1
- export{a as MediaApi,b as default}from'../../chunk-XPPDOFBN.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
1
+ export{a as MediaApi,b as default}from'../../chunk-XPPDOFBN.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-SMHCU5MN.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
- import { M as MessagesApi } from '../../MessageApi-Cr3Q6qg4.js';
2
- export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, b as MessageRequestParams, d as MessageTemplateObject, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from '../../MessageApi-Cr3Q6qg4.js';
3
- import '../../base--LmzWHx3.js';
1
+ import { M as MessagesApi } from '../../MessageApi-vNrieuce.js';
2
+ export { A as AudioMediaObject, C as ContactObject, D as DocumentMediaObject, I as ImageMediaObject, a as InteractiveObject, L as LocationObject, b as MessageRequestParams, d as MessageTemplateObject, c as MessagesResponse, R as ReactionParams, S as StatusParams, e as StickerMediaObject, T as TextMessageParams, f as TextObject, V as VideoMediaObject } from '../../MessageApi-vNrieuce.js';
3
+ import '../../base-DwevK2tJ.js';
4
4
  import '../../shared/types/config.js';
5
- import '../../enums-CI7vzKhn.js';
5
+ import '../../enums-iedeomKw.js';
6
6
 
7
7
 
8
8
 
@@ -1,2 +1,2 @@
1
- export{a as MessageApi,b as default}from'../../chunk-2NJVBJUN.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
1
+ export{a as MessageApi,b as default}from'../../chunk-2NJVBJUN.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-SMHCU5MN.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map
@@ -1,8 +1,8 @@
1
- import { P as PhoneNumberApi } from '../../PhoneNumberApi-Dc2KKn0M.js';
2
- export { A as AccountMode, C as CodeVerificationStatus, c as Cursors, H as HealthStatus, d as HealthStatusEntity, M as MessagingLimitTier, a as PhoneNumberClass, b as PhoneNumberResponse, e as PhoneNumbersResponse, f as PlatformType, Q as QualityRating, g as QualityScore, R as RequestVerificationCodeRequest, T as Throughput, h as ThroughputLevel, i as TwoStepVerificationParams, V as VerifyCodeRequest } from '../../PhoneNumberApi-Dc2KKn0M.js';
3
- import '../../base--LmzWHx3.js';
1
+ import { P as PhoneNumberApi } from '../../PhoneNumberApi-DiGL3drr.js';
2
+ export { A as AccountMode, C as CodeVerificationStatus, c as Cursors, H as HealthStatus, d as HealthStatusEntity, M as MessagingLimitTier, a as PhoneNumberClass, b as PhoneNumberResponse, e as PhoneNumbersResponse, f as PlatformType, Q as QualityRating, g as QualityScore, R as RequestVerificationCodeRequest, T as Throughput, h as ThroughputLevel, i as TwoStepVerificationParams, V as VerifyCodeRequest } from '../../PhoneNumberApi-DiGL3drr.js';
3
+ import '../../base-DwevK2tJ.js';
4
4
  import '../../shared/types/config.js';
5
- import '../../enums-CI7vzKhn.js';
5
+ import '../../enums-iedeomKw.js';
6
6
 
7
7
 
8
8
 
@@ -1,2 +1,2 @@
1
- export{a as PhoneNumberApi,b as default}from'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-2NCV35XS.js';import'../../chunk-M2GC5VFJ.js';//# sourceMappingURL=index.js.map
1
+ export{a as PhoneNumberApi,b as default}from'../../chunk-GIQLIMOD.js';import'../../chunk-BZ5QDXNR.js';import'../../chunk-VW3LGHTJ.js';import'../../chunk-SMHCU5MN.js';import'../../chunk-4C666HHU.js';//# sourceMappingURL=index.js.map
2
2
  //# sourceMappingURL=index.js.map