@raphaelvserafim/client-api-whatsapp 1.2.0 → 1.4.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.
Files changed (41) hide show
  1. package/README.md +154 -1
  2. package/dist/WhatsApp.d.ts +40 -2
  3. package/dist/WhatsApp.js +36 -1
  4. package/dist/WhatsApp.js.map +1 -1
  5. package/dist/index.d.ts +3 -1
  6. package/dist/index.js +5 -1
  7. package/dist/index.js.map +1 -1
  8. package/dist/services/CallService.d.ts +2 -0
  9. package/dist/services/CallService.js +14 -0
  10. package/dist/services/CallService.js.map +1 -1
  11. package/dist/services/ChatService.d.ts +4 -1
  12. package/dist/services/ChatService.js +27 -2
  13. package/dist/services/ChatService.js.map +1 -1
  14. package/dist/services/CommunityService.d.ts +8 -1
  15. package/dist/services/CommunityService.js +49 -0
  16. package/dist/services/CommunityService.js.map +1 -1
  17. package/dist/services/ContactService.d.ts +6 -0
  18. package/dist/services/ContactService.js +38 -0
  19. package/dist/services/ContactService.js.map +1 -1
  20. package/dist/services/GroupService.d.ts +5 -0
  21. package/dist/services/GroupService.js +13 -0
  22. package/dist/services/GroupService.js.map +1 -1
  23. package/dist/services/InstanceService.d.ts +1 -0
  24. package/dist/services/InstanceService.js +6 -0
  25. package/dist/services/InstanceService.js.map +1 -1
  26. package/dist/services/LabelService.d.ts +1 -0
  27. package/dist/services/LabelService.js +7 -1
  28. package/dist/services/LabelService.js.map +1 -1
  29. package/dist/services/MessageService.d.ts +10 -1
  30. package/dist/services/MessageService.js +65 -0
  31. package/dist/services/MessageService.js.map +1 -1
  32. package/dist/services/NewsletterService.d.ts +23 -0
  33. package/dist/services/NewsletterService.js +129 -0
  34. package/dist/services/NewsletterService.js.map +1 -0
  35. package/dist/services/StatusService.d.ts +14 -0
  36. package/dist/services/StatusService.js +46 -0
  37. package/dist/services/StatusService.js.map +1 -0
  38. package/dist/types/index.d.ts +53 -2
  39. package/dist/types/index.js +2 -0
  40. package/dist/types/index.js.map +1 -1
  41. package/package.json +2 -1
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
@@ -1,4 +1,4 @@
1
- import { Init, WebhookBody, TypeMessage, StatusPresence, Contact, Section, Location, Buttons, Items, HeaderMedia, DownloadableMessage, Product, CommunityCreate, CommunityUpdate, GroupParticipantsAction, ApiResponse, PairingCodeResponse, MobileRegisterData, EventData, InfoInstance, SendMessageRoot, Connect, RegisteredResponse, ContactInfo, GroupInfo, InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse, DownloadMediaResponse, CallResponse, MessageData, GroupParticipant } from './types';
1
+ import { Init, WebhookBody, TypeMessage, StatusPresence, Contact, Section, Location, Buttons, Items, HeaderMedia, DownloadableMessage, Product, CommunityCreate, CommunityUpdate, GroupParticipantsAction, ApiResponse, PairingCodeResponse, MobileRegisterData, EventData, InfoInstance, SendMessageRoot, Connect, RegisteredResponse, ContactInfo, GroupInfo, InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse, DownloadMediaResponse, CallResponse, MessageData, GroupParticipant, LiveLocationData, SendContactsData, ProductMessageData, GroupInviteMessageData, CommunityGroupCreate } from './types';
2
2
  import { IHttpClient } from './client/IHttpClient';
3
3
  import { InstanceService } from './services/InstanceService';
4
4
  import { MessageService } from './services/MessageService';
@@ -10,6 +10,8 @@ import { ContactService } from './services/ContactService';
10
10
  import { GroupService } from './services/GroupService';
11
11
  import { CommunityService } from './services/CommunityService';
12
12
  import { BusinessService } from './services/BusinessService';
