@raphaelvserafim/client-api-whatsapp 1.3.0 → 1.5.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -106,7 +106,6 @@ await wa.instance.addMongoDb("mongodb+srv://...", "mydb");
106
106
  await wa.instance.mobileRegisterPrepare({
107
107
  phoneNumberCountryCode: "55",
108
108
  phoneNumberNationalNumber: "99999999999",
109
- phoneNumberMobileCountryCode: "724",
110
109
  phoneNumberMobileNetworkCode: "11",
111
110
  });
112
111
  await wa.instance.mobileRequestCode("sms");
@@ -374,6 +373,37 @@ await wa.message.forward(to, "MESSAGE_ID");
374
373
  const messages = await wa.message.list("559999999999", 1, 20);
375
374
  ```
376
375
 
376
+ ### Additional Message Methods
377
+
378
+ ```ts
379
+ // Unpin message
380
+ await wa.message.unpin("MESSAGE_ID");
381
+
382
+ // Send multiple contacts
383
+ await wa.message.sendContacts({ to, displayName: "My Contacts", contacts: [{ fullName: "Name", phoneNumber: "559999999999" }] });
384
+
385
+ // Send live location
386
+ await wa.message.sendLiveLocation({ to, latitude: 37.7749, longitude: -122.4194, caption: "I'm here" });
387
+
388
+ // Get message details
389
+ await wa.message.getDetails("MESSAGE_ID");
390
+
391
+ // Get message media
392
+ await wa.message.getMedia("MESSAGE_ID", "base64");
393
+
394
+ // Send product message
395
+ await wa.message.sendProduct({ to, businessOwnerJid: "559999999999@s.whatsapp.net", productId: "product_id", catalogId: "catalog_id" });
396
+
397
+ // Send group invite
398
+ await wa.message.sendGroupInvite({ to, groupJid: "123456789@g.us", groupName: "Developers", inviteCode: "ABC123" });
399
+
400
+ // Request phone number
401
+ await wa.message.requestPhone(to);
402
+
403
+ // Create call link (without sending)
404
+ await wa.message.createCallLink("video");
405
+ ```
406
+
377
407
  ## Chat
378
408
 
379
409
  ```ts
@@ -391,6 +421,15 @@ await wa.chat.modify("559999999999@s.whatsapp.net", "pin", true);
391
421
 
392
422
  // Delete chat
393
423
  await wa.chat.delete("559999999999@s.whatsapp.net");
424
+
425
+ // Subscribe to presence updates
426
+ await wa.chat.presenceSubscribe("559999999999@s.whatsapp.net");
427
+
428
+ // Set disappearing messages
429
+ await wa.chat.disappearing("559999999999@s.whatsapp.net", 86400);
430
+
431
+ // Get privacy settings
432
+ const privacy = await wa.chat.privacy();
394
433
  ```
395
434
 
396
435
  ## Call
@@ -402,6 +441,12 @@ await wa.call.call(to, true); // video
402
441
 
403
442
  // Reject a call
404
443
  await wa.call.reject("CALL_ID", "559999999999@s.whatsapp.net");
444
+
445
+ // Accept a call
446
+ await wa.call.accept("CALL_ID", "559999999999@s.whatsapp.net");
447
+
448
+ // End a call
449
+ await wa.call.end("CALL_ID", "559999999999@s.whatsapp.net");
405
450
  ```
406
451
 
407
452
  ## Labels
@@ -421,6 +466,9 @@ const labeled = await wa.label.getChats("label_id");
421
466
 
422
467
  // Remove label from chat
423
468
  await wa.label.removeFromChat("label_id", to);
469
+
470
+ // Delete label
471
+ await wa.label.delete("label_id");
424
472
  ```
425
473
 
426
474
  ## Contacts
@@ -438,6 +486,24 @@ await wa.contact.block("559999999999", "unblock");
438
486
 
439
487
  // Check if registered on WhatsApp
440
488
  const check = await wa.action.checkRegistered("559999999999");
489
+
490
+ // Add contact
491
+ await wa.contact.add("559999999999", "Raphael");
492
+
493
+ // Remove contact
494
+ await wa.contact.remove("559999999999");
495
+
496
+ // Clear contact session
497
+ await wa.contact.clearSession("559999999999");
498
+
499
+ // Get contact status
500
+ await wa.contact.getStatus("559999999999");
501
+
502
+ // List blocked contacts
503
+ const blocked = await wa.contact.listBlocked();
504
+
505
+ // Resolve LIDs
506
+ await wa.contact.resolveLids(["lid1", "lid2"]);
441
507
  ```
