meta-cloud-api 0.0.18 → 0.0.19

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.
@@ -4,7 +4,7 @@ export { GeneralHeaderInterface, GeneralRequestBody, Paging, RequesterClass, Req
4
4
  export { BaseClass } from './base.mjs';
5
5
  export { HttpsClientClass, HttpsClientResponseClass, ResponseHeaderValue, ResponseHeaders, ResponseJSONBody } from './httpsClient.mjs';
6
6
  export { LoggerInterface } from './logger.mjs';
7
- export { AudioMediaObject, AudioMessageRequestBody, ContactObject, ContactsMessageRequestBody, DocumentMediaObject, DocumentMessageRequestBody, GeneralMessageBody, ImageMediaObject, ImageMessageRequestBody, InteractiveMessageRequestBody, InteractiveObject, LocationMessageRequestBody, LocationObject, MessageRequestBody, MessageTemplateObject, MessageTemplateRequestBody, MessagesClass, MessagesResponse, ReactionMessageRequestBody, StatusObject, StatusRequestBody, StickerMediaObject, StickerMessageRequestBody, TextMessageRequestBody, TextObject, TypingIndicatorObject, VideoMediaObject, VideoMessageRequestBody } from './messages.mjs';
7
+ export { AudioMediaObject, AudioMessageRequestBody, ContactObject, ContactsMessageRequestBody, DocumentMediaObject, DocumentMessageRequestBody, GeneralMessageBody, ImageMediaObject, ImageMessageRequestBody, InteractiveMessageRequestBody, InteractiveObject, LocationMessageRequestBody, LocationObject, MessageRequestBody, MessageRequestParams, MessageTemplateObject, MessageTemplateRequestBody, MessagesClass, MessagesResponse, ReactionMessageRequestBody, ReactionParams, StatusObject, StatusParams, StatusRequestBody, StickerMediaObject, StickerMessageRequestBody, TextMessageParams, TextMessageRequestBody, TextObject, TypingIndicatorObject, VideoMediaObject, VideoMessageRequestBody } from './messages.mjs';
8
8
  export { WhatsAppClass, WhatsAppConfig } from './whatsapp.mjs';
9
9
  export { ComponentTypes, CopyCodeButton, FlowButton, MPMButton, OTPButton, PhoneNumberButton, QuickReplyButton, SPMButton, TemplateBody, TemplateButton, TemplateClass, TemplateDeleteParams, TemplateFooter, TemplateFormat, TemplateGetParams, TemplateHeader, TemplateHeaderExample, TemplateRequestBody, TemplateResponse, URLButton } from './template.mjs';
10
10
  export { AccountMode, CodeVerificationStatus, Cursors, HealthStatus, HealthStatusEntity, MessagingLimitTier, PhoneNumberClass, PhoneNumberResponse, PhoneNumbersResponse, PlatformType, QualityRating, QualityScore, RequestVerificationCodeRequest, Throughput, ThroughputLevel, TwoStepVerificationParams, VerifyCodeRequest } from './phoneNumber.mjs';
@@ -4,7 +4,7 @@ export { GeneralHeaderInterface, GeneralRequestBody, Paging, RequesterClass, Req
4
4
  export { BaseClass } from './base.js';
5
5
  export { HttpsClientClass, HttpsClientResponseClass, ResponseHeaderValue, ResponseHeaders, ResponseJSONBody } from './httpsClient.js';
6
6
  export { LoggerInterface } from './logger.js';
7
- export { AudioMediaObject, AudioMessageRequestBody, ContactObject, ContactsMessageRequestBody, DocumentMediaObject, DocumentMessageRequestBody, GeneralMessageBody, ImageMediaObject, ImageMessageRequestBody, InteractiveMessageRequestBody, InteractiveObject, LocationMessageRequestBody, LocationObject, MessageRequestBody, MessageTemplateObject, MessageTemplateRequestBody, MessagesClass, MessagesResponse, ReactionMessageRequestBody, StatusObject, StatusRequestBody, StickerMediaObject, StickerMessageRequestBody, TextMessageRequestBody, TextObject, TypingIndicatorObject, VideoMediaObject, VideoMessageRequestBody } from './messages.js';
7
+ export { AudioMediaObject, AudioMessageRequestBody, ContactObject, ContactsMessageRequestBody, DocumentMediaObject, DocumentMessageRequestBody, GeneralMessageBody, ImageMediaObject, ImageMessageRequestBody, InteractiveMessageRequestBody, InteractiveObject, LocationMessageRequestBody, LocationObject, MessageRequestBody, MessageRequestParams, MessageTemplateObject, MessageTemplateRequestBody, MessagesClass, MessagesResponse, ReactionMessageRequestBody, ReactionParams, StatusObject, StatusParams, StatusRequestBody, StickerMediaObject, StickerMessageRequestBody, TextMessageParams, TextMessageRequestBody, TextObject, TypingIndicatorObject, VideoMediaObject, VideoMessageRequestBody } from './messages.js';
8
8
  export { WhatsAppClass, WhatsAppConfig } from './whatsapp.js';
9
9
  export { ComponentTypes, CopyCodeButton, FlowButton, MPMButton, OTPButton, PhoneNumberButton, QuickReplyButton, SPMButton, TemplateBody, TemplateButton, TemplateClass, TemplateDeleteParams, TemplateFooter, TemplateFormat, TemplateGetParams, TemplateHeader, TemplateHeaderExample, TemplateRequestBody, TemplateResponse, URLButton } from './template.js';
10
10
  export { AccountMode, CodeVerificationStatus, Cursors, HealthStatus, HealthStatusEntity, MessagingLimitTier, PhoneNumberClass, PhoneNumberResponse, PhoneNumbersResponse, PlatformType, QualityRating, QualityScore, RequestVerificationCodeRequest, Throughput, ThroughputLevel, TwoStepVerificationParams, VerifyCodeRequest } from './phoneNumber.js';
@@ -390,174 +390,164 @@ type MessagesResponse = GeneralMessageBody & {
390
390
  }
391
391
  ];
392
392
  };