13
+ import { NewsletterService } from './services/NewsletterService';
14
+ import { StatusService } from './services/StatusService';
13
15
  export declare class WhatsApp {
14
16
  readonly instance: InstanceService;
15
17
  readonly message: MessageService;
@@ -21,6 +23,8 @@ export declare class WhatsApp {
21
23
  readonly group: GroupService;
22
24
  readonly community: CommunityService;
23
25
  readonly business: BusinessService;
26
+ readonly newsletter: NewsletterService;
27
+ readonly status: StatusService;
24
28
  constructor(data: Init, httpClient?: IHttpClient);
25
29
  connect(): Promise<Connect>;
26
30
  info(): Promise<InfoInstance>;
@@ -35,6 +39,7 @@ export declare class WhatsApp {
35
39
  pairingCode(phoneNumber: string): Promise<PairingCodeResponse>;
36
40
  addMongoDb(uri: string, dbName: string): Promise<ApiResponse>;
37
41
  setProxy(proxy: string): Promise<ApiResponse>;
42
+ resync(): Promise<ApiResponse>;
38
43
  restart(): Promise<ApiResponse>;
39
44
  updateProfileStatus(text: string): Promise<ApiResponse>;
40
45
  updateProfilePicture(url: string): Promise<ApiResponse>;
@@ -85,22 +90,36 @@ export declare class WhatsApp {
85
90
  sendPoll(to: string, name: string, values: Array<string | number | boolean>, selectableCount?: number): Promise<SendMessageRoot>;
86
91
  sendEvent(data: EventData): Promise<SendMessageRoot>;
87
92
  pinMessage(id: string, duration?: number): Promise<ApiResponse>;
93
+ unpinMessage(id: string): Promise<ApiResponse>;
88
94
  sendCallLink(to: string, type: string, caption?: string): Promise<SendMessageRoot>;
89
95
  sendImageBase64(to: string, base64: string, caption?: string): Promise<SendMessageRoot>;
90
96
  sendAudioBase64(to: string, base64: string): Promise<SendMessageRoot>;
91
97
  sendDocumentBase64(to: string, base64: string, mimetype: string, fileName?: string, caption?: string): Promise<SendMessageRoot>;
98
+ sendContacts(data: SendContactsData): Promise<SendMessageRoot>;
99
+ sendLiveLocation(data: LiveLocationData): Promise<SendMessageRoot>;
100
+ getMessageDetails(messageId: string): Promise<ApiResponse>;
101
+ getMessageMedia(messageId: string, format?: string): Promise<ApiResponse>;
102
+ sendProduct(data: ProductMessageData): Promise<SendMessageRoot>;
103
+ sendGroupInvite(data: GroupInviteMessageData): Promise<SendMessageRoot>;
104
+ requestPhone(to: string): Promise<ApiResponse>;
105
+ createCallLink(type: string): Promise<ApiResponse>;
92
106
  getChats(): Promise<{
93
107
  status: number;
94
108
  data: ChatInfo[];
95
109
  }>;
96
110
  modifyChat(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse>;
97
111
  deleteChat(chatId: string): Promise<ApiResponse>;
98
- getChatMessages(chatId: string): Promise<{
112
+ getChatMessages(chatId: string, page?: number, limit?: number): Promise<{
99
113
  status: number;
100
114
  data: MessageData[];
101
115
  }>;
116
+ presenceSubscribe(jid: string): Promise<ApiResponse>;
117
+ setDisappearing(jid: string, expiration: number): Promise<ApiResponse>;
118
+ getPrivacy(): Promise<ApiResponse>;
102
119
  makeCall(to: string, isVideo?: boolean): Promise<CallResponse>;
103
120
  rejectCall(id: string, from: string): Promise<ApiResponse>;
121
+ acceptCall(callId: string, callFrom: string): Promise<ApiResponse>;
122
+ endCall(callId: string, peerJid: string): Promise<ApiResponse>;
104
123
  getLabels(): Promise<{
105
124
  status: number;
106
125
  data: LabelInfo[];
@@ -111,6 +130,7 @@ export declare class WhatsApp {
111
130
  data: ChatInfo[];
112
131
  }>;
113
132
  addChatLabel(labelId: string, to: string): Promise<ApiResponse>;
133
+ deleteLabel(labelId: string): Promise<ApiResponse>;
114
134
  removeChatLabel(labelId: string, to: string): Promise<ApiResponse>;
115
135
  checkRegisteredWhatsapp(number: string): Promise<RegisteredResponse>;
116
136
  downloadMedia(type: 'image' | 'video' | 'sticker' | 'audio' | 'document', message: DownloadableMessage): Promise<DownloadMediaResponse>;
@@ -119,11 +139,17 @@ export declare class WhatsApp {
119
139
  status: number;
120
140
  data: ContactInfo[];
121
141
  }>;
142
+ addContact(number: string, name: string): Promise<ApiResponse>;
122
143
  contactProfile(id: string): Promise<{
123
144
  status: number;
124
145
  data: ContactInfo;
125
146
  }>;
147
+ removeContact(number: string): Promise<ApiResponse>;
126
148
  blockContact(number: string, action: 'block' | 'unblock'): Promise<ApiResponse>;
149
+ clearContactSession(number: string): Promise<ApiResponse>;
150
+ getContactStatus(number: string): Promise<ApiResponse>;
151
+ listBlockedContacts(): Promise<ApiResponse>;
152
+ resolveLids(lids: string[]): Promise<ApiResponse>;
127
153
  groups(): Promise<{
128
154
  status: number;
129
155
  data: GroupInfo[];
@@ -139,6 +165,11 @@ export declare class WhatsApp {
139
165
  updateGroup(id: string, name: string, description: string): Promise<ApiResponse>;
140
166
  changeGroupSettings(id: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<ApiResponse>;
141
167
  leaveGroup(id: string): Promise<ApiResponse>;
168
+ getGroupMembers(id: string): Promise<{
169
+ status: number;
170
+ data: GroupParticipant[];
171
+ }>;
172
+ getGroupInviteInfo(code: string): Promise<ApiResponse>;
142
173
  getInviteGroup(id: string): Promise<InviteCodeResponse>;
143
174
  updateGroupPicture(id: string, url: string): Promise<ApiResponse>;
144
175
  removeGroupPicture(id: string): Promise<ApiResponse>;
@@ -172,6 +203,13 @@ export declare class WhatsApp {
172
203
  data: GroupParticipant[];
173
204
  }>;
174
205
  updateCommunityRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse>;
206
+ acceptCommunityInvite(code: string): Promise<ApiResponse>;
207
+ getCommunityInviteInfo(code: string): Promise<ApiResponse>;
208
+ createCommunityGroup(id: string, data: CommunityGroupCreate): Promise<ApiResponse>;
209
+ setCommunityEphemeral(id: string, expiration: number): Promise<ApiResponse>;
210
+ updateCommunitySettings(id: string, setting: string): Promise<ApiResponse>;
211
+ setCommunityMemberAddMode(id: string, mode: string): Promise<ApiResponse>;
212
+ setCommunityJoinApproval(id: string, mode: string): Promise<ApiResponse>;
175
213
  getCatalog(limit?: number, cursor?: string): Promise<CatalogResponse>;
176
214
  createProduct(product: Product): Promise<ApiResponse>;
177
215
  updateProduct(productId: string, product: Product): Promise<ApiResponse>;
package/dist/WhatsApp.js CHANGED
@@ -12,6 +12,8 @@ const ContactService_1 = require("./services/ContactService");
12
12
  const GroupService_1 = require("./services/GroupService");
13
13
  const CommunityService_1 = require("./services/CommunityService");
14
14
  const BusinessService_1 = require("./services/BusinessService");
15
+ const NewsletterService_1 = require("./services/NewsletterService");
16
+ const StatusService_1 = require("./services/StatusService");
15
17
  class WhatsApp {
16
18
  constructor(data, httpClient) {
17
19
  const client = httpClient ?? new HttpClient_1.HttpClient(`${data.server}/${data.key}`);
@@ -25,6 +27,8 @@ class WhatsApp {
25
27
  this.group = new GroupService_1.GroupService(client);
26
28
  this.community = new CommunityService_1.CommunityService(client);
27
29
  this.business = new BusinessService_1.BusinessService(client);
30
+ this.newsletter = new NewsletterService_1.NewsletterService(client);
31
+ this.status = new StatusService_1.StatusService(client);
28
32
  }
29
33
  // ==================== Backward Compatibility ====================
30
34
  // These methods delegate to the corresponding services.
@@ -38,6 +42,7 @@ class WhatsApp {
38
42
  pairingCode(phoneNumber) { return this.instance.pairingCode(phoneNumber); }
39
43
  addMongoDb(uri, dbName) { return this.instance.addMongoDb(uri, dbName); }
40
44
  setProxy(proxy) { return this.instance.setProxy(proxy); }
45
+ resync() { return this.instance.resync(); }
41
46
  restart() { return this.instance.restart(); }
42
47
  updateProfileStatus(text) { return this.instance.updateProfileStatus(text); }
43
48
  updateProfilePicture(url) { return this.instance.updateProfilePicture(url); }
@@ -56,23 +61,38 @@ class WhatsApp {
56
61
  sendPoll(to, name, values, selectableCount) { return this.message.sendPoll(to, name, values, selectableCount); }
57
62
  sendEvent(data) { return this.message.sendEvent(data); }
58
63
  pinMessage(id, duration) { return this.message.pin(id, duration); }
64
+ unpinMessage(id) { return this.message.unpin(id); }
59
65
  sendCallLink(to, type, caption) { return this.message.sendCallLink(to, type, caption); }
60
66
  sendImageBase64(to, base64, caption) { return this.message.sendImageBase64(to, base64, caption); }
61
67
  sendAudioBase64(to, base64) { return this.message.sendAudioBase64(to, base64); }
62
68
  sendDocumentBase64(to, base64, mimetype, fileName, caption) { return this.message.sendDocumentBase64(to, base64, mimetype, fileName, caption); }
69
+ sendContacts(data) { return this.message.sendContacts(data); }
70
+ sendLiveLocation(data) { return this.message.sendLiveLocation(data); }
71
+ getMessageDetails(messageId) { return this.message.getDetails(messageId); }
72
+ getMessageMedia(messageId, format) { return this.message.getMedia(messageId, format); }
73
+ sendProduct(data) { return this.message.sendProduct(data); }
74
+ sendGroupInvite(data) { return this.message.sendGroupInvite(data); }
75
+ requestPhone(to) { return this.message.requestPhone(to); }
76
+ createCallLink(type) { return this.message.createCallLink(type); }
63
77
  // Chat
64
78
  getChats() { return this.chat.list(); }
65
79
  modifyChat(id, action, value) { return this.chat.modify(id, action, value); }
66
80
  deleteChat(chatId) { return this.chat.delete(chatId); }
67
- getChatMessages(chatId) { return this.chat.messages(chatId); }
81
+ getChatMessages(chatId, page, limit) { return this.chat.messages(chatId, page, limit); }
82
+ presenceSubscribe(jid) { return this.chat.presenceSubscribe(jid); }
83
+ setDisappearing(jid, expiration) { return this.chat.disappearing(jid, expiration); }
84
+ getPrivacy() { return this.chat.privacy(); }
68
85
  // Call
69
86
  makeCall(to, isVideo) { return this.call.call(to, isVideo); }
70
87
  rejectCall(id, from) { return this.call.reject(id, from); }
88
+ acceptCall(callId, callFrom) { return this.call.accept(callId, callFrom); }
89
+ endCall(callId, peerJid) { return this.call.end(callId, peerJid); }
71
90
  // Labels
72
91
  getLabels() { return this.label.list(); }
73
92
  createLabel(name, labelId) { return this.label.create(name, labelId); }
74
93
  getChatLabel(labelId) { return this.label.getChats(labelId); }
75
94
  addChatLabel(labelId, to) { return this.label.addToChat(labelId, to); }
95
+ deleteLabel(labelId) { return this.label.delete(labelId); }
76
96
  removeChatLabel(labelId, to) { return this.label.removeFromChat(labelId, to); }
77
97
  // Actions
78
98
  checkRegisteredWhatsapp(number) { return this.action.checkRegistered(number); }
@@ -80,8 +100,14 @@ class WhatsApp {
80
100
  deleteStorage() { return this.action.deleteStorage(); }
81
101
  // Contacts
82
102
  contacts() { return this.contact.list(); }
103
+ addContact(number, name) { return this.contact.add(number, name); }
83
104
  contactProfile(id) { return this.contact.profile(id); }
105
+ removeContact(number) { return this.contact.remove(number); }
84
106
  blockContact(number, action) { return this.contact.block(number, action); }
107
+ clearContactSession(number) { return this.contact.clearSession(number); }
108
+ getContactStatus(number) { return this.contact.getStatus(number); }
109
+ listBlockedContacts() { return this.contact.listBlocked(); }
110
+ resolveLids(lids) { return this.contact.resolveLids(lids); }
85
111
  // Groups
86
112
  groups() { return this.group.list(); }
87
113
  infoGroup(id) { return this.group.info(id); }
@@ -89,6 +115,8 @@ class WhatsApp {
89
115
  updateGroup(id, name, description) { return this.group.update(id, name, description); }
90
116
  changeGroupSettings(id, setting) { return this.group.changeSettings(id, setting); }
91
117
  leaveGroup(id) { return this.group.leave(id); }
118
+ getGroupMembers(id) { return this.group.getMembers(id); }
119
+ getGroupInviteInfo(code) { return this.group.getInviteInfo(code); }
92
120
  getInviteGroup(id) { return this.group.getInviteCode(id); }
93
121
  updateGroupPicture(id, url) { return this.group.updatePicture(id, url); }
94
122
  removeGroupPicture(id) { return this.group.removePicture(id); }
@@ -108,6 +136,13 @@ class WhatsApp {
108
136
  removeCommunityParticipants(id, participants) { return this.community.removeParticipants(id, participants); }
109
137
  getCommunityRequestParticipants(id) { return this.community.getRequestParticipants(id); }
110
138
  updateCommunityRequestParticipants(id, data) { return this.community.updateRequestParticipants(id, data); }
139
+ acceptCommunityInvite(code) { return this.community.acceptInvite(code); }
140
+ getCommunityInviteInfo(code) { return this.community.getInviteInfo(code); }
141
+ createCommunityGroup(id, data) { return this.community.createGroup(id, data); }
142
+ setCommunityEphemeral(id, expiration) { return this.community.ephemeral(id, expiration); }
143
+ updateCommunitySettings(id, setting) { return this.community.updateSettings(id, setting); }
144
+ setCommunityMemberAddMode(id, mode) { return this.community.memberAddMode(id, mode); }
145
+ setCommunityJoinApproval(id, mode) { return this.community.joinApproval(id, mode); }
111
146
  // Business
112
147
  getCatalog(limit, cursor) { return this.business.getCatalog(limit, cursor); }
113
148
  createProduct(product) { return this.business.createProduct(product); }
@@ -1 +1 @@
1
- {"version":3,"file":"WhatsApp.js","sourceRoot":"","sources":["../src/WhatsApp.ts"],"names":[],"mappings":";;;AAWA,oDAAiD;AACjD,gEAA6D;AAC7D,8DAA2D;AAC3D,wDAAqD;AACrD,wDAAqD;AACrD,0DAAuD;AACvD,4DAAyD;AACzD,8DAA2D;AAC3D,0DAAuD;AACvD,kEAA+D;AAC/D,gEAA6D;AAE7D,MAAa,QAAQ;IAYnB,YAAY,IAAU,EAAE,UAAwB;QAC9C,MAAM,MAAM,GAAG,UAAU,IAAI,IAAI,uBAAU,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAE1E,IAAI,CAAC,QAAQ,GAAG,IAAI,iCAAe,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,IAAI,+BAAc,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,2BAAY,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,6BAAa,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG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,KAAc,EAAE,MAAe,IAA8B,OAAO,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,KAAK,EAAE,MAAM,CAAC,CAAC,CAAC,CAAC;IACzH,aAAa,CAAC,OAAgB,IAA0B,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACtG,aAAa,CAAC,SAAiB,EAAE,OAAgB,IAA0B,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpI,aAAa,CAAC,SAAiB,IAA0B,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAC1G;AA3ID,4BA2IC;AAED,kBAAe,QAAQ,CAAC","sourcesContent":["import {\n Init, WebhookBody, TypeMessage, StatusPresence, Contact, Section,\n Location, Buttons, Items, HeaderMedia, DownloadableMessage, Product,\n CommunityCreate, CommunityUpdate, GroupParticipantsAction,\n ApiResponse, PairingCodeResponse, MobileRegisterData, EventData,\n InfoInstance, SendMessageRoot, Connect, RegisteredResponse,\n ContactInfo, GroupInfo, InviteCodeResponse, ChatInfo, LabelInfo,\n CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse,\n DownloadMediaResponse, CallResponse, MessageData, GroupParticipant,\n} from './types';\nimport { IHttpClient } from './client/IHttpClient';\nimport { HttpClient } from './client/HttpClient';\nimport { InstanceService } from './services/InstanceService';\nimport { MessageService } from './services/MessageService';\nimport { ChatService } from './services/ChatService';\nimport { CallService } from './services/CallService';\nimport { LabelService } from './services/LabelService';\nimport { ActionService } from './services/ActionService';\nimport { ContactService } from './services/ContactService';\nimport { GroupService } from './services/GroupService';\nimport { CommunityService } from './services/CommunityService';\nimport { BusinessService } from './services/BusinessService';\n\nexport class WhatsApp {\n readonly instance: InstanceService;\n readonly message: MessageService;\n readonly chat: ChatService;\n readonly call: CallService;\n readonly label: LabelService;\n readonly action: ActionService;\n readonly contact: ContactService;\n readonly group: GroupService;\n readonly community: CommunityService;\n readonly business: BusinessService;\n\n constructor(data: Init, httpClient?: IHttpClient) {\n const client = httpClient ?? new HttpClient(`${data.server}/${data.key}`);\n\n this.instance = new InstanceService(client);\n this.message = new MessageService(client);\n this.chat = new ChatService(client);\n this.call = new CallService(client);\n this.label = new LabelService(client);\n this.action = new ActionService(client);\n this.contact = new ContactService(client);\n this.group = new GroupService(client);\n this.community = new CommunityService(client);\n this.business = new BusinessService(client);\n }\n\n // ==================== Backward Compatibility ====================\n // These methods delegate to the corresponding services.\n // Use wa.instance.*, wa.message.*, wa.group.*, etc. for the new API.\n\n // Instance\n connect(): Promise<Connect> { return this.instance.connect(); }\n info(): Promise<InfoInstance> { return this.instance.info(); }\n logout(): Promise<ApiResponse> { return this.instance.logout(); }\n setting(data: { markMessageRead: boolean; saveMedia: boolean; receiveStatusMessage: boolean; receivePresence: boolean }): Promise<ApiResponse> { return this.instance.setting(data); }\n updateWebhook(body: WebhookBody): Promise<ApiResponse> { return this.instance.updateWebhook(body); }\n pairingCode(phoneNumber: string): Promise<PairingCodeResponse> { return this.instance.pairingCode(phoneNumber); }\n addMongoDb(uri: string, dbName: string): Promise<ApiResponse> { return this.instance.addMongoDb(uri, dbName); }\n setProxy(proxy: string): Promise<ApiResponse> { return this.instance.setProxy(proxy); }\n restart(): Promise<ApiResponse> { return this.instance.restart(); }\n updateProfileStatus(text: string): Promise<ApiResponse> { return this.instance.updateProfileStatus(text); }\n updateProfilePicture(url: string): Promise<ApiResponse> { return this.instance.updateProfilePicture(url); }\n removeProfilePicture(): Promise<ApiResponse> { return this.instance.removeProfilePicture(); }\n updateProfileName(name: string): Promise<ApiResponse> { return this.instance.updateProfileName(name); }\n mobileRegisterPrepare(data: MobileRegisterData): Promise<ApiResponse> { return this.instance.mobileRegisterPrepare(data); }\n mobileRequestCode(method: string): Promise<ApiResponse> { return this.instance.mobileRequestCode(method); }\n mobileVerifyCode(code: string): Promise<ApiResponse> { return this.instance.mobileVerifyCode(code); }\n webhookStatistics(): Promise<WebhookStatistics> { return this.instance.webhookStatistics(); }\n\n // Messages\n listMessages(phoneNumber: string, page?: number, limit?: number): Promise<ListMessagesResponse> { return this.message.list(phoneNumber, page, limit); }\n sendMessage(\n data: {\n type: TypeMessage;\n body: {\n to: string; msgId?: string; header?: HeaderMedia; status?: StatusPresence;\n text?: string; url?: string; caption?: string; mimetype?: string; fileName?: string;\n contact?: Contact; location?: Location; name?: string; options?: string[];\n sections?: Section[]; buttons?: Buttons[]; footer?: string; description?: string;\n title?: string; buttonText?: string; thumbnailUrl?: string; sourceUrl?: string;\n referenceId?: string; code?: string; key?: string; merchantName?: string;\n keyType?: \"CNPJ\" | \"CPF\" | \"EMAIL\" | \"PHONE\"; subtotal?: string;\n totalAmount?: string; items?: Items[];\n };\n },\n reply?: boolean,\n ): Promise<SendMessageRoot> { return this.message.send(data, reply); }\n forwardingMessage(to: string, msgId: string): Promise<SendMessageRoot> { return this.message.forward(to, msgId); }\n sendSticker(to: string, url: string): Promise<SendMessageRoot> { return this.message.sendSticker(to, url); }\n sendVideoNote(to: string, url: string): Promise<SendMessageRoot> { return this.message.sendVideoNote(to, url); }\n sendPoll(to: string, name: string, values: Array<string | number | boolean>, selectableCount?: number): Promise<SendMessageRoot> { return this.message.sendPoll(to, name, values, selectableCount); }\n sendEvent(data: EventData): Promise<SendMessageRoot> { return this.message.sendEvent(data); }\n pinMessage(id: string, duration?: number): Promise<ApiResponse> { return this.message.pin(id, duration); }\n sendCallLink(to: string, type: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendCallLink(to, type, caption); }\n sendImageBase64(to: string, base64: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendImageBase64(to, base64, caption); }\n sendAudioBase64(to: string, base64: string): Promise<SendMessageRoot> { return this.message.sendAudioBase64(to, base64); }\n sendDocumentBase64(to: string, base64: string, mimetype: string, fileName?: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendDocumentBase64(to, base64, mimetype, fileName, caption); }\n\n // Chat\n getChats(): Promise<{ status: number; data: ChatInfo[] }> { return this.chat.list(); }\n modifyChat(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse> { return this.chat.modify(id, action, value); }\n deleteChat(chatId: string): Promise<ApiResponse> { return this.chat.delete(chatId); }\n getChatMessages(chatId: string): Promise<{ status: number; data: MessageData[] }> { return this.chat.messages(chatId); }\n\n // Call\n makeCall(to: string, isVideo?: boolean): Promise<CallResponse> { return this.call.call(to, isVideo); }\n rejectCall(id: string, from: string): Promise<ApiResponse> { return this.call.reject(id, from); }\n\n // Labels\n getLabels(): Promise<{ status: number; data: LabelInfo[] }> { return this.label.list(); }\n createLabel(name: string, labelId?: string): Promise<ApiResponse> { return this.label.create(name, labelId); }\n getChatLabel(labelId: string): Promise<{ status: number; data: ChatInfo[] }> { return this.label.getChats(labelId); }\n addChatLabel(labelId: string, to: string): Promise<ApiResponse> { return this.label.addToChat(labelId, to); }\n removeChatLabel(labelId: string, to: string): Promise<ApiResponse> { return this.label.removeFromChat(labelId, to); }\n\n // Actions\n checkRegisteredWhatsapp(number: string): Promise<RegisteredResponse> { return this.action.checkRegistered(number); }\n downloadMedia(type: 'image' | 'video' | 'sticker' | 'audio' | 'document', message: DownloadableMessage): Promise<DownloadMediaResponse> { return this.action.downloadMedia(type, message); }\n deleteStorage(): Promise<ApiResponse> { return this.action.deleteStorage(); }\n\n // Contacts\n contacts(): Promise<{ status: number; data: ContactInfo[] }> { return this.contact.list(); }\n contactProfile(id: string): Promise<{ status: number; data: ContactInfo }> { return this.contact.profile(id); }\n blockContact(number: string, action: 'block' | 'unblock'): Promise<ApiResponse> { return this.contact.block(number, action); }\n\n // Groups\n groups(): Promise<{ status: number; data: GroupInfo[] }> { return this.group.list(); }\n infoGroup(id: string): Promise<{ status: number; data: GroupInfo }> { return this.group.info(id); }\n createGroup(name: string, participants: string[]): Promise<{ status: number; data: GroupInfo }> { return this.group.create(name, participants); }\n updateGroup(id: string, name: string, description: string): Promise<ApiResponse> { return this.group.update(id, name, description); }\n changeGroupSettings(id: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<ApiResponse> { return this.group.changeSettings(id, setting); }\n leaveGroup(id: string): Promise<ApiResponse> { return this.group.leave(id); }\n getInviteGroup(id: string): Promise<InviteCodeResponse> { return this.group.getInviteCode(id); }\n updateGroupPicture(id: string, url: string): Promise<ApiResponse> { return this.group.updatePicture(id, url); }\n removeGroupPicture(id: string): Promise<ApiResponse> { return this.group.removePicture(id); }\n addParticipantsGroup(id: string, participants: string[]): Promise<ApiResponse> { return this.group.addParticipants(id, participants); }\n removeParticipantsGroup(id: string, participants: string[]): Promise<ApiResponse> { return this.group.removeParticipants(id, participants); }\n updateGroupParticipantRole(id: string, action: 'promote' | 'demote', participants: string[]): Promise<ApiResponse> { return this.group.updateParticipantRole(id, action, participants); }\n getGroupRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> { return this.group.getRequestParticipants(id); }\n updateGroupRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> { return this.group.updateRequestParticipants(id, data); }\n\n // Community\n listCommunities(): Promise<{ status: number; data: CommunityInfo[] }> { return this.community.list(); }\n createCommunity(data: CommunityCreate): Promise<{ status: number; data: CommunityInfo }> { return this.community.create(data); }\n infoCommunity(id: string): Promise<{ status: number; data: CommunityInfo }> { return this.community.info(id); }\n updateCommunity(id: string, data: CommunityUpdate): Promise<ApiResponse> { return this.community.update(id, data); }\n leaveCommunity(id: string): Promise<ApiResponse> { return this.community.leave(id); }\n updateCommunityPicture(id: string, url: string): Promise<ApiResponse> { return this.community.updatePicture(id, url); }\n getCommunityInviteCode(id: string): Promise<InviteCodeResponse> { return this.community.getInviteCode(id); }\n removeCommunityParticipants(id: string, participants: string[]): Promise<ApiResponse> { return this.community.removeParticipants(id, participants); }\n getCommunityRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> { return this.community.getRequestParticipants(id); }\n updateCommunityRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> { return this.community.updateRequestParticipants(id, data); }\n\n // Business\n getCatalog(limit?: number, cursor?: string): Promise<CatalogResponse> { return this.business.getCatalog(limit, cursor); }\n createProduct(product: Product): Promise<ApiResponse> { return this.business.createProduct(product); }\n updateProduct(productId: string, product: Product): Promise<ApiResponse> { return this.business.updateProduct(productId, product); }\n deleteProduct(productId: string): Promise<ApiResponse> { return this.business.deleteProduct(productId); }\n}\n\nexport default WhatsApp;\n"]}
1
+ {"version":3,"file":"WhatsApp.js","sourceRoot":"","sources":["../src/WhatsApp.ts"],"names":[],"mappings":";;;AAcA,oDAAiD;AACjD,gEAA6D;AAC7D,8DAA2D;AAC3D,wDAAqD;AACrD,wDAAqD;AACrD,0DAAuD;AACvD,4DAAyD;AACzD,8DAA2D;AAC3D,0DAAuD;AACvD,kEAA+D;AAC/D,gEAA6D;AAC7D,oEAAiE;AACjE,4DAAyD;AAEzD,MAAa,QAAQ;IAcnB,YAAY,IAAU,EAAE,UAAwB;QAC9C,MAAM,MAAM,GAAG,UAAU,IAAI,IAAI,uBAAU,CAAC,GAAG,IAAI,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC,CAAC;QAE1E,IAAI,CAAC,QAAQ,GAAG,IAAI,iCAAe,CAAC,MAAM,CAAC,CAAC;QAC5C,IAAI,CAAC,OAAO,GAAG,IAAI,+BAAc,CAAC,MAAM,CAAC,CAAC;QAC1C,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,IAAI,GAAG,IAAI,yBAAW,CAAC,MAAM,CAAC,CAAC;QACpC,IAAI,CAAC,KAAK,GAAG,IAAI,2BAAY,CAAC,MAAM,CAAC,CAAC;QACtC,IAAI,CAAC,MAAM,GAAG,IAAI,6BAAa,CAAC,MAAM,CAAC,CAAC;QACxC,IAAI,CAAC,OAAO,GAAG,IAAI,+BAAc,CAAC,MAA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AAC,CAAC,CAAC;IACzH,aAAa,CAAC,OAAgB,IAA0B,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,OAAO,CAAC,CAAC,CAAC,CAAC;IACtG,aAAa,CAAC,SAAiB,EAAE,OAAgB,IAA0B,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,EAAE,OAAO,CAAC,CAAC,CAAC,CAAC;IACpI,aAAa,CAAC,SAAiB,IAA0B,OAAO,IAAI,CAAC,QAAQ,CAAC,aAAa,CAAC,SAAS,CAAC,CAAC,CAAC,CAAC;CAC1G;AA9KD,4BA8KC;AAED,kBAAe,QAAQ,CAAC","sourcesContent":["import {\n Init, WebhookBody, TypeMessage, StatusPresence, Contact, Section,\n Location, Buttons, Items, HeaderMedia, DownloadableMessage, Product,\n CommunityCreate, CommunityUpdate, GroupParticipantsAction,\n ApiResponse, PairingCodeResponse, MobileRegisterData, EventData,\n InfoInstance, SendMessageRoot, Connect, RegisteredResponse,\n ContactInfo, GroupInfo, InviteCodeResponse, ChatInfo, LabelInfo,\n CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse,\n DownloadMediaResponse, CallResponse, MessageData, GroupParticipant,\n LiveLocationData, SendContactsData, ProductMessageData, GroupInviteMessageData,\n StatusTextData, StatusMediaData, StatusMentionData, CommunityGroupCreate,\n NewsletterInfo,\n} from './types';\nimport { IHttpClient } from './client/IHttpClient';\nimport { HttpClient } from './client/HttpClient';\nimport { InstanceService } from './services/InstanceService';\nimport { MessageService } from './services/MessageService';\nimport { ChatService } from './services/ChatService';\nimport { CallService } from './services/CallService';\nimport { LabelService } from './services/LabelService';\nimport { ActionService } from './services/ActionService';\nimport { ContactService } from './services/ContactService';\nimport { GroupService } from './services/GroupService';\nimport { CommunityService } from './services/CommunityService';\nimport { BusinessService } from './services/BusinessService';\nimport { NewsletterService } from './services/NewsletterService';\nimport { StatusService } from './services/StatusService';\n\nexport class WhatsApp {\n readonly instance: InstanceService;\n readonly message: MessageService;\n readonly chat: ChatService;\n readonly call: CallService;\n readonly label: LabelService;\n readonly action: ActionService;\n readonly contact: ContactService;\n readonly group: GroupService;\n readonly community: CommunityService;\n readonly business: BusinessService;\n readonly newsletter: NewsletterService;\n readonly status: StatusService;\n\n constructor(data: Init, httpClient?: IHttpClient) {\n const client = httpClient ?? new HttpClient(`${data.server}/${data.key}`);\n\n this.instance = new InstanceService(client);\n this.message = new MessageService(client);\n this.chat = new ChatService(client);\n this.call = new CallService(client);\n this.label = new LabelService(client);\n this.action = new ActionService(client);\n this.contact = new ContactService(client);\n this.group = new GroupService(client);\n this.community = new CommunityService(client);\n this.business = new BusinessService(client);\n this.newsletter = new NewsletterService(client);\n this.status = new StatusService(client);\n }\n\n // ==================== Backward Compatibility ====================\n // These methods delegate to the corresponding services.\n // Use wa.instance.*, wa.message.*, wa.group.*, etc. for the new API.\n\n // Instance\n connect(): Promise<Connect> { return this.instance.connect(); }\n info(): Promise<InfoInstance> { return this.instance.info(); }\n logout(): Promise<ApiResponse> { return this.instance.logout(); }\n setting(data: { markMessageRead: boolean; saveMedia: boolean; receiveStatusMessage: boolean; receivePresence: boolean }): Promise<ApiResponse> { return this.instance.setting(data); }\n updateWebhook(body: WebhookBody): Promise<ApiResponse> { return this.instance.updateWebhook(body); }\n pairingCode(phoneNumber: string): Promise<PairingCodeResponse> { return this.instance.pairingCode(phoneNumber); }\n addMongoDb(uri: string, dbName: string): Promise<ApiResponse> { return this.instance.addMongoDb(uri, dbName); }\n setProxy(proxy: string): Promise<ApiResponse> { return this.instance.setProxy(proxy); }\n resync(): Promise<ApiResponse> { return this.instance.resync(); }\n restart(): Promise<ApiResponse> { return this.instance.restart(); }\n updateProfileStatus(text: string): Promise<ApiResponse> { return this.instance.updateProfileStatus(text); }\n updateProfilePicture(url: string): Promise<ApiResponse> { return this.instance.updateProfilePicture(url); }\n removeProfilePicture(): Promise<ApiResponse> { return this.instance.removeProfilePicture(); }\n updateProfileName(name: string): Promise<ApiResponse> { return this.instance.updateProfileName(name); }\n mobileRegisterPrepare(data: MobileRegisterData): Promise<ApiResponse> { return this.instance.mobileRegisterPrepare(data); }\n mobileRequestCode(method: string): Promise<ApiResponse> { return this.instance.mobileRequestCode(method); }\n mobileVerifyCode(code: string): Promise<ApiResponse> { return this.instance.mobileVerifyCode(code); }\n webhookStatistics(): Promise<WebhookStatistics> { return this.instance.webhookStatistics(); }\n\n // Messages\n listMessages(phoneNumber: string, page?: number, limit?: number): Promise<ListMessagesResponse> { return this.message.list(phoneNumber, page, limit); }\n sendMessage(\n data: {\n type: TypeMessage;\n body: {\n to: string; msgId?: string; header?: HeaderMedia; status?: StatusPresence;\n text?: string; url?: string; caption?: string; mimetype?: string; fileName?: string;\n contact?: Contact; location?: Location; name?: string; options?: string[];\n sections?: Section[]; buttons?: Buttons[]; footer?: string; description?: string;\n title?: string; buttonText?: string; thumbnailUrl?: string; sourceUrl?: string;\n referenceId?: string; code?: string; key?: string; merchantName?: string;\n keyType?: \"CNPJ\" | \"CPF\" | \"EMAIL\" | \"PHONE\"; subtotal?: string;\n totalAmount?: string; items?: Items[];\n };\n },\n reply?: boolean,\n ): Promise<SendMessageRoot> { return this.message.send(data, reply); }\n forwardingMessage(to: string, msgId: string): Promise<SendMessageRoot> { return this.message.forward(to, msgId); }\n sendSticker(to: string, url: string): Promise<SendMessageRoot> { return this.message.sendSticker(to, url); }\n sendVideoNote(to: string, url: string): Promise<SendMessageRoot> { return this.message.sendVideoNote(to, url); }\n sendPoll(to: string, name: string, values: Array<string | number | boolean>, selectableCount?: number): Promise<SendMessageRoot> { return this.message.sendPoll(to, name, values, selectableCount); }\n sendEvent(data: EventData): Promise<SendMessageRoot> { return this.message.sendEvent(data); }\n pinMessage(id: string, duration?: number): Promise<ApiResponse> { return this.message.pin(id, duration); }\n unpinMessage(id: string): Promise<ApiResponse> { return this.message.unpin(id); }\n sendCallLink(to: string, type: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendCallLink(to, type, caption); }\n sendImageBase64(to: string, base64: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendImageBase64(to, base64, caption); }\n sendAudioBase64(to: string, base64: string): Promise<SendMessageRoot> { return this.message.sendAudioBase64(to, base64); }\n sendDocumentBase64(to: string, base64: string, mimetype: string, fileName?: string, caption?: string): Promise<SendMessageRoot> { return this.message.sendDocumentBase64(to, base64, mimetype, fileName, caption); }\n sendContacts(data: SendContactsData): Promise<SendMessageRoot> { return this.message.sendContacts(data); }\n sendLiveLocation(data: LiveLocationData): Promise<SendMessageRoot> { return this.message.sendLiveLocation(data); }\n getMessageDetails(messageId: string): Promise<ApiResponse> { return this.message.getDetails(messageId); }\n getMessageMedia(messageId: string, format?: string): Promise<ApiResponse> { return this.message.getMedia(messageId, format); }\n sendProduct(data: ProductMessageData): Promise<SendMessageRoot> { return this.message.sendProduct(data); }\n sendGroupInvite(data: GroupInviteMessageData): Promise<SendMessageRoot> { return this.message.sendGroupInvite(data); }\n requestPhone(to: string): Promise<ApiResponse> { return this.message.requestPhone(to); }\n createCallLink(type: string): Promise<ApiResponse> { return this.message.createCallLink(type); }\n\n // Chat\n getChats(): Promise<{ status: number; data: ChatInfo[] }> { return this.chat.list(); }\n modifyChat(id: string, action: 'markRead' | 'pin', value: boolean): Promise<ApiResponse> { return this.chat.modify(id, action, value); }\n deleteChat(chatId: string): Promise<ApiResponse> { return this.chat.delete(chatId); }\n getChatMessages(chatId: string, page?: number, limit?: number): Promise<{ status: number; data: MessageData[] }> { return this.chat.messages(chatId, page, limit); }\n presenceSubscribe(jid: string): Promise<ApiResponse> { return this.chat.presenceSubscribe(jid); }\n setDisappearing(jid: string, expiration: number): Promise<ApiResponse> { return this.chat.disappearing(jid, expiration); }\n getPrivacy(): Promise<ApiResponse> { return this.chat.privacy(); }\n\n // Call\n makeCall(to: string, isVideo?: boolean): Promise<CallResponse> { return this.call.call(to, isVideo); }\n rejectCall(id: string, from: string): Promise<ApiResponse> { return this.call.reject(id, from); }\n acceptCall(callId: string, callFrom: string): Promise<ApiResponse> { return this.call.accept(callId, callFrom); }\n endCall(callId: string, peerJid: string): Promise<ApiResponse> { return this.call.end(callId, peerJid); }\n\n // Labels\n getLabels(): Promise<{ status: number; data: LabelInfo[] }> { return this.label.list(); }\n createLabel(name: string, labelId?: string): Promise<ApiResponse> { return this.label.create(name, labelId); }\n getChatLabel(labelId: string): Promise<{ status: number; data: ChatInfo[] }> { return this.label.getChats(labelId); }\n addChatLabel(labelId: string, to: string): Promise<ApiResponse> { return this.label.addToChat(labelId, to); }\n deleteLabel(labelId: string): Promise<ApiResponse> { return this.label.delete(labelId); }\n removeChatLabel(labelId: string, to: string): Promise<ApiResponse> { return this.label.removeFromChat(labelId, to); }\n\n // Actions\n checkRegisteredWhatsapp(number: string): Promise<RegisteredResponse> { return this.action.checkRegistered(number); }\n downloadMedia(type: 'image' | 'video' | 'sticker' | 'audio' | 'document', message: DownloadableMessage): Promise<DownloadMediaResponse> { return this.action.downloadMedia(type, message); }\n deleteStorage(): Promise<ApiResponse> { return this.action.deleteStorage(); }\n\n // Contacts\n contacts(): Promise<{ status: number; data: ContactInfo[] }> { return this.contact.list(); }\n addContact(number: string, name: string): Promise<ApiResponse> { return this.contact.add(number, name); }\n contactProfile(id: string): Promise<{ status: number; data: ContactInfo }> { return this.contact.profile(id); }\n removeContact(number: string): Promise<ApiResponse> { return this.contact.remove(number); }\n blockContact(number: string, action: 'block' | 'unblock'): Promise<ApiResponse> { return this.contact.block(number, action); }\n clearContactSession(number: string): Promise<ApiResponse> { return this.contact.clearSession(number); }\n getContactStatus(number: string): Promise<ApiResponse> { return this.contact.getStatus(number); }\n listBlockedContacts(): Promise<ApiResponse> { return this.contact.listBlocked(); }\n resolveLids(lids: string[]): Promise<ApiResponse> { return this.contact.resolveLids(lids); }\n\n // Groups\n groups(): Promise<{ status: number; data: GroupInfo[] }> { return this.group.list(); }\n infoGroup(id: string): Promise<{ status: number; data: GroupInfo }> { return this.group.info(id); }\n createGroup(name: string, participants: string[]): Promise<{ status: number; data: GroupInfo }> { return this.group.create(name, participants); }\n updateGroup(id: string, name: string, description: string): Promise<ApiResponse> { return this.group.update(id, name, description); }\n changeGroupSettings(id: string, setting: 'announcement' | 'not_announcement' | 'locked' | 'unlocked'): Promise<ApiResponse> { return this.group.changeSettings(id, setting); }\n leaveGroup(id: string): Promise<ApiResponse> { return this.group.leave(id); }\n getGroupMembers(id: string): Promise<{ status: number; data: GroupParticipant[] }> { return this.group.getMembers(id); }\n getGroupInviteInfo(code: string): Promise<ApiResponse> { return this.group.getInviteInfo(code); }\n getInviteGroup(id: string): Promise<InviteCodeResponse> { return this.group.getInviteCode(id); }\n updateGroupPicture(id: string, url: string): Promise<ApiResponse> { return this.group.updatePicture(id, url); }\n removeGroupPicture(id: string): Promise<ApiResponse> { return this.group.removePicture(id); }\n addParticipantsGroup(id: string, participants: string[]): Promise<ApiResponse> { return this.group.addParticipants(id, participants); }\n removeParticipantsGroup(id: string, participants: string[]): Promise<ApiResponse> { return this.group.removeParticipants(id, participants); }\n updateGroupParticipantRole(id: string, action: 'promote' | 'demote', participants: string[]): Promise<ApiResponse> { return this.group.updateParticipantRole(id, action, participants); }\n getGroupRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> { return this.group.getRequestParticipants(id); }\n updateGroupRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> { return this.group.updateRequestParticipants(id, data); }\n\n // Community\n listCommunities(): Promise<{ status: number; data: CommunityInfo[] }> { return this.community.list(); }\n createCommunity(data: CommunityCreate): Promise<{ status: number; data: CommunityInfo }> { return this.community.create(data); }\n infoCommunity(id: string): Promise<{ status: number; data: CommunityInfo }> { return this.community.info(id); }\n updateCommunity(id: string, data: CommunityUpdate): Promise<ApiResponse> { return this.community.update(id, data); }\n leaveCommunity(id: string): Promise<ApiResponse> { return this.community.leave(id); }\n updateCommunityPicture(id: string, url: string): Promise<ApiResponse> { return this.community.updatePicture(id, url); }\n getCommunityInviteCode(id: string): Promise<InviteCodeResponse> { return this.community.getInviteCode(id); }\n removeCommunityParticipants(id: string, participants: string[]): Promise<ApiResponse> { return this.community.removeParticipants(id, participants); }\n getCommunityRequestParticipants(id: string): Promise<{ status: number; data: GroupParticipant[] }> { return this.community.getRequestParticipants(id); }\n updateCommunityRequestParticipants(id: string, data: GroupParticipantsAction): Promise<ApiResponse> { return this.community.updateRequestParticipants(id, data); }\n acceptCommunityInvite(code: string): Promise<ApiResponse> { return this.community.acceptInvite(code); }\n getCommunityInviteInfo(code: string): Promise<ApiResponse> { return this.community.getInviteInfo(code); }\n createCommunityGroup(id: string, data: CommunityGroupCreate): Promise<ApiResponse> { return this.community.createGroup(id, data); }\n setCommunityEphemeral(id: string, expiration: number): Promise<ApiResponse> { return this.community.ephemeral(id, expiration); }\n updateCommunitySettings(id: string, setting: string): Promise<ApiResponse> { return this.community.updateSettings(id, setting); }\n setCommunityMemberAddMode(id: string, mode: string): Promise<ApiResponse> { return this.community.memberAddMode(id, mode); }\n setCommunityJoinApproval(id: string, mode: string): Promise<ApiResponse> { return this.community.joinApproval(id, mode); }\n\n // Business\n getCatalog(limit?: number, cursor?: string): Promise<CatalogResponse> { return this.business.getCatalog(limit, cursor); }\n createProduct(product: Product): Promise<ApiResponse> { return this.business.createProduct(product); }\n updateProduct(productId: string, product: Product): Promise<ApiResponse> { return this.business.updateProduct(productId, product); }\n deleteProduct(productId: string): Promise<ApiResponse> { return this.business.deleteProduct(productId); }\n}\n\nexport default WhatsApp;\n"]}
package/dist/index.d.ts CHANGED
@@ -12,4 +12,6 @@ export { ContactService } from './services/ContactService';
12
12
  export { GroupService } from './services/GroupService';
13
13
  export { CommunityService } from './services/CommunityService';
14
14
  export { BusinessService } from './services/BusinessService';
15
- export { Init, HttpMethod, Routes, TypeMessage, StatusPresence, ApiResponse, WebhookBody, Contact, Location, Row, Section, Buttons, Items, HeaderMedia, DownloadableMessage, Product, CommunityCreate, CommunityUpdate, GroupParticipantsAction, InfoInstance, Instance, User, Webhook, BusinessProfile, SendMessageRoot, MessageData, MessageKey, MessageContent, ExtendedTextMessage, Connect, PairingCodeResponse, MobileRegisterData, EventData, RegisteredResponse, ContactInfo, GroupInfo, GroupParticipant, InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse, DownloadMediaResponse, CallResponse, } from './types';
15
+ export { NewsletterService } from './services/NewsletterService';
16
+ export { StatusService } from './services/StatusService';
17
+ export { Init, HttpMethod, Routes, TypeMessage, StatusPresence, ApiResponse, WebhookBody, Contact, Location, Row, Section, Buttons, Items, HeaderMedia, DownloadableMessage, Product, CommunityCreate, CommunityUpdate, GroupParticipantsAction, InfoInstance, Instance, User, Webhook, BusinessProfile, SendMessageRoot, MessageData, MessageKey, MessageContent, ExtendedTextMessage, Connect, PairingCodeResponse, MobileRegisterData, EventData, RegisteredResponse, ContactInfo, GroupInfo, GroupParticipant, InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo, CatalogResponse, WebhookStatistics, ListMessagesResponse, DownloadMediaResponse, CallResponse, LiveLocationData, SendContactsData, ProductMessageData, GroupInviteMessageData, StatusTextData, StatusMediaData, StatusMentionData, NewsletterInfo, CommunityGroupCreate, } from './types';
package/dist/index.js CHANGED
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.StatusPresence = exports.TypeMessage = exports.Routes = exports.HttpMethod = exports.BusinessService = exports.CommunityService = exports.GroupService = exports.ContactService = exports.ActionService = exports.LabelService = exports.CallService = exports.ChatService = exports.MessageService = exports.InstanceService = exports.HttpClient = exports.WhatsAppError = exports.WhatsApp = void 0;
3
+ exports.StatusPresence = exports.TypeMessage = exports.Routes = exports.HttpMethod = exports.StatusService = exports.NewsletterService = exports.BusinessService = exports.CommunityService = exports.GroupService = exports.ContactService = exports.ActionService = exports.LabelService = exports.CallService = exports.ChatService = exports.MessageService = exports.InstanceService = exports.HttpClient = exports.WhatsAppError = exports.WhatsApp = void 0;
4
4
  // Main class
5
5
  var WhatsApp_1 = require("./WhatsApp");
6
6
  Object.defineProperty(exports, "WhatsApp", { enumerable: true, get: function () { return WhatsApp_1.WhatsApp; } });
@@ -30,6 +30,10 @@ var CommunityService_1 = require("./services/CommunityService");
30
30
  Object.defineProperty(exports, "CommunityService", { enumerable: true, get: function () { return CommunityService_1.CommunityService; } });
31
31
  var BusinessService_1 = require("./services/BusinessService");
32
32
  Object.defineProperty(exports, "BusinessService", { enumerable: true, get: function () { return BusinessService_1.BusinessService; } });
33
+ var NewsletterService_1 = require("./services/NewsletterService");
34
+ Object.defineProperty(exports, "NewsletterService", { enumerable: true, get: function () { return NewsletterService_1.NewsletterService; } });
35
+ var StatusService_1 = require("./services/StatusService");
36
+ Object.defineProperty(exports, "StatusService", { enumerable: true, get: function () { return StatusService_1.StatusService; } });
33
37
  // Types
34
38
  var types_1 = require("./types");
35
39
  Object.defineProperty(exports, "HttpMethod", { enumerable: true, get: function () { return types_1.HttpMethod; } });
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAEjB,QAAQ;AACR,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AAItB,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AAEnB,WAAW;AACX,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,0DAAyD;AAAhD,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,gEAA+D;AAAtD,oHAAA,gBAAgB,OAAA;AACzB,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AAExB,QAAQ;AACR,iCAYiB;AAXT,mGAAA,UAAU,OAAA;AAAE,+FAAA,MAAM,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,uGAAA,cAAc,OAAA","sourcesContent":["// Main class\nexport { WhatsApp } from './WhatsApp';\n\n// Error\nexport { WhatsAppError } from './errors';\n\n// Client\nexport { IHttpClient, RequestOptions } from './client/IHttpClient';\nexport { HttpClient } from './client/HttpClient';\n\n// Services\nexport { InstanceService } from './services/InstanceService';\nexport { MessageService } from './services/MessageService';\nexport { ChatService } from './services/ChatService';\nexport { CallService } from './services/CallService';\nexport { LabelService } from './services/LabelService';\nexport { ActionService } from './services/ActionService';\nexport { ContactService } from './services/ContactService';\nexport { GroupService } from './services/GroupService';\nexport { CommunityService } from './services/CommunityService';\nexport { BusinessService } from './services/BusinessService';\n\n// Types\nexport {\n Init, HttpMethod, Routes, TypeMessage, StatusPresence,\n ApiResponse, WebhookBody, Contact, Location, Row, Section,\n Buttons, Items, HeaderMedia, DownloadableMessage, Product,\n CommunityCreate, CommunityUpdate, GroupParticipantsAction,\n InfoInstance, Instance, User, Webhook, BusinessProfile,\n SendMessageRoot, MessageData, MessageKey, MessageContent, ExtendedTextMessage,\n Connect, PairingCodeResponse, MobileRegisterData, EventData,\n RegisteredResponse, ContactInfo, GroupInfo, GroupParticipant,\n InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo,\n CatalogResponse, WebhookStatistics, ListMessagesResponse,\n DownloadMediaResponse, CallResponse,\n} from './types';\n"]}
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;AAAA,aAAa;AACb,uCAAsC;AAA7B,oGAAA,QAAQ,OAAA;AAEjB,QAAQ;AACR,mCAAyC;AAAhC,uGAAA,aAAa,OAAA;AAItB,kDAAiD;AAAxC,wGAAA,UAAU,OAAA;AAEnB,WAAW;AACX,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,sDAAqD;AAA5C,0GAAA,WAAW,OAAA;AACpB,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,0DAAyD;AAAhD,8GAAA,aAAa,OAAA;AACtB,4DAA2D;AAAlD,gHAAA,cAAc,OAAA;AACvB,wDAAuD;AAA9C,4GAAA,YAAY,OAAA;AACrB,gEAA+D;AAAtD,oHAAA,gBAAgB,OAAA;AACzB,8DAA6D;AAApD,kHAAA,eAAe,OAAA;AACxB,kEAAiE;AAAxD,sHAAA,iBAAiB,OAAA;AAC1B,0DAAyD;AAAhD,8GAAA,aAAa,OAAA;AAEtB,QAAQ;AACR,iCAeiB;AAdT,mGAAA,UAAU,OAAA;AAAE,+FAAA,MAAM,OAAA;AAAE,oGAAA,WAAW,OAAA;AAAE,uGAAA,cAAc,OAAA","sourcesContent":["// Main class\nexport { WhatsApp } from './WhatsApp';\n\n// Error\nexport { WhatsAppError } from './errors';\n\n// Client\nexport { IHttpClient, RequestOptions } from './client/IHttpClient';\nexport { HttpClient } from './client/HttpClient';\n\n// Services\nexport { InstanceService } from './services/InstanceService';\nexport { MessageService } from './services/MessageService';\nexport { ChatService } from './services/ChatService';\nexport { CallService } from './services/CallService';\nexport { LabelService } from './services/LabelService';\nexport { ActionService } from './services/ActionService';\nexport { ContactService } from './services/ContactService';\nexport { GroupService } from './services/GroupService';\nexport { CommunityService } from './services/CommunityService';\nexport { BusinessService } from './services/BusinessService';\nexport { NewsletterService } from './services/NewsletterService';\nexport { StatusService } from './services/StatusService';\n\n// Types\nexport {\n Init, HttpMethod, Routes, TypeMessage, StatusPresence,\n ApiResponse, WebhookBody, Contact, Location, Row, Section,\n Buttons, Items, HeaderMedia, DownloadableMessage, Product,\n CommunityCreate, CommunityUpdate, GroupParticipantsAction,\n InfoInstance, Instance, User, Webhook, BusinessProfile,\n SendMessageRoot, MessageData, MessageKey, MessageContent, ExtendedTextMessage,\n Connect, PairingCodeResponse, MobileRegisterData, EventData,\n RegisteredResponse, ContactInfo, GroupInfo, GroupParticipant,\n InviteCodeResponse, ChatInfo, LabelInfo, CommunityInfo,\n CatalogResponse, WebhookStatistics, ListMessagesResponse,\n DownloadMediaResponse, CallResponse,\n LiveLocationData, SendContactsData, ProductMessageData,\n GroupInviteMessageData, StatusTextData, StatusMediaData,\n StatusMentionData, NewsletterInfo, CommunityGroupCreate,\n} from './types';\n"]}
@@ -5,4 +5,6 @@ export declare class CallService {
5
5
  constructor(http: IHttpClient);
6
6
  call(to: string, isVideo?: boolean): Promise<CallResponse>;
7
7
  reject(id: string, from: string): Promise<ApiResponse>;
8
+ accept(callId: string, callFrom: string): Promise<ApiResponse>;
9
+ end(callId: string, peerJid: string): Promise<ApiResponse>;
8
10
  }
@@ -19,6 +19,20 @@ class CallService {
19
19
  method: types_1.HttpMethod.DELETE,
20
20
  });
21
21
  }
22
+ async accept(callId, callFrom) {
23
+ return this.http.request({
24
+ route: `${types_1.Routes.CALL}/accept`,
25
+ method: types_1.HttpMethod.POST,
26
+ body: { callId, callFrom },
27
+ });
28
+ }
29
+ async end(callId, peerJid) {
30
+ return this.http.request({
31
+ route: `${types_1.Routes.CALL}/end`,
32
+ method: types_1.HttpMethod.POST,
33
+ body: { callId, peerJid },
34
+ });
35
+ }
22
36
  }
23
37
  exports.CallService = CallService;
24
38
  //# sourceMappingURL=CallService.js.map