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.
- package/dist/api/index.js +1 -1
- package/dist/api/index.js.map +1 -1
- package/dist/api/index.mjs +1 -1
- package/dist/api/index.mjs.map +1 -1
- package/dist/api/messages.d.mts +73 -83
- package/dist/api/messages.d.ts +73 -83
- package/dist/api/messages.js +1 -1
- package/dist/api/messages.js.map +1 -1
- package/dist/api/messages.mjs +1 -1
- package/dist/api/messages.mjs.map +1 -1
- package/dist/index.d.mts +1 -1
- package/dist/index.d.ts +1 -1
- package/dist/index.js +1 -1
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +1 -1
- package/dist/index.mjs.map +1 -1
- package/dist/types/index.d.mts +1 -1
- package/dist/types/index.d.ts +1 -1
- package/dist/types/messages.d.mts +87 -92
- package/dist/types/messages.d.ts +87 -92
- package/dist/types/messages.js +1 -1
- package/dist/types/messages.js.map +1 -1
- package/dist/whatsapp.js +1 -1
- package/dist/whatsapp.js.map +1 -1
- package/dist/whatsapp.mjs +1 -1
- package/dist/whatsapp.mjs.map +1 -1
- package/package.json +1 -1
package/dist/types/index.d.mts
CHANGED
|
@@ -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';
|
package/dist/types/index.d.ts
CHANGED
|
@@ -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
|
-
|
|
263
|
+
flow_message_version: string;
|
|
264
264
|
flow_id?: string;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
mode?: '
|
|
268
|
-
|
|
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
|
|
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(
|
|
424
|
+
audio(params: MessageRequestParams<AudioMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
402
425
|
/**
|
|
403
426
|
* Sends a contact card via WhatsApp
|
|
404
|
-
* @param
|
|
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(
|
|
430
|
+
contacts(params: MessageRequestParams<[ContactObject]>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
410
431
|
/**
|
|
411
432
|
* Sends a document via WhatsApp
|
|
412
|
-
* @param
|
|
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(
|
|
436
|
+
document(params: MessageRequestParams<DocumentMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
418
437
|
/**
|
|
419
438
|
* Sends an image via WhatsApp
|
|
420
|
-
* @param
|
|
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(
|
|
442
|
+
image(params: MessageRequestParams<ImageMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
426
443
|
/**
|
|
427
444
|
* Sends an interactive message via WhatsApp
|
|
428
|
-
* @param
|
|
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(
|
|
448
|
+
interactive(params: MessageRequestParams<InteractiveObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
434
449
|
/**
|
|
435
450
|
* Sends a location via WhatsApp
|
|
436
|
-
* @param
|
|
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(
|
|
454
|
+
location(params: MessageRequestParams<LocationObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
442
455
|
/**
|
|
443
456
|
* Updates message status (used for read receipts and typing indicators)
|
|
444
|
-
* @param
|
|
457
|
+
* @param params The status update parameter object
|
|
445
458
|
* @returns Promise with the response
|
|
446
459
|
*/
|
|
447
|
-
status(
|
|
460
|
+
status(params: StatusParams): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
448
461
|
/**
|
|
449
462
|
* Sends a sticker via WhatsApp
|
|
450
|
-
* @param
|
|
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(
|
|
466
|
+
sticker(params: MessageRequestParams<StickerMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
456
467
|
/**
|
|
457
468
|
* Sends a template message via WhatsApp
|
|
458
|
-
* @param
|
|
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(
|
|
472
|
+
template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
464
473
|
/**
|
|
465
474
|
* Sends a text message via WhatsApp
|
|
466
|
-
* @param
|
|
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(
|
|
478
|
+
text(params: TextMessageParams): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
472
479
|
/**
|
|
473
480
|
* Sends a video via WhatsApp
|
|
474
|
-
* @param
|
|
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(
|
|
484
|
+
video(params: MessageRequestParams<VideoMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
480
485
|
/**
|
|
481
486
|
* Marks a message as read in WhatsApp
|
|
482
|
-
* @param
|
|
487
|
+
* @param params The parameter object to mark message as read
|
|
483
488
|
* @returns Promise with the response
|
|
484
489
|
*/
|
|
485
|
-
markAsRead(
|
|
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
|
|
495
|
+
* @param params The typing indicator parameter object
|
|
489
496
|
* @returns Promise with the response
|
|
490
497
|
*/
|
|
491
|
-
showTypingIndicator(
|
|
498
|
+
showTypingIndicator(params: {
|
|
499
|
+
messageId: string;
|
|
500
|
+
}): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
492
501
|
/**
|
|
493
502
|
* Sends an interactive list message
|
|
494
|
-
* @param
|
|
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(
|
|
500
|
-
type:
|
|
501
|
-
}
|
|
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
|
|
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(
|
|
510
|
-
type:
|
|
511
|
-
}
|
|
514
|
+
interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
|
|
515
|
+
type: InteractiveTypesEnum.CtaUrl;
|
|
516
|
+
}>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
512
517
|
/**
|
|
513
518
|
* Sends a location request message
|
|
514
|
-
* @param
|
|
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(
|
|
520
|
-
type:
|
|
521
|
-
}
|
|
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
|
|
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(
|
|
531
|
-
type:
|
|
532
|
-
}
|
|
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
|
|
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(
|
|
541
|
-
type:
|
|
542
|
-
}
|
|
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
|
|
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(
|
|
547
|
+
reaction(params: ReactionParams): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
551
548
|
/**
|
|
552
549
|
* Sends an interactive Flow message
|
|
553
|
-
* @param
|
|
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(
|
|
559
|
-
type:
|
|
560
|
-
}
|
|
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 };
|
package/dist/types/messages.d.ts
CHANGED
|
@@ -260,12 +260,17 @@ type AddressMessageInteractiveObject = {
|
|
|
260
260
|
action: AddressMessageActionObject;
|
|
261
261
|
};
|
|
262
262
|
type FlowParameters = {
|
|
263
|
-
|
|
263
|
+
flow_message_version: string;
|
|
264
264
|
flow_id?: string;
|
|
265
|
-
|
|
266
|
-
|
|
267
|
-
mode?: '
|
|
268
|
-
|
|
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
|
|
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(
|
|
424
|
+
audio(params: MessageRequestParams<AudioMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
402
425
|
/**
|
|
403
426
|
* Sends a contact card via WhatsApp
|
|
404
|
-
* @param
|
|
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(
|
|
430
|
+
contacts(params: MessageRequestParams<[ContactObject]>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
410
431
|
/**
|
|
411
432
|
* Sends a document via WhatsApp
|
|
412
|
-
* @param
|
|
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(
|
|
436
|
+
document(params: MessageRequestParams<DocumentMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
418
437
|
/**
|
|
419
438
|
* Sends an image via WhatsApp
|
|
420
|
-
* @param
|
|
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(
|
|
442
|
+
image(params: MessageRequestParams<ImageMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
426
443
|
/**
|
|
427
444
|
* Sends an interactive message via WhatsApp
|
|
428
|
-
* @param
|
|
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(
|
|
448
|
+
interactive(params: MessageRequestParams<InteractiveObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
434
449
|
/**
|
|
435
450
|
* Sends a location via WhatsApp
|
|
436
|
-
* @param
|
|
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(
|
|
454
|
+
location(params: MessageRequestParams<LocationObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
442
455
|
/**
|
|
443
456
|
* Updates message status (used for read receipts and typing indicators)
|
|
444
|
-
* @param
|
|
457
|
+
* @param params The status update parameter object
|
|
445
458
|
* @returns Promise with the response
|
|
446
459
|
*/
|
|
447
|
-
status(
|
|
460
|
+
status(params: StatusParams): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
448
461
|
/**
|
|
449
462
|
* Sends a sticker via WhatsApp
|
|
450
|
-
* @param
|
|
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(
|
|
466
|
+
sticker(params: MessageRequestParams<StickerMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
456
467
|
/**
|
|
457
468
|
* Sends a template message via WhatsApp
|
|
458
|
-
* @param
|
|
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(
|
|
472
|
+
template(params: MessageRequestParams<MessageTemplateObject<ComponentTypesEnum>>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
464
473
|
/**
|
|
465
474
|
* Sends a text message via WhatsApp
|
|
466
|
-
* @param
|
|
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(
|
|
478
|
+
text(params: TextMessageParams): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
472
479
|
/**
|
|
473
480
|
* Sends a video via WhatsApp
|
|
474
|
-
* @param
|
|
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(
|
|
484
|
+
video(params: MessageRequestParams<VideoMediaObject>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
480
485
|
/**
|
|
481
486
|
* Marks a message as read in WhatsApp
|
|
482
|
-
* @param
|
|
487
|
+
* @param params The parameter object to mark message as read
|
|
483
488
|
* @returns Promise with the response
|
|
484
489
|
*/
|
|
485
|
-
markAsRead(
|
|
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
|
|
495
|
+
* @param params The typing indicator parameter object
|
|
489
496
|
* @returns Promise with the response
|
|
490
497
|
*/
|
|
491
|
-
showTypingIndicator(
|
|
498
|
+
showTypingIndicator(params: {
|
|
499
|
+
messageId: string;
|
|
500
|
+
}): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
492
501
|
/**
|
|
493
502
|
* Sends an interactive list message
|
|
494
|
-
* @param
|
|
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(
|
|
500
|
-
type:
|
|
501
|
-
}
|
|
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
|
|
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(
|
|
510
|
-
type:
|
|
511
|
-
}
|
|
514
|
+
interactiveCtaUrl(params: MessageRequestParams<InteractiveObject & {
|
|
515
|
+
type: InteractiveTypesEnum.CtaUrl;
|
|
516
|
+
}>): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
512
517
|
/**
|
|
513
518
|
* Sends a location request message
|
|
514
|
-
* @param
|
|
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(
|
|
520
|
-
type:
|
|
521
|
-
}
|
|
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
|
|
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(
|
|
531
|
-
type:
|
|
532
|
-
}
|
|
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
|
|
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(
|
|
541
|
-
type:
|
|
542
|
-
}
|
|
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
|
|
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(
|
|
547
|
+
reaction(params: ReactionParams): Promise<RequesterResponseInterface<MessagesResponse>>;
|
|
551
548
|
/**
|
|
552
549
|
* Sends an interactive Flow message
|
|
553
|
-
* @param
|
|
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(
|
|
559
|
-
type:
|
|
560
|
-
}
|
|
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 };
|
package/dist/types/messages.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
"use strict";var
|
|
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
|