442
508
 
443
509
  ## Groups
@@ -483,6 +549,12 @@ await wa.group.updateRequestParticipants("123456789@g.us", {
483
549
 
484
550
  // Leave group
485
551
  await wa.group.leave("123456789@g.us");
552
+
553
+ // Get group members
554
+ const members = await wa.group.getMembers("123456789@g.us");
555
+
556
+ // Get invite info from code
557
+ const inviteInfo = await wa.group.getInviteInfo("INVITE_CODE");
486
558
  ```
487
559
 
488
560
  ## Community
@@ -516,6 +588,27 @@ await wa.community.updateRequestParticipants("community_id", {
516
588
 
517
589
  // Leave community
518
590
  await wa.community.leave("community_id");
591
+
592
+ // Accept invite
593
+ await wa.community.acceptInvite("INVITE_CODE");
594
+
595
+ // Get invite info
596
+ await wa.community.getInviteInfo("INVITE_CODE");
597
+
598
+ // Create group inside community
599
+ await wa.community.createGroup("community_id", { subject: "New Group", participants: ["559999999999"] });
600
+
601
+ // Set ephemeral messages
602
+ await wa.community.ephemeral("community_id", 86400);
603
+
604
+ // Update community settings
605
+ await wa.community.updateSettings("community_id", "announcement");
606
+
607
+ // Set member add mode
608
+ await wa.community.memberAddMode("community_id", "admin_add");
609
+
610
+ // Set join approval mode
611
+ await wa.community.joinApproval("community_id", "on");
519
612
  ```
520
613
 
521
614
  ## Business
@@ -545,6 +638,66 @@ await wa.business.updateProduct("product_id", {
545
638
  await wa.business.deleteProduct("product_id");
546
639
  ```
547
640
 
641
+ ## Newsletter
642
+
643
+ ```ts
644
+ // Create a newsletter
645
+ await wa.newsletter.create("My Newsletter", "Description");
646
+
647
+ // Get metadata
648
+ await wa.newsletter.getMetadata("type", "newsletter_id");
649
+
650
+ // Get subscribers & admins
651
+ await wa.newsletter.getSubscribers("newsletter_id");
652
+ await wa.newsletter.getAdmins("newsletter_id");
653
+
654
+ // Follow / Unfollow
655
+ await wa.newsletter.follow("newsletter_id");
656
+ await wa.newsletter.unfollow("newsletter_id");
657
+
658
+ // Update
659
+ await wa.newsletter.updateName("newsletter_id", "New Name");
660
+ await wa.newsletter.updateDescription("newsletter_id", "New description");
661
+ await wa.newsletter.updatePicture("newsletter_id", "https://example.com/pic.jpg");
662
+ await wa.newsletter.removePicture("newsletter_id");
663
+
664
+ // Transfer ownership & demote admin
665
+ await wa.newsletter.transferOwnership("newsletter_id", "new_owner_jid");
666
+ await wa.newsletter.demoteAdmin("newsletter_id", "user_jid");
667
+
668
+ // Messages
669
+ await wa.newsletter.getMessages("newsletter_id", 10);
670
+
671
+ // React to a message
672
+ await wa.newsletter.react("newsletter_id", "server_id", "👍");
673
+
674
+ // Mute / Unmute
675
+ await wa.newsletter.mute("newsletter_id");
676
+ await wa.newsletter.unmute("newsletter_id");
677
+
678
+ // Delete
679
+ await wa.newsletter.delete("newsletter_id");
680
+ ```
681
+
682
+ ## Status
683
+
684
+ ```ts
685
+ // Text status
686
+ await wa.status.sendText({ text: "Hello World!", statusJidList: ["559999999999@s.whatsapp.net"] });
687
+
688
+ // Image status
689
+ await wa.status.sendImage({ url: "https://example.com/image.jpg", caption: "My photo", statusJidList: ["559999999999@s.whatsapp.net"] });
690
+
691
+ // Video status
692
+ await wa.status.sendVideo({ url: "https://example.com/video.mp4", caption: "My video" });
693
+
694
+ // Audio status
695
+ await wa.status.sendAudio({ url: "https://example.com/audio.mp3" });
696
+
697
+ // Mention a status
698
+ await wa.status.mention({ jid: "559999999999@s.whatsapp.net", statusMsgId: "STATUS_MSG_ID" });
699
+ ```
700
+
548
701
  ## Actions
549
702
 
550
703
  ```ts
@@ -91,33 +91,43 @@ export interface InfoInstance {
91
91
  status: number;
92
92
  instance: Instance;
93
93
  }
94
- export interface Instance {
95
- receive_status_message: boolean;
96
- save_media: boolean;
97
- receive_presence: boolean;
94
+ export interface IInstanceConfig {
95
+ markMessages: boolean;
96
+ receiveStatusMessage: boolean;
97
+ receivePresence: boolean;
98
+ saveMedia: boolean;
98
99
  permission: number;
99
- mark_messages: boolean;
100
- blocked: boolean;
101
- user?: User;
100
+ proxy: string | null;
101
+ mongoDB: {
102
+ uri: string | null;
103
+ dbName: string | null;
104
+ };
105
+ }
106
+ export interface Instance {
107
+ mobile: boolean;
108
+ socketConnection: number;
109
+ user: User;
102
110
  phoneConnected: boolean;
111
+ status: string;
103
112
  webhook: Webhook;
104
- businessProfile?: BusinessProfile;
113
+ config: IInstanceConfig;
114
+ businessProfile: BusinessProfile;
105
115
  }
106
116
  export interface User {
107
- id?: string;
108
- lid?: string;
109
- name?: string;
110
- imageProfile?: string;
117
+ id: string;
118
+ name: string;
119
+ lid: string;
120
+ imageProfile: string;
111
121
  }
112
122
  export interface Webhook {
113
123
  allowWebhook: boolean;
114
- allowNumber?: string;
124
+ allowNumber: string;
115
125
  webhookMessage: string;
116
- webhookGroup: string;
117
126
  webhookConnection: string;
118
- webhookQrCode: string;
119
- webhookMessageFromMe: string;
127
+ webhookGroup: string;
120
128
  webhookHistory: string;
129
+ webhookMessageFromMe: string;
130
+ webhookQrCode: string;
121
131
  }
122
132
  export interface SendMessageRoot {
123
133
  status: number;
@@ -154,9 +164,10 @@ export interface PairingCodeResponse {
154
164
  export interface BusinessProfile {
155
165
  wid: string;
156
166
  description: string;
157
- website: string[];
167
+ address: string;
168
+ email: string;
169
+ website: any[];
158
170
  category: string;
159
- business_hours: Record<string, unknown>;
160
171
  }
161
172
  export interface Buttons {
162
173
  type: "quick_reply" | "cta_copy" | "cta_url" | "cta_call";
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAKA,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,+BAAiB,CAAA;IACjB,6BAAe,CAAA;AACjB,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB;AAGD,IAAY,MAaX;AAbD,WAAY,MAAM;IAChB,gCAAsB,CAAA;IACtB,8BAAoB,CAAA;IACpB,+BAAqB,CAAA;IACrB,2BAAiB,CAAA;IACjB,6BAAmB,CAAA;IACnB,uBAAa,CAAA;IACb,uBAAa,CAAA;IACb,2BAAiB,CAAA;IACjB,iCAAuB,CAAA;IACvB,+BAAqB,CAAA;IACrB,mCAAyB,CAAA;IACzB,2BAAiB,CAAA;AACnB,CAAC,EAbW,MAAM,sBAAN,MAAM,QAajB;AAGD,IAAY,WAuBX;AAvBD,WAAY,WAAW;IACrB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,4CAA6B,CAAA;IAC7B,8CAA+B,CAAA;IAC/B,iCAAkB,CAAA;IAClB,8BAAe,CAAA;IACf,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,+BAAgB,CAAA;IAChB,8BAAe,CAAA;IACf,0BAAW,CAAA;IACX,sCAAuB,CAAA;AACzB,CAAC,EAvBW,WAAW,2BAAX,WAAW,QAuBtB;AAGD,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,6CAA2B,CAAA;IAC3B,yCAAuB,CAAA;IACvB,yCAAuB,CAAA;IACvB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EANW,cAAc,8BAAd,cAAc,QAMzB","sourcesContent":["export interface Init {\n server: string;\n key: string;\n}\n\nexport enum HttpMethod {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\n\nexport enum Routes {\n INSTANCES = 'instance',\n MESSAGES = 'message',\n CONTACTS = 'contacts',\n GROUPS = 'groups',\n ACTIONS = 'actions',\n CALL = 'call',\n CHAT = 'chat',\n LABELS = 'labels',\n COMMUNITY = 'community',\n BUSINESS = 'business',\n NEWSLETTER = 'newsletter',\n STATUS = 'status',\n}\n\n\nexport enum TypeMessage {\n PRESENCE = 'presence',\n TEXT = 'text',\n AUDIO = 'audio',\n IMAGE = 'image',\n VIDEO = 'video',\n DOCUMENT = 'document',\n CONTACT = 'contact',\n LOCATION = 'location',\n REACTION = 'reaction',\n LINK = 'link',\n TITLE = 'title',\n BUTTON_REPLY = 'button_reply',\n BUTTON_ACTION = 'button_action',\n BUTTON_PIX = 'pix',\n POLL = 'survey',\n MENU = 'list',\n STICKER = 'sticker',\n VIDEO_NOTE = 'video-note',\n POLL_V2 = 'poll',\n EVENT = 'event',\n PIN = 'pin',\n CALL_LINK = 'call-link',\n}\n\n\nexport enum StatusPresence {\n UNAVAILABLE = 'unavailable',\n AVAILABLE = 'available',\n COMPOSING = 'composing',\n RECORDING = 'recording',\n PAUSED = 'paused',\n}\n\n\nexport interface ApiResponse {\n status: number;\n message: string;\n}\n\n\nexport interface WebhookBody {\n allowWebhook: boolean;\n allowNumber?: string;\n webhookMessage: string;\n webhookGroup: string;\n webhookConnection: string;\n webhookQrCode: string;\n webhookMessageFromMe: string;\n webhookHistory: string;\n}\n\nexport interface Contact {\n fullName: string;\n phoneNumber: string;\n organization?: string;\n}\n\n\nexport interface Location {\n latitude: number;\n longitude: number;\n address: string;\n}\n\nexport interface Row {\n title: string;\n description: string;\n rowId: string;\n}\n\nexport interface Section {\n title: string;\n rows: Row[];\n}\n\n\n\nexport interface InfoInstance {\n status: number;\n instance: Instance;\n}\n\nexport interface Instance {\n receive_status_message: boolean;\n save_media: boolean;\n receive_presence: boolean;\n permission: number;\n mark_messages: boolean;\n blocked: boolean;\n user?: User;\n phoneConnected: boolean;\n webhook: Webhook;\n businessProfile?: BusinessProfile;\n}\n\nexport interface User {\n id?: string;\n lid?: string;\n name?: string;\n imageProfile?: string;\n}\n\nexport interface Webhook {\n allowWebhook: boolean;\n allowNumber?: string;\n webhookMessage: string;\n webhookGroup: string;\n webhookConnection: string;\n webhookQrCode: string;\n webhookMessageFromMe: string;\n webhookHistory: string;\n}\n\n\n\nexport interface SendMessageRoot {\n status: number;\n data: MessageData;\n}\n\nexport interface MessageData {\n key: MessageKey;\n message: MessageContent;\n messageTimestamp: string;\n status: string;\n}\n\nexport interface MessageKey {\n remoteJid: string;\n fromMe: boolean;\n id: string;\n}\n\nexport interface MessageContent {\n extendedTextMessage?: ExtendedTextMessage;\n}\n\nexport interface ExtendedTextMessage {\n text: string;\n}\n\nexport interface Connect {\n status: number;\n phoneConnected: boolean;\n qrcode: string;\n image: string;\n user?: User;\n}\n\n\nexport interface PairingCodeResponse {\n status: number;\n code: string;\n}\n\n\nexport interface BusinessProfile {\n wid: string;\n description: string;\n website: string[];\n category: string;\n business_hours: Record<string, unknown>;\n}\n\n\n\nexport interface Buttons {\n type: \"quick_reply\" | \"cta_copy\" | \"cta_url\" | \"cta_call\";\n copy_code?: string;\n phone_number?: string;\n url?: string;\n id?: string;\n text: string;\n}\n\n\nexport interface Items {\n id: string;\n name: string;\n price: number;\n quantity: number;\n}\n\n\nexport interface HeaderMedia {\n title?: string;\n hasMediaAttachment?: boolean;\n imageMessage?: { url: string };\n videoMessage?: { url: string };\n documentMessage?: { url: string; mimetype?: string; fileName?: string };\n}\n\n\nexport interface DownloadableMessage {\n mediaKey: string;\n directPath: string;\n url: string;\n}\n\n\nexport interface Product {\n name: string;\n description?: string;\n originCountryCode?: string;\n currency?: string;\n price?: number;\n images?: { url: string }[];\n}\n\n\nexport interface CommunityCreate {\n name: string;\n subject: string;\n}\n\nexport interface CommunityUpdate {\n subject: string;\n description: string;\n}\n\n\nexport interface GroupParticipantsAction {\n participants: string[];\n action: 'reject' | 'approve';\n}\n\n\nexport interface MobileRegisterData {\n phoneNumberCountryCode: string;\n phoneNumberNationalNumber: string;\n phoneNumberMobileNetworkCode: string;\n}\n\n\nexport interface EventData {\n to: string;\n name: string;\n description?: string;\n startTime?: string;\n locationName?: string;\n locationAddress?: string;\n}\n\n\nexport interface RegisteredResponse {\n status: number;\n registered: boolean;\n}\n\n\nexport interface ContactInfo {\n id: string;\n name?: string;\n notify?: string;\n imgUrl?: string;\n}\n\n\nexport interface GroupInfo {\n id: string;\n subject: string;\n owner: string;\n creation: number;\n desc?: string;\n participants: GroupParticipant[];\n}\n\nexport interface GroupParticipant {\n id: string;\n admin?: string;\n}\n\n\nexport interface InviteCodeResponse {\n status: number;\n inviteCode: string;\n}\n\n\nexport interface ChatInfo {\n id: string;\n name?: string;\n timestamp?: number;\n unreadCount?: number;\n}\n\n\nexport interface LabelInfo {\n id: string;\n name: string;\n color?: number;\n}\n\n\nexport interface CommunityInfo {\n id: string;\n name: string;\n subject?: string;\n description?: string;\n participants?: GroupParticipant[];\n}\n\n\nexport interface CatalogResponse {\n status: number;\n data: Product[];\n cursor?: string;\n}\n\n\nexport interface WebhookStatistics {\n status: number;\n data: Record<string, unknown>;\n}\n\n\nexport interface ListMessagesResponse {\n status: number;\n data: MessageData[];\n page?: number;\n limit?: number;\n total?: number;\n}\n\n\nexport interface DownloadMediaResponse {\n status: number;\n data: string;\n}\n\n\nexport interface CallResponse {\n status: number;\n data: Record<string, unknown>;\n}\n\n\nexport interface LiveLocationData {\n to: string;\n latitude: number;\n longitude: number;\n caption?: string;\n}\n\n\nexport interface SendContactsData {\n to: string;\n displayName: string;\n contacts: Contact[];\n}\n\n\nexport interface ProductMessageData {\n to: string;\n businessOwnerJid: string;\n productId: string;\n catalogId: string;\n body?: string;\n footer?: string;\n}\n\n\nexport interface GroupInviteMessageData {\n to: string;\n groupJid: string;\n groupName: string;\n inviteCode: string;\n inviteExpiration?: number;\n caption?: string;\n}\n\n\nexport interface StatusTextData {\n text: string;\n statusJidList?: string[];\n}\n\n\nexport interface StatusMediaData {\n url: string;\n caption?: string;\n statusJidList?: string[];\n}\n\n\nexport interface StatusMentionData {\n jid: string;\n statusMsgId: string;\n}\n\n\nexport interface NewsletterInfo {\n id: string;\n name?: string;\n description?: string;\n subscribers?: number;\n}\n\n\nexport interface CommunityGroupCreate {\n subject: string;\n participants?: string[];\n}\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../../src/types/index.ts"],"names":[],"mappings":";;;AAKA,IAAY,UAMX;AAND,WAAY,UAAU;IACpB,yBAAW,CAAA;IACX,2BAAa,CAAA;IACb,yBAAW,CAAA;IACX,+BAAiB,CAAA;IACjB,6BAAe,CAAA;AACjB,CAAC,EANW,UAAU,0BAAV,UAAU,QAMrB;AAGD,IAAY,MAaX;AAbD,WAAY,MAAM;IAChB,gCAAsB,CAAA;IACtB,8BAAoB,CAAA;IACpB,+BAAqB,CAAA;IACrB,2BAAiB,CAAA;IACjB,6BAAmB,CAAA;IACnB,uBAAa,CAAA;IACb,uBAAa,CAAA;IACb,2BAAiB,CAAA;IACjB,iCAAuB,CAAA;IACvB,+BAAqB,CAAA;IACrB,mCAAyB,CAAA;IACzB,2BAAiB,CAAA;AACnB,CAAC,EAbW,MAAM,sBAAN,MAAM,QAajB;AAGD,IAAY,WAuBX;AAvBD,WAAY,WAAW;IACrB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,8BAAe,CAAA;IACf,oCAAqB,CAAA;IACrB,kCAAmB,CAAA;IACnB,oCAAqB,CAAA;IACrB,oCAAqB,CAAA;IACrB,4BAAa,CAAA;IACb,8BAAe,CAAA;IACf,4CAA6B,CAAA;IAC7B,8CAA+B,CAAA;IAC/B,iCAAkB,CAAA;IAClB,8BAAe,CAAA;IACf,4BAAa,CAAA;IACb,kCAAmB,CAAA;IACnB,wCAAyB,CAAA;IACzB,+BAAgB,CAAA;IAChB,8BAAe,CAAA;IACf,0BAAW,CAAA;IACX,sCAAuB,CAAA;AACzB,CAAC,EAvBW,WAAW,2BAAX,WAAW,QAuBtB;AAGD,IAAY,cAMX;AAND,WAAY,cAAc;IACxB,6CAA2B,CAAA;IAC3B,yCAAuB,CAAA;IACvB,yCAAuB,CAAA;IACvB,yCAAuB,CAAA;IACvB,mCAAiB,CAAA;AACnB,CAAC,EANW,cAAc,8BAAd,cAAc,QAMzB","sourcesContent":["export interface Init {\n server: string;\n key: string;\n}\n\nexport enum HttpMethod {\n GET = 'GET',\n POST = 'POST',\n PUT = 'PUT',\n DELETE = 'DELETE',\n PATCH = 'PATCH',\n}\n\n\nexport enum Routes {\n INSTANCES = 'instance',\n MESSAGES = 'message',\n CONTACTS = 'contacts',\n GROUPS = 'groups',\n ACTIONS = 'actions',\n CALL = 'call',\n CHAT = 'chat',\n LABELS = 'labels',\n COMMUNITY = 'community',\n BUSINESS = 'business',\n NEWSLETTER = 'newsletter',\n STATUS = 'status',\n}\n\n\nexport enum TypeMessage {\n PRESENCE = 'presence',\n TEXT = 'text',\n AUDIO = 'audio',\n IMAGE = 'image',\n VIDEO = 'video',\n DOCUMENT = 'document',\n CONTACT = 'contact',\n LOCATION = 'location',\n REACTION = 'reaction',\n LINK = 'link',\n TITLE = 'title',\n BUTTON_REPLY = 'button_reply',\n BUTTON_ACTION = 'button_action',\n BUTTON_PIX = 'pix',\n POLL = 'survey',\n MENU = 'list',\n STICKER = 'sticker',\n VIDEO_NOTE = 'video-note',\n POLL_V2 = 'poll',\n EVENT = 'event',\n PIN = 'pin',\n CALL_LINK = 'call-link',\n}\n\n\nexport enum StatusPresence {\n UNAVAILABLE = 'unavailable',\n AVAILABLE = 'available',\n COMPOSING = 'composing',\n RECORDING = 'recording',\n PAUSED = 'paused',\n}\n\n\nexport interface ApiResponse {\n status: number;\n message: string;\n}\n\n\nexport interface WebhookBody {\n allowWebhook: boolean;\n allowNumber?: string;\n webhookMessage: string;\n webhookGroup: string;\n webhookConnection: string;\n webhookQrCode: string;\n webhookMessageFromMe: string;\n webhookHistory: string;\n}\n\nexport interface Contact {\n fullName: string;\n phoneNumber: string;\n organization?: string;\n}\n\n\nexport interface Location {\n latitude: number;\n longitude: number;\n address: string;\n}\n\nexport interface Row {\n title: string;\n description: string;\n rowId: string;\n}\n\nexport interface Section {\n title: string;\n rows: Row[];\n}\n\nexport interface InfoInstance {\n status: number;\n instance: Instance;\n}\n\nexport interface IInstanceConfig {\n markMessages: boolean\n receiveStatusMessage: boolean\n receivePresence: boolean\n saveMedia: boolean\n permission: number\n proxy: string | null\n mongoDB: {\n uri: string | null\n dbName: string | null\n }\n}\n\nexport interface Instance {\n mobile: boolean\n socketConnection: number\n user: User\n phoneConnected: boolean\n status: string\n webhook: Webhook\n config: IInstanceConfig\n businessProfile: BusinessProfile\n}\n\nexport interface User {\n id: string\n name: string\n lid: string\n imageProfile: string\n}\n\nexport interface Webhook {\n allowWebhook: boolean\n allowNumber: string\n webhookMessage: string\n webhookConnection: string\n webhookGroup: string\n webhookHistory: string\n webhookMessageFromMe: string\n webhookQrCode: string\n}\n\nexport interface SendMessageRoot {\n status: number;\n data: MessageData;\n}\n\nexport interface MessageData {\n key: MessageKey;\n message: MessageContent;\n messageTimestamp: string;\n status: string;\n}\n\nexport interface MessageKey {\n remoteJid: string;\n fromMe: boolean;\n id: string;\n}\n\nexport interface MessageContent {\n extendedTextMessage?: ExtendedTextMessage;\n}\n\nexport interface ExtendedTextMessage {\n text: string;\n}\n\nexport interface Connect {\n status: number;\n phoneConnected: boolean;\n qrcode: string;\n image: string;\n user?: User;\n}\n\n\nexport interface PairingCodeResponse {\n status: number;\n code: string;\n}\n\n\nexport interface BusinessProfile {\n wid: string\n description: string\n address: string\n email: string\n website: any[]\n category: string\n}\n\n\n\n\nexport interface Buttons {\n type: \"quick_reply\" | \"cta_copy\" | \"cta_url\" | \"cta_call\";\n copy_code?: string;\n phone_number?: string;\n url?: string;\n id?: string;\n text: string;\n}\n\n\nexport interface Items {\n id: string;\n name: string;\n price: number;\n quantity: number;\n}\n\n\nexport interface HeaderMedia {\n title?: string;\n hasMediaAttachment?: boolean;\n imageMessage?: { url: string };\n videoMessage?: { url: string };\n documentMessage?: { url: string; mimetype?: string; fileName?: string };\n}\n\n\nexport interface DownloadableMessage {\n mediaKey: string;\n directPath: string;\n url: string;\n}\n\n\nexport interface Product {\n name: string;\n description?: string;\n originCountryCode?: string;\n currency?: string;\n price?: number;\n images?: { url: string }[];\n}\n\n\nexport interface CommunityCreate {\n name: string;\n subject: string;\n}\n\nexport interface CommunityUpdate {\n subject: string;\n description: string;\n}\n\n\nexport interface GroupParticipantsAction {\n participants: string[];\n action: 'reject' | 'approve';\n}\n\n\nexport interface MobileRegisterData {\n phoneNumberCountryCode: string;\n phoneNumberNationalNumber: string;\n phoneNumberMobileNetworkCode: string;\n}\n\n\nexport interface EventData {\n to: string;\n name: string;\n description?: string;\n startTime?: string;\n locationName?: string;\n locationAddress?: string;\n}\n\n\nexport interface RegisteredResponse {\n status: number;\n registered: boolean;\n}\n\n\nexport interface ContactInfo {\n id: string;\n name?: string;\n notify?: string;\n imgUrl?: string;\n}\n\n\nexport interface GroupInfo {\n id: string;\n subject: string;\n owner: string;\n creation: number;\n desc?: string;\n participants: GroupParticipant[];\n}\n\nexport interface GroupParticipant {\n id: string;\n admin?: string;\n}\n\n\nexport interface InviteCodeResponse {\n status: number;\n inviteCode: string;\n}\n\n\nexport interface ChatInfo {\n id: string;\n name?: string;\n timestamp?: number;\n unreadCount?: number;\n}\n\n\nexport interface LabelInfo {\n id: string;\n name: string;\n color?: number;\n}\n\n\nexport interface CommunityInfo {\n id: string;\n name: string;\n subject?: string;\n description?: string;\n participants?: GroupParticipant[];\n}\n\n\nexport interface CatalogResponse {\n status: number;\n data: Product[];\n cursor?: string;\n}\n\n\nexport interface WebhookStatistics {\n status: number;\n data: Record<string, unknown>;\n}\n\n\nexport interface ListMessagesResponse {\n status: number;\n data: MessageData[];\n page?: number;\n limit?: number;\n total?: number;\n}\n\n\nexport interface DownloadMediaResponse {\n status: number;\n data: string;\n}\n\n\nexport interface CallResponse {\n status: number;\n data: Record<string, unknown>;\n}\n\n\nexport interface LiveLocationData {\n to: string;\n latitude: number;\n longitude: number;\n caption?: string;\n}\n\n\nexport interface SendContactsData {\n to: string;\n displayName: string;\n contacts: Contact[];\n}\n\n\nexport interface ProductMessageData {\n to: string;\n businessOwnerJid: string;\n productId: string;\n catalogId: string;\n body?: string;\n footer?: string;\n}\n\n\nexport interface GroupInviteMessageData {\n to: string;\n groupJid: string;\n groupName: string;\n inviteCode: string;\n inviteExpiration?: number;\n caption?: string;\n}\n\n\nexport interface StatusTextData {\n text: string;\n statusJidList?: string[];\n}\n\n\nexport interface StatusMediaData {\n url: string;\n caption?: string;\n statusJidList?: string[];\n}\n\n\nexport interface StatusMentionData {\n jid: string;\n statusMsgId: string;\n}\n\n\nexport interface NewsletterInfo {\n id: string;\n name?: string;\n description?: string;\n subscribers?: number;\n}\n\n\nexport interface CommunityGroupCreate {\n subject: string;\n participants?: string[];\n}\n"]}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@raphaelvserafim/client-api-whatsapp",
3
- "version": "1.3.0",
3
+ "version": "1.5.0",
4
4
  "description": "With our API, you can send text, audio, video, and image messages quickly and easily. Adapt to your business communication needs comprehensively.",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -21,6 +21,7 @@
21
21
  "scripts": {
22
22
  "build": "tsc --project tsconfig.compile.json",
23
23
  "test": "echo \"Error: no test specified\" && exit 1",
24
+ "generate:llms": "node scripts/generate-llms-txt.js",
24
25
  "deploy": "npm run build && npm publish --access=public"
25
26
  },
26
27
  "author": "Raphael Serafim <raphaelvserafim@gmail.com>",