393
+ interface MessageRequestParams<T> {
394
+ body: T;
395
+ to: string;
396
+ replyMessageId?: string;
397
+ }
398
+ interface TextMessageParams extends MessageRequestParams<TextObject | string> {
399
+ previewUrl?: boolean;
400
+ }
401
+ interface ReactionParams {
402
+ messageId: string;
403
+ emoji: string;
404
+ to: string;
405
+ }
406
+ interface StatusParams {
407
+ status: string;
408
+ messageId: string;
409
+ typingIndicator?: {
410
+ type: string;
411
+ };
412
+ }
393
413
  declare class MessagesClass extends BaseClass {
394
414
  /**
395
415
  * Sends an audio message via WhatsApp
396
- * @param body The audio media object
397
- * @param to Recipient's phone number
398
- * @param replyMessageId Optional message ID to reply to
416
+ * @param params The audio message parameter object
399
417
  * @returns Promise with the message response
400
418
  */
401
- audio(body: AudioMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
419
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
402
420
  /**
403
421
  * Sends a contact card via WhatsApp
404
- * @param body The contact object
405
- * @param to Recipient's phone number
406
- * @param replyMessageId Optional message ID to reply to
422
+ * @param params The contact message parameter object
407
423
  * @returns Promise with the message response
408
424
  */
409
- contacts(body: [ContactObject], to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
425
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<RequesterResponseInterface<MessagesResponse>>;
410
426
  /**
411
427
  * Sends a document via WhatsApp
412
- * @param body The document media object
413
- * @param to Recipient's phone number
414
- * @param replyMessageId Optional message ID to reply to
428
+ * @param params The document message parameter object
415
429
  * @returns Promise with the message response
416
430
  */
417
- document(body: DocumentMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
431
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
418
432
  /**
419
433
  * Sends an image via WhatsApp
420
- * @param body The image media object
421
- * @param to Recipient's phone number
422
- * @param replyMessageId Optional message ID to reply to
434
+ * @param params The image message parameter object
423
435
  * @returns Promise with the message response
424
436
  */
425
- image(body: ImageMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
437
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
426
438
  /**
427
439
  * Sends an interactive message via WhatsApp
428
- * @param body The interactive object (buttons, lists, etc.)
429
- * @param to Recipient's phone number
430
- * @param replyMessageId Optional message ID to reply to
440
+ * @param params The interactive message parameter object
431
441
  * @returns Promise with the message response
432
442
  */
433
- interactive(body: InteractiveObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
443
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
434
444
  /**
435
445
  * Sends a location via WhatsApp
436
- * @param body The location object with coordinates
437
- * @param to Recipient's phone number
438
- * @param replyMessageId Optional message ID to reply to
446
+ * @param params The location message parameter object
439
447
  * @returns Promise with the message response
440
448
  */
441
- location(body: LocationObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
449
+ location(params: MessageRequestParams<LocationObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
442
450
  /**
443
451
  * Updates message status (used for read receipts and typing indicators)
444
- * @param body The status object
452
+ * @param params The status update parameter object
445
453
  * @returns Promise with the response
446
454
  */
447
- status(body: StatusObject): Promise<RequesterResponseInterface<MessagesResponse>>;
455
+ status(params: StatusParams): Promise<RequesterResponseInterface<MessagesResponse>>;
448
456
  /**
449
457
  * Sends a sticker via WhatsApp
450
- * @param body The sticker media object
451
- * @param to Recipient's phone number
452
- * @param replyMessageId Optional message ID to reply to
458
+ * @param params The sticker message parameter object
453
459
  * @returns Promise with the message response
454
460
  */
455
- sticker(body: StickerMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
461
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
456
462
  /**
457
463
  * Sends a template message via WhatsApp
458
- * @param body The message template object
459
- * @param to Recipient's phone number
460
- * @param replyMessageId Optional message ID to reply to
464
+ * @param params The template message parameter object
461
465
  * @returns Promise with the message response
462
466
  */
463
- template(body: MessageTemplateObject<ComponentTypesEnum>, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
467
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<RequesterResponseInterface<MessagesResponse>>;
464
468
  /**
465
469
  * Sends a text message via WhatsApp
466
- * @param body The text object containing the message
467
- * @param to Recipient's phone number
468
- * @param replyMessageId Optional message ID to reply to
470
+ * @param params The text message parameter object
469
471
  * @returns Promise with the message response
470
472
  */
471
- text(body: TextObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
473
+ text(params: TextMessageParams): Promise<RequesterResponseInterface<MessagesResponse>>;
472
474
  /**
473
475
  * Sends a video via WhatsApp
474
- * @param body The video media object
475
- * @param to Recipient's phone number
476
- * @param replyMessageId Optional message ID to reply to
476
+ * @param params The video message parameter object
477
477
  * @returns Promise with the message response
478
478
  */
479
- video(body: VideoMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
479
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
480
480
  /**
481
481
  * Marks a message as read in WhatsApp
482
- * @param messageId ID of the message to mark as read
482
+ * @param params The parameter object to mark message as read
483
483
  * @returns Promise with the response
484
484
  */
485
- markAsRead(messageId: string): Promise<RequesterResponseInterface<MessagesResponse>>;
485
+ markAsRead(params: {
486
+ messageId: string;
487
+ }): Promise<RequesterResponseInterface<MessagesResponse>>;
486
488
  /**
487
489
  * Marks a message as read and shows a typing indicator in WhatsApp
488
- * @param messageId ID of the message to mark as read
490
+ * @param params The typing indicator parameter object
489
491
  * @returns Promise with the response
490
492
  */
491
- showTypingIndicator(messageId: string): Promise<RequesterResponseInterface<MessagesResponse>>;
493
+ showTypingIndicator(params: {
494
+ messageId: string;
495
+ }): Promise<RequesterResponseInterface<MessagesResponse>>;
492
496
  /**
493
497
  * Sends an interactive list message
494
- * @param body The list message content
495
- * @param to Recipient phone number
496
- * @param replyMessageId Optional message ID to reply to
498
+ * @param params The list message parameter object
497
499
  * @returns Promise with the response
498
500
  */
499
- interactiveList(body: InteractiveObject & {
500
- type: 'list';
501
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
501
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
502
+ type: InteractiveTypesEnum.List;
503
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
502
504
  /**
503
505
  * Sends an interactive CTA URL message
504
- * @param body The CTA URL message content
505
- * @param to Recipient phone number
506
- * @param replyMessageId Optional message ID to reply to
506
+ * @param params The CTA URL message parameter object
507
507
  * @returns Promise with the response
508
508
  */
509
- interactiveCtaUrl(body: InteractiveObject & {
510
- type: 'cta_url';
511
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
509
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
510
+ type: InteractiveTypesEnum.CtaUrl;
511
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
512
512
  /**
513
513
  * Sends a location request message
514
- * @param body The location request message content
515
- * @param to Recipient phone number
516
- * @param replyMessageId Optional message ID to reply to
514
+ * @param params The location request message parameter object
517
515
  * @returns Promise with the response
518
516
  */
519
- interactiveLocationRequest(body: InteractiveObject & {
520
- type: 'location_request_message';
521
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
517
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
518
+ type: InteractiveTypesEnum.LocationRequest;
519
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
522
520
  /**
523
521
  * Sends an address message to request shipping address from the user
524
522
  * Note: This feature is only available for businesses based in India and their India customers
525
- * @param body The address message content
526
- * @param to Recipient phone number
527
- * @param replyMessageId Optional message ID to reply to
523
+ * @param params The address message parameter object
528
524
  * @returns Promise with the response
529
525
  */
530
- interactiveAddressMessage(body: InteractiveObject & {
531
- type: 'address_message';
532
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
526
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
527
+ type: InteractiveTypesEnum.AddressMessage;
528
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
533
529
  /**
534
530
  * Sends an interactive reply buttons message
535
- * @param body The reply buttons message content
536
- * @param to Recipient phone number
537
- * @param replyMessageId Optional message ID to reply to
531
+ * @param params The reply buttons message parameter object
538
532
  * @returns Promise with the response
539
533
  */
540
- interactiveReplyButtons(body: InteractiveObject & {
541
- type: 'button';
542
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
534
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
535
+ type: InteractiveTypesEnum.Button;
536
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
543
537
  /**
544
538
  * Sends a reaction to a message (emoji response)
545
- * @param messageId ID of the message to react to
546
- * @param emoji The emoji to send as reaction (e.g. "😀", "❤️", "👍")
547
- * @param to Recipient phone number
539
+ * @param params The reaction message parameter object
548
540
  * @returns Promise with the response
549
541
  */
550
- reaction(messageId: string, emoji: string, to: string): Promise<RequesterResponseInterface<MessagesResponse>>;
542
+ reaction(params: ReactionParams): Promise<RequesterResponseInterface<MessagesResponse>>;
551
543
  /**
552
544
  * Sends an interactive Flow message
553
- * @param body The Flow message content
554
- * @param to Recipient phone number
555
- * @param replyMessageId Optional message ID to reply to
545
+ * @param params The Flow message parameter object
556
546
  * @returns Promise with the response
557
547
  */
558
- interactiveFlow(body: InteractiveObject & {
559
- type: 'flow';
560
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
548
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
549
+ type: InteractiveTypesEnum.Flow;
550
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
561
551
  }
562
552
 
563
- export { type AudioMediaObject, type AudioMessageRequestBody, type ContactObject, type ContactsMessageRequestBody, type DocumentMediaObject, type DocumentMessageRequestBody, type GeneralMessageBody, type ImageMediaObject, type ImageMessageRequestBody, type InteractiveMessageRequestBody, type InteractiveObject, type LocationMessageRequestBody, type LocationObject, type MessageRequestBody, type MessageTemplateObject, type MessageTemplateRequestBody, MessagesClass, type MessagesResponse, type ReactionMessageRequestBody, type StatusObject, type StatusRequestBody, type StickerMediaObject, type StickerMessageRequestBody, type TextMessageRequestBody, type TextObject, type TypingIndicatorObject, type VideoMediaObject, type VideoMessageRequestBody };
553
+ export { type AudioMediaObject, type AudioMessageRequestBody, type ContactObject, type ContactsMessageRequestBody, type DocumentMediaObject, type DocumentMessageRequestBody, type GeneralMessageBody, type ImageMediaObject, type ImageMessageRequestBody, type InteractiveMessageRequestBody, type InteractiveObject, type LocationMessageRequestBody, type LocationObject, type MessageRequestBody, type MessageRequestParams, type MessageTemplateObject, type MessageTemplateRequestBody, MessagesClass, type MessagesResponse, type ReactionMessageRequestBody, type ReactionParams, type StatusObject, type StatusParams, type StatusRequestBody, type StickerMediaObject, type StickerMessageRequestBody, type TextMessageParams, type TextMessageRequestBody, type TextObject, type TypingIndicatorObject, type VideoMediaObject, type VideoMessageRequestBody };
@@ -390,174 +390,164 @@ type MessagesResponse = GeneralMessageBody & {
390
390
  }
391
391
  ];
392
392
  };
393
+ interface MessageRequestParams<T> {
394
+ body: T;
395
+ to: string;
396
+ replyMessageId?: string;
397
+ }
398
+ interface TextMessageParams extends MessageRequestParams<TextObject | string> {
399
+ previewUrl?: boolean;
400
+ }
401
+ interface ReactionParams {
402
+ messageId: string;
403
+ emoji: string;
404
+ to: string;
405
+ }
406
+ interface StatusParams {
407
+ status: string;
408
+ messageId: string;
409
+ typingIndicator?: {
410
+ type: string;
411
+ };
412
+ }
393
413
  declare class MessagesClass extends BaseClass {
394
414
  /**
395
415
  * Sends an audio message via WhatsApp
396
- * @param body The audio media object
397
- * @param to Recipient's phone number
398
- * @param replyMessageId Optional message ID to reply to
416
+ * @param params The audio message parameter object
399
417
  * @returns Promise with the message response
400
418
  */
401
- audio(body: AudioMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
419
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
402
420
  /**
403
421
  * Sends a contact card via WhatsApp
404
- * @param body The contact object
405
- * @param to Recipient's phone number
406
- * @param replyMessageId Optional message ID to reply to
422
+ * @param params The contact message parameter object
407
423
  * @returns Promise with the message response
408
424
  */
409
- contacts(body: [ContactObject], to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
425
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<RequesterResponseInterface<MessagesResponse>>;
410
426
  /**
411
427
  * Sends a document via WhatsApp
412
- * @param body The document media object
413
- * @param to Recipient's phone number
414
- * @param replyMessageId Optional message ID to reply to
428
+ * @param params The document message parameter object
415
429
  * @returns Promise with the message response
416
430
  */
417
- document(body: DocumentMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
431
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
418
432
  /**
419
433
  * Sends an image via WhatsApp
420
- * @param body The image media object
421
- * @param to Recipient's phone number
422
- * @param replyMessageId Optional message ID to reply to
434
+ * @param params The image message parameter object
423
435
  * @returns Promise with the message response
424
436
  */
425
- image(body: ImageMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
437
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
426
438
  /**
427
439
  * Sends an interactive message via WhatsApp
428
- * @param body The interactive object (buttons, lists, etc.)
429
- * @param to Recipient's phone number
430
- * @param replyMessageId Optional message ID to reply to
440
+ * @param params The interactive message parameter object
431
441
  * @returns Promise with the message response
432
442
  */
433
- interactive(body: InteractiveObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
443
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
434
444
  /**
435
445
  * Sends a location via WhatsApp
436
- * @param body The location object with coordinates
437
- * @param to Recipient's phone number
438
- * @param replyMessageId Optional message ID to reply to
446
+ * @param params The location message parameter object
439
447
  * @returns Promise with the message response
440
448
  */
441
- location(body: LocationObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
449
+ location(params: MessageRequestParams<LocationObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
442
450
  /**
443
451
  * Updates message status (used for read receipts and typing indicators)
444
- * @param body The status object
452
+ * @param params The status update parameter object
445
453
  * @returns Promise with the response
446
454
  */
447
- status(body: StatusObject): Promise<RequesterResponseInterface<MessagesResponse>>;
455
+ status(params: StatusParams): Promise<RequesterResponseInterface<MessagesResponse>>;
448
456
  /**
449
457
  * Sends a sticker via WhatsApp
450
- * @param body The sticker media object
451
- * @param to Recipient's phone number
452
- * @param replyMessageId Optional message ID to reply to
458
+ * @param params The sticker message parameter object
453
459
  * @returns Promise with the message response
454
460
  */
455
- sticker(body: StickerMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
461
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
456
462
  /**
457
463
  * Sends a template message via WhatsApp
458
- * @param body The message template object
459
- * @param to Recipient's phone number
460
- * @param replyMessageId Optional message ID to reply to
464
+ * @param params The template message parameter object
461
465
  * @returns Promise with the message response
462
466
  */
463
- template(body: MessageTemplateObject<ComponentTypesEnum>, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
467
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<RequesterResponseInterface<MessagesResponse>>;
464
468
  /**
465
469
  * Sends a text message via WhatsApp
466
- * @param body The text object containing the message
467
- * @param to Recipient's phone number
468
- * @param replyMessageId Optional message ID to reply to
470
+ * @param params The text message parameter object
469
471
  * @returns Promise with the message response
470
472
  */
471
- text(body: TextObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
473
+ text(params: TextMessageParams): Promise<RequesterResponseInterface<MessagesResponse>>;
472
474
  /**
473
475
  * Sends a video via WhatsApp
474
- * @param body The video media object
475
- * @param to Recipient's phone number
476
- * @param replyMessageId Optional message ID to reply to
476
+ * @param params The video message parameter object
477
477
  * @returns Promise with the message response
478
478
  */
479
- video(body: VideoMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
479
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
480
480
  /**
481
481
  * Marks a message as read in WhatsApp
482
- * @param messageId ID of the message to mark as read
482
+ * @param params The parameter object to mark message as read
483
483
  * @returns Promise with the response
484
484
  */
485
- markAsRead(messageId: string): Promise<RequesterResponseInterface<MessagesResponse>>;
485
+ markAsRead(params: {
486
+ messageId: string;
487
+ }): Promise<RequesterResponseInterface<MessagesResponse>>;
486
488
  /**
487
489
  * Marks a message as read and shows a typing indicator in WhatsApp
488
- * @param messageId ID of the message to mark as read
490
+ * @param params The typing indicator parameter object
489
491
  * @returns Promise with the response
490
492
  */
491
- showTypingIndicator(messageId: string): Promise<RequesterResponseInterface<MessagesResponse>>;
493
+ showTypingIndicator(params: {
494
+ messageId: string;
495
+ }): Promise<RequesterResponseInterface<MessagesResponse>>;
492
496
  /**
493
497
  * Sends an interactive list message
494
- * @param body The list message content
495
- * @param to Recipient phone number
496
- * @param replyMessageId Optional message ID to reply to
498
+ * @param params The list message parameter object
497
499
  * @returns Promise with the response
498
500
  */
499
- interactiveList(body: InteractiveObject & {
500
- type: 'list';
501
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
501
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
502
+ type: InteractiveTypesEnum.List;
503
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
502
504
  /**
503
505
  * Sends an interactive CTA URL message
504
- * @param body The CTA URL message content
505
- * @param to Recipient phone number
506
- * @param replyMessageId Optional message ID to reply to
506
+ * @param params The CTA URL message parameter object
507
507
  * @returns Promise with the response
508
508
  */
509
- interactiveCtaUrl(body: InteractiveObject & {
510
- type: 'cta_url';
511
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
509
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
510
+ type: InteractiveTypesEnum.CtaUrl;
511
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
512
512
  /**
513
513
  * Sends a location request message
514
- * @param body The location request message content
515
- * @param to Recipient phone number
516
- * @param replyMessageId Optional message ID to reply to
514
+ * @param params The location request message parameter object
517
515
  * @returns Promise with the response
518
516
  */
519
- interactiveLocationRequest(body: InteractiveObject & {
520
- type: 'location_request_message';
521
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
517
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
518
+ type: InteractiveTypesEnum.LocationRequest;
519
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
522
520
  /**
523
521
  * Sends an address message to request shipping address from the user
524
522
  * Note: This feature is only available for businesses based in India and their India customers
525
- * @param body The address message content
526
- * @param to Recipient phone number
527
- * @param replyMessageId Optional message ID to reply to
523
+ * @param params The address message parameter object
528
524
  * @returns Promise with the response
529
525
  */
530
- interactiveAddressMessage(body: InteractiveObject & {
531
- type: 'address_message';
532
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
526
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
527
+ type: InteractiveTypesEnum.AddressMessage;
528
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
533
529
  /**
534
530
  * Sends an interactive reply buttons message
535
- * @param body The reply buttons message content
536
- * @param to Recipient phone number
537
- * @param replyMessageId Optional message ID to reply to
531
+ * @param params The reply buttons message parameter object
538
532
  * @returns Promise with the response
539
533
  */
540
- interactiveReplyButtons(body: InteractiveObject & {
541
- type: 'button';
542
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
534
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
535
+ type: InteractiveTypesEnum.Button;
536
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
543
537
  /**
544
538
  * Sends a reaction to a message (emoji response)
545
- * @param messageId ID of the message to react to
546
- * @param emoji The emoji to send as reaction (e.g. "😀", "❤️", "👍")
547
- * @param to Recipient phone number
539
+ * @param params The reaction message parameter object
548
540
  * @returns Promise with the response
549
541
  */
550
- reaction(messageId: string, emoji: string, to: string): Promise<RequesterResponseInterface<MessagesResponse>>;
542
+ reaction(params: ReactionParams): Promise<RequesterResponseInterface<MessagesResponse>>;
551
543
  /**
552
544
  * Sends an interactive Flow message
553
- * @param body The Flow message content
554
- * @param to Recipient phone number
555
- * @param replyMessageId Optional message ID to reply to
545
+ * @param params The Flow message parameter object
556
546
  * @returns Promise with the response
557
547
  */
558
- interactiveFlow(body: InteractiveObject & {
559
- type: 'flow';
560
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
548
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
549
+ type: InteractiveTypesEnum.Flow;
550
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
561
551
  }
562
552
 
563
- export { type AudioMediaObject, type AudioMessageRequestBody, type ContactObject, type ContactsMessageRequestBody, type DocumentMediaObject, type DocumentMessageRequestBody, type GeneralMessageBody, type ImageMediaObject, type ImageMessageRequestBody, type InteractiveMessageRequestBody, type InteractiveObject, type LocationMessageRequestBody, type LocationObject, type MessageRequestBody, type MessageTemplateObject, type MessageTemplateRequestBody, MessagesClass, type MessagesResponse, type ReactionMessageRequestBody, type StatusObject, type StatusRequestBody, type StickerMediaObject, type StickerMessageRequestBody, type TextMessageRequestBody, type TextObject, type TypingIndicatorObject, type VideoMediaObject, type VideoMessageRequestBody };
553
+ export { type AudioMediaObject, type AudioMessageRequestBody, type ContactObject, type ContactsMessageRequestBody, type DocumentMediaObject, type DocumentMessageRequestBody, type GeneralMessageBody, type ImageMediaObject, type ImageMessageRequestBody, type InteractiveMessageRequestBody, type InteractiveObject, type LocationMessageRequestBody, type LocationObject, type MessageRequestBody, type MessageRequestParams, type MessageTemplateObject, type MessageTemplateRequestBody, MessagesClass, type MessagesResponse, type ReactionMessageRequestBody, type ReactionParams, type StatusObject, type StatusParams, type StatusRequestBody, type StickerMediaObject, type StickerMessageRequestBody, type TextMessageParams, type TextMessageRequestBody, type TextObject, type TypingIndicatorObject, type VideoMediaObject, type VideoMessageRequestBody };
@@ -1,2 +1,2 @@
1
- "use strict";var n=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(t,e,a,r)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of o(e))!c.call(t,s)&&s!==a&&n(t,s,{get:()=>e[s],enumerable:!(r=i(e,s))||r.enumerable});return t};var d=t=>p(n({},"__esModule",{value:!0}),t);var g={};module.exports=d(g);
1
+ "use strict";var r=Object.defineProperty;var i=Object.getOwnPropertyDescriptor;var o=Object.getOwnPropertyNames;var c=Object.prototype.hasOwnProperty;var p=(t,e,n,a)=>{if(e&&typeof e=="object"||typeof e=="function")for(let s of o(e))!c.call(t,s)&&s!==n&&r(t,s,{get:()=>e[s],enumerable:!(a=i(e,s))||a.enumerable});return t};var m=t=>p(r({},"__esModule",{value:!0}),t);var d={};module.exports=m(d);
2
2
  //# sourceMappingURL=messages.js.map