meta-cloud-api 0.0.18 → 0.0.20

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';
@@ -260,12 +260,17 @@ type AddressMessageInteractiveObject = {
260
260
  action: AddressMessageActionObject;
261
261
  };
262
262
  type FlowParameters = {
263
- flow_token: string;
263
+ flow_message_version: string;
264
264
  flow_id?: string;
265
- flow_cta?: string;
266
- screen?: string;
267
- mode?: 'fullscreen' | 'drawer';
268
- data?: Record<string, string>;
265
+ flow_name?: string;
266
+ flow_cta: string;
267
+ mode?: 'draft' | 'published';
268
+ flow_token: string;
269
+ flow_action: 'navigate' | 'data_exchange';
270
+ flow_action_payload?: {
271
+ screen?: string;
272
+ data?: Record<string, string>;
273
+ };
269
274
  };
270
275
  type FlowActionObject = {
271
276
  name: 'flow';
@@ -390,174 +395,164 @@ type MessagesResponse = GeneralMessageBody & {
390
395
  }
391
396
  ];
392
397
  };
398
+ interface MessageRequestParams<T> {
399
+ body: T;
400
+ to: string;
401
+ replyMessageId?: string;
402
+ }
403
+ interface TextMessageParams extends MessageRequestParams<TextObject | string> {
404
+ previewUrl?: boolean;
405
+ }
406
+ interface ReactionParams {
407
+ messageId: string;
408
+ emoji: string;
409
+ to: string;
410
+ }
411
+ interface StatusParams {
412
+ status: string;
413
+ messageId: string;
414
+ typingIndicator?: {
415
+ type: string;
416
+ };
417
+ }
393
418
  declare class MessagesClass extends BaseClass {
394
419
  /**
395
420
  * 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
421
+ * @param params The audio message parameter object
399
422
  * @returns Promise with the message response
400
423
  */
401
- audio(body: AudioMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
424
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
402
425
  /**
403
426
  * 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
427
+ * @param params The contact message parameter object
407
428
  * @returns Promise with the message response
408
429
  */
409
- contacts(body: [ContactObject], to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
430
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<RequesterResponseInterface<MessagesResponse>>;
410
431
  /**
411
432
  * 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
433
+ * @param params The document message parameter object
415
434
  * @returns Promise with the message response
416
435
  */
417
- document(body: DocumentMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
436
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
418
437
  /**
419
438
  * 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
439
+ * @param params The image message parameter object
423
440
  * @returns Promise with the message response
424
441
  */
425
- image(body: ImageMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
442
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
426
443
  /**
427
444
  * 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
445
+ * @param params The interactive message parameter object
431
446
  * @returns Promise with the message response
432
447
  */
433
- interactive(body: InteractiveObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
448
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
434
449
  /**
435
450
  * 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
451
+ * @param params The location message parameter object
439
452
  * @returns Promise with the message response
440
453
  */
441
- location(body: LocationObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
454
+ location(params: MessageRequestParams<LocationObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
442
455
  /**
443
456
  * Updates message status (used for read receipts and typing indicators)
444
- * @param body The status object
457
+ * @param params The status update parameter object
445
458
  * @returns Promise with the response
446
459
  */
447
- status(body: StatusObject): Promise<RequesterResponseInterface<MessagesResponse>>;
460
+ status(params: StatusParams): Promise<RequesterResponseInterface<MessagesResponse>>;
448
461
  /**
449
462
  * 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
463
+ * @param params The sticker message parameter object
453
464
  * @returns Promise with the message response
454
465
  */
455
- sticker(body: StickerMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
466
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
456
467
  /**
457
468
  * 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
469
+ * @param params The template message parameter object
461
470
  * @returns Promise with the message response
462
471
  */
463
- template(body: MessageTemplateObject<ComponentTypesEnum>, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
472
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<RequesterResponseInterface<MessagesResponse>>;
464
473
  /**
465
474
  * 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
475
+ * @param params The text message parameter object
469
476
  * @returns Promise with the message response
470
477
  */
471
- text(body: TextObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
478
+ text(params: TextMessageParams): Promise<RequesterResponseInterface<MessagesResponse>>;
472
479
  /**
473
480
  * 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
481
+ * @param params The video message parameter object
477
482
  * @returns Promise with the message response
478
483
  */
479
- video(body: VideoMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
484
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
480
485
  /**
481
486
  * Marks a message as read in WhatsApp
482
- * @param messageId ID of the message to mark as read
487
+ * @param params The parameter object to mark message as read
483
488
  * @returns Promise with the response
484
489
  */
485
- markAsRead(messageId: string): Promise<RequesterResponseInterface<MessagesResponse>>;
490
+ markAsRead(params: {
491
+ messageId: string;
492
+ }): Promise<RequesterResponseInterface<MessagesResponse>>;
486
493
  /**
487
494
  * Marks a message as read and shows a typing indicator in WhatsApp
488
- * @param messageId ID of the message to mark as read
495
+ * @param params The typing indicator parameter object
489
496
  * @returns Promise with the response
490
497
  */
491
- showTypingIndicator(messageId: string): Promise<RequesterResponseInterface<MessagesResponse>>;
498
+ showTypingIndicator(params: {
499
+ messageId: string;
500
+ }): Promise<RequesterResponseInterface<MessagesResponse>>;
492
501
  /**
493
502
  * 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
503
+ * @param params The list message parameter object
497
504
  * @returns Promise with the response
498
505
  */
499
- interactiveList(body: InteractiveObject & {
500
- type: 'list';
501
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
506
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
507
+ type: InteractiveTypesEnum.List;
508
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
502
509
  /**
503
510
  * 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
511
+ * @param params The CTA URL message parameter object
507
512
  * @returns Promise with the response
508
513
  */
509
- interactiveCtaUrl(body: InteractiveObject & {
510
- type: 'cta_url';
511
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
514
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
515
+ type: InteractiveTypesEnum.CtaUrl;
516
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
512
517
  /**
513
518
  * 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
519
+ * @param params The location request message parameter object
517
520
  * @returns Promise with the response
518
521
  */
519
- interactiveLocationRequest(body: InteractiveObject & {
520
- type: 'location_request_message';
521
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
522
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
523
+ type: InteractiveTypesEnum.LocationRequest;
524
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
522
525
  /**
523
526
  * Sends an address message to request shipping address from the user
524
527
  * 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
528
+ * @param params The address message parameter object
528
529
  * @returns Promise with the response
529
530
  */
530
- interactiveAddressMessage(body: InteractiveObject & {
531
- type: 'address_message';
532
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
531
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
532
+ type: InteractiveTypesEnum.AddressMessage;
533
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
533
534
  /**
534
535
  * 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
536
+ * @param params The reply buttons message parameter object
538
537
  * @returns Promise with the response
539
538
  */
540
- interactiveReplyButtons(body: InteractiveObject & {
541
- type: 'button';
542
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
539
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
540
+ type: InteractiveTypesEnum.Button;
541
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
543
542
  /**
544
543
  * 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
544
+ * @param params The reaction message parameter object
548
545
  * @returns Promise with the response
549
546
  */
550
- reaction(messageId: string, emoji: string, to: string): Promise<RequesterResponseInterface<MessagesResponse>>;
547
+ reaction(params: ReactionParams): Promise<RequesterResponseInterface<MessagesResponse>>;
551
548
  /**
552
549
  * 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
550
+ * @param params The Flow message parameter object
556
551
  * @returns Promise with the response
557
552
  */
558
- interactiveFlow(body: InteractiveObject & {
559
- type: 'flow';
560
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
553
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
554
+ type: InteractiveTypesEnum.Flow;
555
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
561
556
  }
562
557
 
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 };
558
+ 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 };
@@ -260,12 +260,17 @@ type AddressMessageInteractiveObject = {
260
260
  action: AddressMessageActionObject;
261
261
  };
262
262
  type FlowParameters = {
263
- flow_token: string;
263
+ flow_message_version: string;
264
264
  flow_id?: string;
265
- flow_cta?: string;
266
- screen?: string;
267
- mode?: 'fullscreen' | 'drawer';
268
- data?: Record<string, string>;
265
+ flow_name?: string;
266
+ flow_cta: string;
267
+ mode?: 'draft' | 'published';
268
+ flow_token: string;
269
+ flow_action: 'navigate' | 'data_exchange';
270
+ flow_action_payload?: {
271
+ screen?: string;
272
+ data?: Record<string, string>;
273
+ };
269
274
  };
270
275
  type FlowActionObject = {
271
276
  name: 'flow';
@@ -390,174 +395,164 @@ type MessagesResponse = GeneralMessageBody & {
390
395
  }
391
396
  ];
392
397
  };
398
+ interface MessageRequestParams<T> {
399
+ body: T;
400
+ to: string;
401
+ replyMessageId?: string;
402
+ }
403
+ interface TextMessageParams extends MessageRequestParams<TextObject | string> {
404
+ previewUrl?: boolean;
405
+ }
406
+ interface ReactionParams {
407
+ messageId: string;
408
+ emoji: string;
409
+ to: string;
410
+ }
411
+ interface StatusParams {
412
+ status: string;
413
+ messageId: string;
414
+ typingIndicator?: {
415
+ type: string;
416
+ };
417
+ }
393
418
  declare class MessagesClass extends BaseClass {
394
419
  /**
395
420
  * 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
421
+ * @param params The audio message parameter object
399
422
  * @returns Promise with the message response
400
423
  */
401
- audio(body: AudioMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
424
+ audio(params: MessageRequestParams<AudioMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
402
425
  /**
403
426
  * 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
427
+ * @param params The contact message parameter object
407
428
  * @returns Promise with the message response
408
429
  */
409
- contacts(body: [ContactObject], to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
430
+ contacts(params: MessageRequestParams<[ContactObject]>): Promise<RequesterResponseInterface<MessagesResponse>>;
410
431
  /**
411
432
  * 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
433
+ * @param params The document message parameter object
415
434
  * @returns Promise with the message response
416
435
  */
417
- document(body: DocumentMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
436
+ document(params: MessageRequestParams<DocumentMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
418
437
  /**
419
438
  * 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
439
+ * @param params The image message parameter object
423
440
  * @returns Promise with the message response
424
441
  */
425
- image(body: ImageMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
442
+ image(params: MessageRequestParams<ImageMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
426
443
  /**
427
444
  * 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
445
+ * @param params The interactive message parameter object
431
446
  * @returns Promise with the message response
432
447
  */
433
- interactive(body: InteractiveObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
448
+ interactive(params: MessageRequestParams<InteractiveObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
434
449
  /**
435
450
  * 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
451
+ * @param params The location message parameter object
439
452
  * @returns Promise with the message response
440
453
  */
441
- location(body: LocationObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
454
+ location(params: MessageRequestParams<LocationObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
442
455
  /**
443
456
  * Updates message status (used for read receipts and typing indicators)
444
- * @param body The status object
457
+ * @param params The status update parameter object
445
458
  * @returns Promise with the response
446
459
  */
447
- status(body: StatusObject): Promise<RequesterResponseInterface<MessagesResponse>>;
460
+ status(params: StatusParams): Promise<RequesterResponseInterface<MessagesResponse>>;
448
461
  /**
449
462
  * 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
463
+ * @param params The sticker message parameter object
453
464
  * @returns Promise with the message response
454
465
  */
455
- sticker(body: StickerMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
466
+ sticker(params: MessageRequestParams<StickerMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
456
467
  /**
457
468
  * 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
469
+ * @param params The template message parameter object
461
470
  * @returns Promise with the message response
462
471
  */
463
- template(body: MessageTemplateObject<ComponentTypesEnum>, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
472
+ template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<RequesterResponseInterface<MessagesResponse>>;
464
473
  /**
465
474
  * 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
475
+ * @param params The text message parameter object
469
476
  * @returns Promise with the message response
470
477
  */
471
- text(body: TextObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
478
+ text(params: TextMessageParams): Promise<RequesterResponseInterface<MessagesResponse>>;
472
479
  /**
473
480
  * 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
481
+ * @param params The video message parameter object
477
482
  * @returns Promise with the message response
478
483
  */
479
- video(body: VideoMediaObject, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
484
+ video(params: MessageRequestParams<VideoMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
480
485
  /**
481
486
  * Marks a message as read in WhatsApp
482
- * @param messageId ID of the message to mark as read
487
+ * @param params The parameter object to mark message as read
483
488
  * @returns Promise with the response
484
489
  */
485
- markAsRead(messageId: string): Promise<RequesterResponseInterface<MessagesResponse>>;
490
+ markAsRead(params: {
491
+ messageId: string;
492
+ }): Promise<RequesterResponseInterface<MessagesResponse>>;
486
493
  /**
487
494
  * Marks a message as read and shows a typing indicator in WhatsApp
488
- * @param messageId ID of the message to mark as read
495
+ * @param params The typing indicator parameter object
489
496
  * @returns Promise with the response
490
497
  */
491
- showTypingIndicator(messageId: string): Promise<RequesterResponseInterface<MessagesResponse>>;
498
+ showTypingIndicator(params: {
499
+ messageId: string;
500
+ }): Promise<RequesterResponseInterface<MessagesResponse>>;
492
501
  /**
493
502
  * 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
503
+ * @param params The list message parameter object
497
504
  * @returns Promise with the response
498
505
  */
499
- interactiveList(body: InteractiveObject & {
500
- type: 'list';
501
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
506
+ interactiveList(params: MessageRequestParams<InteractiveObject & {
507
+ type: InteractiveTypesEnum.List;
508
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
502
509
  /**
503
510
  * 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
511
+ * @param params The CTA URL message parameter object
507
512
  * @returns Promise with the response
508
513
  */
509
- interactiveCtaUrl(body: InteractiveObject & {
510
- type: 'cta_url';
511
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
514
+ interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
515
+ type: InteractiveTypesEnum.CtaUrl;
516
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
512
517
  /**
513
518
  * 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
519
+ * @param params The location request message parameter object
517
520
  * @returns Promise with the response
518
521
  */
519
- interactiveLocationRequest(body: InteractiveObject & {
520
- type: 'location_request_message';
521
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
522
+ interactiveLocationRequest(params: MessageRequestParams<InteractiveObject & {
523
+ type: InteractiveTypesEnum.LocationRequest;
524
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
522
525
  /**
523
526
  * Sends an address message to request shipping address from the user
524
527
  * 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
528
+ * @param params The address message parameter object
528
529
  * @returns Promise with the response
529
530
  */
530
- interactiveAddressMessage(body: InteractiveObject & {
531
- type: 'address_message';
532
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
531
+ interactiveAddressMessage(params: MessageRequestParams<InteractiveObject & {
532
+ type: InteractiveTypesEnum.AddressMessage;
533
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
533
534
  /**
534
535
  * 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
536
+ * @param params The reply buttons message parameter object
538
537
  * @returns Promise with the response
539
538
  */
540
- interactiveReplyButtons(body: InteractiveObject & {
541
- type: 'button';
542
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
539
+ interactiveReplyButtons(params: MessageRequestParams<InteractiveObject & {
540
+ type: InteractiveTypesEnum.Button;
541
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
543
542
  /**
544
543
  * 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
544
+ * @param params The reaction message parameter object
548
545
  * @returns Promise with the response
549
546
  */
550
- reaction(messageId: string, emoji: string, to: string): Promise<RequesterResponseInterface<MessagesResponse>>;
547
+ reaction(params: ReactionParams): Promise<RequesterResponseInterface<MessagesResponse>>;
551
548
  /**
552
549
  * 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
550
+ * @param params The Flow message parameter object
556
551
  * @returns Promise with the response
557
552
  */
558
- interactiveFlow(body: InteractiveObject & {
559
- type: 'flow';
560
- }, to: string, replyMessageId?: string): Promise<RequesterResponseInterface<MessagesResponse>>;
553
+ interactiveFlow(params: MessageRequestParams<InteractiveObject & {
554
+ type: InteractiveTypesEnum.Flow;
555
+ }>): Promise<RequesterResponseInterface<MessagesResponse>>;
561
556
  }
562
557
 
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 };
558
+ 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