wuzapi 1.6.0 → 1.6.2

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
@@ -184,14 +184,21 @@ await client.user.sendPresence("available");
184
184
  ## 🔗 Webhook Setup
185
185
 
186
186
  ```typescript
187
- // Set webhook URL
188
- await client.webhook.setWebhook("https://your-server.com/webhook");
187
+ // Set webhook URL with events
188
+ await client.webhook.setWebhook("https://your-server.com/webhook", [
189
+ "Message",
190
+ "ReadReceipt",
191
+ ]);
189
192
 
190
193
  // Get webhook config
191
194
  const config = await client.webhook.getWebhook();
192
195
 
193
- // Update webhook
194
- await client.webhook.updateWebhook("https://new-server.com/webhook");
196
+ // Update webhook with new URL, events, and status
197
+ await client.webhook.updateWebhook(
198
+ "https://new-server.com/webhook",
199
+ ["Message", "ReadReceipt"],
200
+ true
201
+ );
195
202
  ```
196
203
 
197
204
  ## 📚 Examples
@@ -228,22 +235,41 @@ const client = new WuzapiClient({
228
235
 
229
236
  // Connect and wait for messages
230
237
  await client.session.connect({ Subscribe: ["Message"] });
231
- await client.webhook.setWebhook("https://your-server.com/webhook");
238
+ await client.webhook.setWebhook("https://your-server.com/webhook", ["Message"]);
232
239
 
233
240
  // In your webhook handler:
234
241
  app.post("/webhook", async (req, res) => {
235
- const { event } = req.body;
242
+ const webhookPayload = req.body;
236
243
 
237
- if (event?.Message?.conversation) {
238
- const message = event.Message.conversation;
239
- const from = event.Info.RemoteJid.replace("@s.whatsapp.net", "");
244
+ // Validate payload structure
245
+ if (webhookPayload.token !== "your-expected-token") {
246
+ return res.status(401).json({ error: "Invalid token" });
247
+ }
240
248
 
241
- if (message.toLowerCase().includes("hello")) {
242
- await client.chat.sendText({
243
- Phone: from,
244
- Body: "Hello! 👋 How can I help you?",
245
- });
246
- }
249
+ // Handle by event type
250
+ switch (webhookPayload.type) {
251
+ case "Message":
252
+ const { event } = webhookPayload;
253
+ if (event.Message?.conversation) {
254
+ const message = event.Message.conversation;
255
+ const from = event.Info.RemoteJid.replace("@s.whatsapp.net", "");
256
+
257
+ if (message.toLowerCase().includes("hello")) {
258
+ await client.chat.sendText({
259
+ Phone: from,
260
+ Body: "Hello! 👋 How can I help you?",
261
+ });
262
+ }
263
+ }
264
+ break;
265
+
266
+ case "Connected":
267
+ console.log("✅ WhatsApp connected");
268
+ break;
269
+
270
+ case "QR":
271
+ console.log("📱 QR Code:", webhookPayload.event.Codes);
272
+ break;
247
273
  }
248
274
 
249
275
  res.json({ success: true });
@@ -425,18 +451,14 @@ await client.chat.sendPoll(
425
451
 
426
452
  ```typescript
427
453
  // Delete a message
428
- await client.chat.deleteMessage({
429
- Phone: "5491155554444",
430
- Id: "message-id-to-delete",
431
- Remote: true, // Delete for everyone
432
- });
454
+ await client.chat.deleteMessage("message-id-to-delete");
433
455
 
434
456
  // Edit a message
435
- await client.chat.editMessage({
436
- Phone: "5491155554444",
437
- MessageId: "message-id-to-edit",
438
- NewText: "This is the updated message text",
439
- });
457
+ await client.chat.editMessage(
458
+ "message-id-to-edit",
459
+ "5491155554444",
460
+ "This is the updated message text"
461
+ );
440
462
 
441
463
  // React to message
442
464
  await client.chat.react({
@@ -606,16 +628,13 @@ await client.group.updateParticipants(
606
628
  // List all users
607
629
  const users = await client.admin.listUsers({ token: "admin-token" });
608
630
 
609
- // Get a specific user by ID
610
- const user = await client.admin.getUser(2, { token: "admin-token" });
611
-
612
631
  // Add new user
613
632
  const newUser = await client.admin.addUser(
614
633
  {
615
634
  name: "John Doe",
616
635
  token: "user-token-123",
617
636
  webhook: "https://example.com/webhook",
618
- events: "Message,ReadReceipt",
637
+ events: "Message,ReadReceipt", // optional
619
638
  proxyConfig: {
620
639
  enabled: true,
621
640
  proxyURL: "socks5://user:pass@proxy:port",
@@ -635,11 +654,13 @@ const newUser = await client.admin.addUser(
635
654
  { token: "admin-token" }
636
655
  );
637
656
 
638
- // Delete user
639
- await client.admin.deleteUser(2, { token: "admin-token" });
657
+ // Delete user by ID (ID is a string)
658
+ await client.admin.deleteUser("user-id-string", { token: "admin-token" });
640
659
 
641
660
  // Delete user completely (full deletion including all data)
642
- await client.admin.deleteUserComplete(2, { token: "admin-token" });
661
+ await client.admin.deleteUserComplete("user-id-string", {
662
+ token: "admin-token",
663
+ });
643
664
  ```
644
665
 
645
666
  </details>
@@ -648,19 +669,202 @@ await client.admin.deleteUserComplete(2, { token: "admin-token" });
648
669
  <summary><strong>🔗 Webhook Module</strong> - Webhook configuration</summary>
649
670
 
650
671
  ```typescript
651
- // Set webhook URL
652
- await client.webhook.setWebhook("https://my-server.com/webhook");
672
+ // Set webhook URL with specific events
673
+ await client.webhook.setWebhook("https://my-server.com/webhook", [
674
+ "Message",
675
+ "Receipt",
676
+ "Connected",
677
+ "Disconnected",
678
+ ]);
653
679
 
654
680
  // Get current webhook configuration
655
681
  const webhookConfig = await client.webhook.getWebhook();
656
682
  console.log("Webhook URL:", webhookConfig.webhook);
657
683
  console.log("Subscribed events:", webhookConfig.subscribe);
658
684
 
659
- // Update webhook URL
660
- await client.webhook.updateWebhook("https://my-new-server.com/webhook");
685
+ // Update webhook URL, events, and status
686
+ await client.webhook.updateWebhook(
687
+ "https://my-new-server.com/webhook",
688
+ ["Message", "Receipt", "Presence"],
689
+ true
690
+ );
661
691
 
662
692
  // Delete webhook configuration
663
693
  await client.webhook.deleteWebhook();
694
+
695
+ // Get all available events
696
+ const availableEvents = client.webhook.constructor.getAvailableEvents();
697
+ console.log("Available events:", availableEvents);
698
+
699
+ // Use the enum for type safety (TypeScript)
700
+ import { WebhookEventType } from "wuzapi";
701
+ await client.webhook.setWebhook("https://my-server.com/webhook", [
702
+ WebhookEventType.MESSAGE,
703
+ WebhookEventType.RECEIPT,
704
+ WebhookEventType.CONNECTED,
705
+ ]);
706
+ ```
707
+
708
+ ### 📋 Complete Webhook Events List
709
+
710
+ WuzAPI supports **45 different webhook events**. Here's the complete list:
711
+
712
+ #### 🔧 **Connection & Session Events**
713
+
714
+ ```typescript
715
+ WebhookEventType.CONNECTED; // "Connected"
716
+ WebhookEventType.DISCONNECTED; // "Disconnected"
717
+ WebhookEventType.CONNECT_FAILURE; // "ConnectFailure"
718
+ WebhookEventType.LOGGED_OUT; // "LoggedOut"
719
+ WebhookEventType.KEEP_ALIVE_RESTORED; // "KeepAliveRestored"
720
+ WebhookEventType.KEEP_ALIVE_TIMEOUT; // "KeepAliveTimeout"
721
+ WebhookEventType.CLIENT_OUTDATED; // "ClientOutdated"
722
+ WebhookEventType.TEMPORARY_BAN; // "TemporaryBan"
723
+ WebhookEventType.STREAM_ERROR; // "StreamError"
724
+ WebhookEventType.STREAM_REPLACED; // "StreamReplaced"
725
+ ```
726
+
727
+ #### 🔐 **Authentication Events**
728
+
729
+ ```typescript
730
+ WebhookEventType.QR; // "QR"
731
+ WebhookEventType.QR_SCANNED_WITHOUT_MULTIDEVICE; // "QRScannedWithoutMultidevice"
732
+ WebhookEventType.PAIR_SUCCESS; // "PairSuccess"
733
+ WebhookEventType.PAIR_ERROR; // "PairError"
734
+ ```
735
+
736
+ #### 💬 **Message Events**
737
+
738
+ ```typescript
739
+ WebhookEventType.MESSAGE; // "Message"
740
+ WebhookEventType.UNDECRYPTABLE_MESSAGE; // "UndecryptableMessage"
741
+ WebhookEventType.RECEIPT; // "Receipt"
742
+ WebhookEventType.MEDIA_RETRY; // "MediaRetry"
743
+ ```
744
+
745
+ #### 👥 **Group Events**
746
+
747
+ ```typescript
748
+ WebhookEventType.GROUP_INFO; // "GroupInfo"
749
+ WebhookEventType.JOINED_GROUP; // "JoinedGroup"
750
+ ```
751
+
752
+ #### 👤 **User & Contact Events**
753
+
754
+ ```typescript
755
+ WebhookEventType.PICTURE; // "Picture"
756
+ WebhookEventType.USER_ABOUT; // "UserAbout"
757
+ WebhookEventType.PUSH_NAME_SETTING; // "PushNameSetting"
758
+ WebhookEventType.PRIVACY_SETTINGS; // "PrivacySettings"
759
+ WebhookEventType.PRESENCE; // "Presence"
760
+ WebhookEventType.CHAT_PRESENCE; // "ChatPresence"
761
+ WebhookEventType.IDENTITY_CHANGE; // "IdentityChange"
762
+ ```
763
+
764
+ #### 🚫 **Blocklist Events**
765
+
766
+ ```typescript
767
+ WebhookEventType.BLOCKLIST; // "Blocklist"
768
+ WebhookEventType.BLOCKLIST_CHANGE; // "BlocklistChange"
769
+ ```
770
+
771
+ #### 📱 **App State & Sync Events**
772
+
773
+ ```typescript
774
+ WebhookEventType.APP_STATE; // "AppState"
775
+ WebhookEventType.APP_STATE_SYNC_COMPLETE; // "AppStateSyncComplete"
776
+ WebhookEventType.HISTORY_SYNC; // "HistorySync"
777
+ WebhookEventType.OFFLINE_SYNC_COMPLETED; // "OfflineSyncCompleted"
778
+ WebhookEventType.OFFLINE_SYNC_PREVIEW; // "OfflineSyncPreview"
779
+ ```
780
+
781
+ #### 📞 **Call Events**
782
+
783
+ ```typescript
784
+ WebhookEventType.CALL_OFFER; // "CallOffer"
785
+ WebhookEventType.CALL_ACCEPT; // "CallAccept"
786
+ WebhookEventType.CALL_TERMINATE; // "CallTerminate"
787
+ WebhookEventType.CALL_OFFER_NOTICE; // "CallOfferNotice"
788
+ WebhookEventType.CALL_RELAY_LATENCY; // "CallRelayLatency"
789
+ ```
790
+
791
+ #### 📰 **Newsletter Events**
792
+
793
+ ```typescript
794
+ WebhookEventType.NEWSLETTER_JOIN; // "NewsletterJoin"
795
+ WebhookEventType.NEWSLETTER_LEAVE; // "NewsletterLeave"
796
+ WebhookEventType.NEWSLETTER_MUTE_CHANGE; // "NewsletterMuteChange"
797
+ WebhookEventType.NEWSLETTER_LIVE_UPDATE; // "NewsletterLiveUpdate"
798
+ ```
799
+
800
+ #### 🔧 **System Events**
801
+
802
+ ```typescript
803
+ WebhookEventType.CAT_REFRESH_ERROR; // "CATRefreshError"
804
+ WebhookEventType.FB_MESSAGE; // "FBMessage"
805
+ ```
806
+
807
+ ### 📦 **Webhook Payload Structure**
808
+
809
+ All webhook payloads follow this structure:
810
+
811
+ ```typescript
812
+ {
813
+ "event": { /* Event-specific data */ },
814
+ "type": "Message", // Event type from the list above
815
+ "token": "YOUR_TOKEN", // Your authentication token
816
+
817
+ // Optional media fields (when media is involved)
818
+ "s3": {
819
+ "url": "https://bucket.s3.amazonaws.com/media/file.jpg",
820
+ "key": "media/file.jpg",
821
+ "bucket": "your-bucket",
822
+ "size": 1024000,
823
+ "mimeType": "image/jpeg",
824
+ "fileName": "file.jpg"
825
+ },
826
+ "base64": "data:image/jpeg;base64,/9j/4AAQ...",
827
+ "mimeType": "image/jpeg",
828
+ "fileName": "image.jpg"
829
+ }
830
+ ```
831
+
832
+ ### 🎯 **Event Subscription Examples**
833
+
834
+ ```typescript
835
+ // Subscribe to all message-related events
836
+ await client.webhook.setWebhook("https://your-server.com/webhook", [
837
+ "Message",
838
+ "UndecryptableMessage",
839
+ "Receipt",
840
+ "MediaRetry",
841
+ ]);
842
+
843
+ // Subscribe to connection events only
844
+ await client.webhook.setWebhook("https://your-server.com/webhook", [
845
+ "Connected",
846
+ "Disconnected",
847
+ "LoggedOut",
848
+ "QR",
849
+ ]);
850
+
851
+ // Subscribe to group events
852
+ await client.webhook.setWebhook("https://your-server.com/webhook", [
853
+ "GroupInfo",
854
+ "JoinedGroup",
855
+ ]);
856
+
857
+ // Subscribe to all events
858
+ await client.webhook.setWebhook("https://your-server.com/webhook", ["All"]);
859
+
860
+ // TypeScript: Use enum for type safety
861
+ import { WebhookEventType } from "wuzapi";
862
+ await client.webhook.setWebhook("https://your-server.com/webhook", [
863
+ WebhookEventType.MESSAGE,
864
+ WebhookEventType.RECEIPT,
865
+ WebhookEventType.CONNECTED,
866
+ WebhookEventType.QR,
867
+ ]);
664
868
  ```
665
869
 
666
870
  </details>
@@ -706,29 +910,83 @@ app.post("/webhook", async (req, res) => {
706
910
  try {
707
911
  const webhookPayload = req.body;
708
912
 
709
- // Handle S3 media if present
710
- if (hasS3Media(webhookPayload)) {
711
- console.log("S3 Media:", webhookPayload.s3.url);
913
+ // Validate payload structure with token and type
914
+ if (
915
+ !webhookPayload.token ||
916
+ !webhookPayload.type ||
917
+ !webhookPayload.event
918
+ ) {
919
+ return res
920
+ .status(400)
921
+ .json({ error: "Invalid webhook payload structure" });
712
922
  }
713
923
 
714
- const event = webhookPayload.event || webhookPayload;
924
+ // Verify token (optional security check)
925
+ if (webhookPayload.token !== "your-expected-token") {
926
+ return res.status(401).json({ error: "Invalid webhook token" });
927
+ }
715
928
 
716
- // Handle messages
717
- if (event.Message && event.Info) {
718
- const messageContent = getMessageContent(event.Message);
719
- const from = event.Info.RemoteJid.replace("@s.whatsapp.net", "");
929
+ console.log(`Received webhook event: ${webhookPayload.type}`);
720
930
 
721
- if (messageContent?.type === "text") {
722
- console.log(`Message from ${from}: ${messageContent.content}`);
931
+ // Handle S3 media if present
932
+ if (hasS3Media(webhookPayload)) {
933
+ console.log("S3 Media:", webhookPayload.s3.url);
934
+ }
723
935
 
724
- // Auto-reply
725
- if (messageContent.content.toLowerCase().includes("hello")) {
726
- await client.chat.sendText({
727
- Phone: from,
728
- Body: "Hello! 👋 How can I help you?",
729
- });
936
+ const event = webhookPayload.event;
937
+
938
+ // Handle different event types
939
+ switch (webhookPayload.type) {
940
+ case "Message":
941
+ if (event.Message && event.Info) {
942
+ const messageContent = getMessageContent(event.Message);
943
+ const from = event.Info.RemoteJid.replace("@s.whatsapp.net", "");
944
+
945
+ if (messageContent?.type === "text") {
946
+ console.log(`Message from ${from}: ${messageContent.content}`);
947
+
948
+ // Auto-reply
949
+ if (messageContent.content.toLowerCase().includes("hello")) {
950
+ await client.chat.sendText({
951
+ Phone: from,
952
+ Body: "Hello! 👋 How can I help you?",
953
+ });
954
+ }
955
+ }
730
956
  }
731
- }
957
+ break;
958
+
959
+ case "Receipt":
960
+ console.log("Message receipt:", event.Type, event.MessageIDs);
961
+ break;
962
+
963
+ case "Connected":
964
+ console.log("✅ WhatsApp connected successfully");
965
+ break;
966
+
967
+ case "Disconnected":
968
+ console.log("❌ WhatsApp disconnected");
969
+ break;
970
+
971
+ case "QR":
972
+ console.log("📱 QR Code received:", event.Codes);
973
+ break;
974
+
975
+ case "GroupInfo":
976
+ console.log("👥 Group info updated:", event.GroupName);
977
+ break;
978
+
979
+ case "Presence":
980
+ console.log(
981
+ "👤 User presence:",
982
+ event.From,
983
+ event.Unavailable ? "offline" : "online"
984
+ );
985
+ break;
986
+
987
+ // Handle all other webhook events
988
+ default:
989
+ console.log(`Unhandled event type: ${webhookPayload.type}`, event);
732
990
  }
733
991
 
734
992
  res.json({ success: true });
package/dist/index.js CHANGED
@@ -2,6 +2,7 @@
2
2
  Object.defineProperties(exports, { __esModule: { value: true }, [Symbol.toStringTag]: { value: "Module" } });
3
3
  const wuzapiClient = require("./wuzapi-client.js");
4
4
  const client = require("./client.js");
5
+ const webhook = require("./webhook.js");
5
6
  const types_index = require("./types/index.js");
6
7
  const modules_admin = require("./modules/admin.js");
7
8
  const modules_session = require("./modules/session.js");
@@ -13,6 +14,12 @@ const modules_newsletter = require("./modules/newsletter.js");
13
14
  exports.WuzapiClient = wuzapiClient.WuzapiClient;
14
15
  exports.default = wuzapiClient.WuzapiClient;
15
16
  exports.WuzapiError = client.WuzapiError;
17
+ exports.WEBHOOK_EVENTS = webhook.WEBHOOK_EVENTS;
18
+ exports.WebhookEventType = webhook.WebhookEventType;
19
+ exports.hasBase64Media = webhook.hasBase64Media;
20
+ exports.hasBothMedia = webhook.hasBothMedia;
21
+ exports.hasS3Media = webhook.hasS3Media;
22
+ exports.isValidWebhookPayload = webhook.isValidWebhookPayload;
16
23
  exports.BotPluginSearchProvider = types_index.BotPluginSearchProvider;
17
24
  exports.BotPluginType = types_index.BotPluginType;
18
25
  exports.ButtonType = types_index.ButtonType;
@@ -42,9 +49,6 @@ exports.UnavailableType = types_index.UnavailableType;
42
49
  exports.VideoAttribution = types_index.VideoAttribution;
43
50
  exports.VideoSourceType = types_index.VideoSourceType;
44
51
  exports.getMessageContent = types_index.getMessageContent;
45
- exports.hasBase64Media = types_index.hasBase64Media;
46
- exports.hasBothMedia = types_index.hasBothMedia;
47
- exports.hasS3Media = types_index.hasS3Media;
48
52
  exports.AdminModule = modules_admin.AdminModule;
49
53
  exports.SessionModule = modules_session.SessionModule;
50
54
  exports.UserModule = modules_user.UserModule;
package/dist/index.js.map CHANGED
@@ -1 +1 @@
1
- {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
1
+ {"version":3,"file":"index.js","sources":[],"sourcesContent":[],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;"}
@@ -10,16 +10,12 @@ export declare class AdminModule extends BaseClient {
10
10
  * Add a new user
11
11
  */
12
12
  addUser(user: CreateUserRequest, options?: RequestOptions): Promise<CreateUserResponse>;
13
- /**
14
- * Get a specific user by ID
15
- */
16
- getUser(id: number, options?: RequestOptions): Promise<User>;
17
13
  /**
18
14
  * Delete a user by ID
19
15
  */
20
- deleteUser(id: number, options?: RequestOptions): Promise<DeleteUserResponse>;
16
+ deleteUser(id: string, options?: RequestOptions): Promise<DeleteUserResponse>;
21
17
  /**
22
18
  * Delete a user completely (full deletion) by ID
23
19
  */
24
- deleteUserComplete(id: number, options?: RequestOptions): Promise<DeleteUserResponse>;
20
+ deleteUserComplete(id: string, options?: RequestOptions): Promise<DeleteUserResponse>;
25
21
  }
@@ -14,12 +14,6 @@ class AdminModule extends client.BaseClient {
14
14
  async addUser(user, options) {
15
15
  return this.post("/admin/users", user, options);
16
16
  }
17
- /**
18
- * Get a specific user by ID
19
- */
20
- async getUser(id, options) {
21
- return this.get(`/admin/users/${id}`, options);
22
- }
23
17
  /**
24
18
  * Delete a user by ID
25
19
  */
@@ -1 +1 @@
1
- {"version":3,"file":"admin.js","sources":["../../src/modules/admin.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n User,\n CreateUserRequest,\n CreateUserResponse,\n DeleteUserResponse,\n} from \"../types/admin.js\";\n\nexport class AdminModule extends BaseClient {\n /**\n * List all users\n */\n async listUsers(options?: RequestOptions): Promise<User[]> {\n return this.get<User[]>(\"/admin/users\", options);\n }\n\n /**\n * Add a new user\n */\n async addUser(\n user: CreateUserRequest,\n options?: RequestOptions\n ): Promise<CreateUserResponse> {\n return this.post<CreateUserResponse>(\"/admin/users\", user, options);\n }\n\n /**\n * Get a specific user by ID\n */\n async getUser(id: number, options?: RequestOptions): Promise<User> {\n return this.get<User>(`/admin/users/${id}`, options);\n }\n\n /**\n * Delete a user by ID\n */\n async deleteUser(\n id: number,\n options?: RequestOptions\n ): Promise<DeleteUserResponse> {\n return this.delete<DeleteUserResponse>(`/admin/users/${id}`, options);\n }\n\n /**\n * Delete a user completely (full deletion) by ID\n */\n async deleteUserComplete(\n id: number,\n options?: RequestOptions\n ): Promise<DeleteUserResponse> {\n return this.delete<DeleteUserResponse>(`/admin/users/${id}/full`, options);\n }\n}\n"],"names":["BaseClient"],"mappings":";;;AASO,MAAM,oBAAoBA,OAAAA,WAAW;AAAA;AAAA;AAAA;AAAA,EAI1C,MAAM,UAAU,SAA2C;AACzD,WAAO,KAAK,IAAY,gBAAgB,OAAO;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QACJ,MACA,SAC6B;AAC7B,WAAO,KAAK,KAAyB,gBAAgB,MAAM,OAAO;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QAAQ,IAAY,SAAyC;AACjE,WAAO,KAAK,IAAU,gBAAgB,EAAE,IAAI,OAAO;AAAA,EACrD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,WACJ,IACA,SAC6B;AAC7B,WAAO,KAAK,OAA2B,gBAAgB,EAAE,IAAI,OAAO;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,mBACJ,IACA,SAC6B;AAC7B,WAAO,KAAK,OAA2B,gBAAgB,EAAE,SAAS,OAAO;AAAA,EAC3E;AACF;;"}
1
+ {"version":3,"file":"admin.js","sources":["../../src/modules/admin.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n User,\n CreateUserRequest,\n CreateUserResponse,\n DeleteUserResponse,\n} from \"../types/admin.js\";\n\nexport class AdminModule extends BaseClient {\n /**\n * List all users\n */\n async listUsers(options?: RequestOptions): Promise<User[]> {\n return this.get<User[]>(\"/admin/users\", options);\n }\n\n /**\n * Add a new user\n */\n async addUser(\n user: CreateUserRequest,\n options?: RequestOptions\n ): Promise<CreateUserResponse> {\n return this.post<CreateUserResponse>(\"/admin/users\", user, options);\n }\n\n /**\n * Delete a user by ID\n */\n async deleteUser(\n id: string,\n options?: RequestOptions\n ): Promise<DeleteUserResponse> {\n return this.delete<DeleteUserResponse>(`/admin/users/${id}`, options);\n }\n\n /**\n * Delete a user completely (full deletion) by ID\n */\n async deleteUserComplete(\n id: string,\n options?: RequestOptions\n ): Promise<DeleteUserResponse> {\n return this.delete<DeleteUserResponse>(`/admin/users/${id}/full`, options);\n }\n}\n"],"names":["BaseClient"],"mappings":";;;AASO,MAAM,oBAAoBA,OAAAA,WAAW;AAAA;AAAA;AAAA;AAAA,EAI1C,MAAM,UAAU,SAA2C;AACzD,WAAO,KAAK,IAAY,gBAAgB,OAAO;AAAA,EACjD;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,QACJ,MACA,SAC6B;AAC7B,WAAO,KAAK,KAAyB,gBAAgB,MAAM,OAAO;AAAA,EACpE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,WACJ,IACA,SAC6B;AAC7B,WAAO,KAAK,OAA2B,gBAAgB,EAAE,IAAI,OAAO;AAAA,EACtE;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,mBACJ,IACA,SAC6B;AAC7B,WAAO,KAAK,OAA2B,gBAAgB,EAAE,SAAS,OAAO;AAAA,EAC3E;AACF;;"}
@@ -1,6 +1,6 @@
1
1
  import { BaseClient } from '../client.js';
2
2
  import { RequestOptions } from '../types/common.js';
3
- import { SendMessageResponse, SendTextRequest, SendTemplateRequest, SendAudioRequest, SendImageRequest, SendDocumentRequest, SendVideoRequest, SendStickerRequest, SendLocationRequest, SendContactRequest, ChatPresenceRequest, MarkReadRequest, ReactRequest, DownloadMediaRequest, DownloadMediaResponse, DeleteMessageRequest, DeleteMessageResponse, SendButtonsRequest, EditMessageRequest, ListSection } from '../types/chat.js';
3
+ import { SendMessageResponse, SendTextRequest, SendTemplateRequest, SendAudioRequest, SendImageRequest, SendDocumentRequest, SendVideoRequest, SendStickerRequest, SendLocationRequest, SendContactRequest, ChatPresenceRequest, MarkReadRequest, ReactRequest, DownloadMediaRequest, DownloadMediaResponse, DeleteMessageResponse, SendButtonsRequest, ListSection } from '../types/chat.js';
4
4
  export declare class ChatModule extends BaseClient {
5
5
  /**
6
6
  * Send a text message
@@ -69,7 +69,7 @@ export declare class ChatModule extends BaseClient {
69
69
  /**
70
70
  * Delete a message
71
71
  */
72
- deleteMessage(request: DeleteMessageRequest, options?: RequestOptions): Promise<DeleteMessageResponse>;
72
+ deleteMessage(messageId: string, options?: RequestOptions): Promise<DeleteMessageResponse>;
73
73
  /**
74
74
  * Send interactive buttons message
75
75
  */
@@ -85,5 +85,5 @@ export declare class ChatModule extends BaseClient {
85
85
  /**
86
86
  * Edit a message
87
87
  */
88
- editMessage(request: EditMessageRequest, options?: RequestOptions): Promise<SendMessageResponse>;
88
+ editMessage(messageId: string, phone: string, newBody: string, options?: RequestOptions): Promise<SendMessageResponse>;
89
89
  }
@@ -137,7 +137,8 @@ class ChatModule extends client.BaseClient {
137
137
  /**
138
138
  * Delete a message
139
139
  */
140
- async deleteMessage(request, options) {
140
+ async deleteMessage(messageId, options) {
141
+ const request = { Id: messageId };
141
142
  return this.post("/chat/delete", request, options);
142
143
  }
143
144
  /**
@@ -184,7 +185,12 @@ class ChatModule extends client.BaseClient {
184
185
  /**
185
186
  * Edit a message
186
187
  */
187
- async editMessage(request, options) {
188
+ async editMessage(messageId, phone, newBody, options) {
189
+ const request = {
190
+ Id: messageId,
191
+ Phone: phone,
192
+ Body: newBody
193
+ };
188
194
  return this.post("/chat/send/edit", request, options);
189
195
  }
190
196
  }
@@ -1 +1 @@
1
- {"version":3,"file":"chat.js","sources":["../../src/modules/chat.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n SendMessageResponse,\n SendTextRequest,\n SendTemplateRequest,\n SendAudioRequest,\n SendImageRequest,\n SendDocumentRequest,\n SendVideoRequest,\n SendStickerRequest,\n SendLocationRequest,\n SendContactRequest,\n ChatPresenceRequest,\n MarkReadRequest,\n ReactRequest,\n DownloadMediaRequest,\n DownloadMediaResponse,\n DeleteMessageRequest,\n DeleteMessageResponse,\n SendButtonsRequest,\n SendListRequest,\n SendPollRequest,\n EditMessageRequest,\n ListSection,\n} from \"../types/chat.js\";\n\nexport class ChatModule extends BaseClient {\n /**\n * Send a text message\n */\n async sendText(\n request: SendTextRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/text\", request, options);\n }\n\n /**\n * Send a template message with buttons\n */\n async sendTemplate(\n request: SendTemplateRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/template\",\n request,\n options\n );\n }\n\n /**\n * Send an audio message\n */\n async sendAudio(\n request: SendAudioRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/audio\", request, options);\n }\n\n /**\n * Send an image message\n */\n async sendImage(\n request: SendImageRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/image\", request, options);\n }\n\n /**\n * Send a document message\n */\n async sendDocument(\n request: SendDocumentRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/document\",\n request,\n options\n );\n }\n\n /**\n * Send a video message\n */\n async sendVideo(\n request: SendVideoRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/video\", request, options);\n }\n\n /**\n * Send a sticker message\n */\n async sendSticker(\n request: SendStickerRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/sticker\",\n request,\n options\n );\n }\n\n /**\n * Send a location message\n */\n async sendLocation(\n request: SendLocationRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/location\",\n request,\n options\n );\n }\n\n /**\n * Send a contact message\n */\n async sendContact(\n request: SendContactRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/contact\",\n request,\n options\n );\n }\n\n /**\n * Send chat presence indication (typing indicator)\n */\n async sendPresence(\n request: ChatPresenceRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.post<void>(\"/chat/presence\", request, options);\n }\n\n /**\n * Mark messages as read\n */\n async markRead(\n request: MarkReadRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.post<void>(\"/chat/markread\", request, options);\n }\n\n /**\n * React to a message\n */\n async react(\n request: ReactRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/react\", request, options);\n }\n\n /**\n * Download an image from a message\n */\n async downloadImage(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadimage\",\n request,\n options\n );\n }\n\n /**\n * Download a video from a message\n */\n async downloadVideo(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadvideo\",\n request,\n options\n );\n }\n\n /**\n * Download an audio from a message\n */\n async downloadAudio(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadaudio\",\n request,\n options\n );\n }\n\n /**\n * Download a document from a message\n */\n async downloadDocument(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloaddocument\",\n request,\n options\n );\n }\n\n /**\n * Delete a message\n */\n async deleteMessage(\n request: DeleteMessageRequest,\n options?: RequestOptions\n ): Promise<DeleteMessageResponse> {\n return this.post<DeleteMessageResponse>(\"/chat/delete\", request, options);\n }\n\n /**\n * Send interactive buttons message\n */\n async sendButtons(\n request: SendButtonsRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/buttons\",\n request,\n options\n );\n }\n\n /**\n * Send list message\n */\n async sendList(\n phone: string,\n buttonText: string,\n description: string,\n topText: string,\n sections?: ListSection[],\n footerText?: string,\n id?: string,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n const request: SendListRequest = {\n Phone: phone,\n ButtonText: buttonText,\n Desc: description,\n TopText: topText,\n Sections: sections,\n FooterText: footerText,\n Id: id,\n };\n return this.post<SendMessageResponse>(\"/chat/send/list\", request, options);\n }\n\n /**\n * Send poll message\n */\n async sendPoll(\n groupJID: string,\n header: string,\n options: string[],\n id?: string,\n requestOptions?: RequestOptions\n ): Promise<SendMessageResponse> {\n const request: SendPollRequest = {\n Group: groupJID,\n Header: header,\n Options: options,\n Id: id,\n };\n return this.post<SendMessageResponse>(\n \"/chat/send/poll\",\n request,\n requestOptions\n );\n }\n\n /**\n * Edit a message\n */\n async editMessage(\n request: EditMessageRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/edit\", request, options);\n }\n}\n"],"names":["BaseClient"],"mappings":";;;AA2BO,MAAM,mBAAmBA,OAAAA,WAAW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,mBAAmB,SAAS,OAAO;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,SACJ,UACA,QACA,SACA,IACA,gBAC8B;AAC9B,UAAM,UAA2B;AAAA,MAC/B,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,IAAI;AAAA,IAAA;AAEN,WAAO,KAAK;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,YACJ,SACA,SAC8B;AAC9B,WAAO,KAAK,KAA0B,mBAAmB,SAAS,OAAO;AAAA,EAC3E;AACF;;"}
1
+ {"version":3,"file":"chat.js","sources":["../../src/modules/chat.ts"],"sourcesContent":["import { BaseClient } from \"../client.js\";\nimport { RequestOptions } from \"../types/common.js\";\nimport {\n SendMessageResponse,\n SendTextRequest,\n SendTemplateRequest,\n SendAudioRequest,\n SendImageRequest,\n SendDocumentRequest,\n SendVideoRequest,\n SendStickerRequest,\n SendLocationRequest,\n SendContactRequest,\n ChatPresenceRequest,\n MarkReadRequest,\n ReactRequest,\n DownloadMediaRequest,\n DownloadMediaResponse,\n DeleteMessageRequest,\n DeleteMessageResponse,\n SendButtonsRequest,\n SendListRequest,\n SendPollRequest,\n EditMessageRequest,\n ListSection,\n} from \"../types/chat.js\";\n\nexport class ChatModule extends BaseClient {\n /**\n * Send a text message\n */\n async sendText(\n request: SendTextRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/text\", request, options);\n }\n\n /**\n * Send a template message with buttons\n */\n async sendTemplate(\n request: SendTemplateRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/template\",\n request,\n options\n );\n }\n\n /**\n * Send an audio message\n */\n async sendAudio(\n request: SendAudioRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/audio\", request, options);\n }\n\n /**\n * Send an image message\n */\n async sendImage(\n request: SendImageRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/image\", request, options);\n }\n\n /**\n * Send a document message\n */\n async sendDocument(\n request: SendDocumentRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/document\",\n request,\n options\n );\n }\n\n /**\n * Send a video message\n */\n async sendVideo(\n request: SendVideoRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/send/video\", request, options);\n }\n\n /**\n * Send a sticker message\n */\n async sendSticker(\n request: SendStickerRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/sticker\",\n request,\n options\n );\n }\n\n /**\n * Send a location message\n */\n async sendLocation(\n request: SendLocationRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/location\",\n request,\n options\n );\n }\n\n /**\n * Send a contact message\n */\n async sendContact(\n request: SendContactRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/contact\",\n request,\n options\n );\n }\n\n /**\n * Send chat presence indication (typing indicator)\n */\n async sendPresence(\n request: ChatPresenceRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.post<void>(\"/chat/presence\", request, options);\n }\n\n /**\n * Mark messages as read\n */\n async markRead(\n request: MarkReadRequest,\n options?: RequestOptions\n ): Promise<void> {\n await this.post<void>(\"/chat/markread\", request, options);\n }\n\n /**\n * React to a message\n */\n async react(\n request: ReactRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\"/chat/react\", request, options);\n }\n\n /**\n * Download an image from a message\n */\n async downloadImage(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadimage\",\n request,\n options\n );\n }\n\n /**\n * Download a video from a message\n */\n async downloadVideo(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadvideo\",\n request,\n options\n );\n }\n\n /**\n * Download an audio from a message\n */\n async downloadAudio(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloadaudio\",\n request,\n options\n );\n }\n\n /**\n * Download a document from a message\n */\n async downloadDocument(\n request: DownloadMediaRequest,\n options?: RequestOptions\n ): Promise<DownloadMediaResponse> {\n return this.post<DownloadMediaResponse>(\n \"/chat/downloaddocument\",\n request,\n options\n );\n }\n\n /**\n * Delete a message\n */\n async deleteMessage(\n messageId: string,\n options?: RequestOptions\n ): Promise<DeleteMessageResponse> {\n const request: DeleteMessageRequest = { Id: messageId };\n return this.post<DeleteMessageResponse>(\"/chat/delete\", request, options);\n }\n\n /**\n * Send interactive buttons message\n */\n async sendButtons(\n request: SendButtonsRequest,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n return this.post<SendMessageResponse>(\n \"/chat/send/buttons\",\n request,\n options\n );\n }\n\n /**\n * Send list message\n */\n async sendList(\n phone: string,\n buttonText: string,\n description: string,\n topText: string,\n sections?: ListSection[],\n footerText?: string,\n id?: string,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n const request: SendListRequest = {\n Phone: phone,\n ButtonText: buttonText,\n Desc: description,\n TopText: topText,\n Sections: sections,\n FooterText: footerText,\n Id: id,\n };\n return this.post<SendMessageResponse>(\"/chat/send/list\", request, options);\n }\n\n /**\n * Send poll message\n */\n async sendPoll(\n groupJID: string,\n header: string,\n options: string[],\n id?: string,\n requestOptions?: RequestOptions\n ): Promise<SendMessageResponse> {\n const request: SendPollRequest = {\n Group: groupJID,\n Header: header,\n Options: options,\n Id: id,\n };\n return this.post<SendMessageResponse>(\n \"/chat/send/poll\",\n request,\n requestOptions\n );\n }\n\n /**\n * Edit a message\n */\n async editMessage(\n messageId: string,\n phone: string,\n newBody: string,\n options?: RequestOptions\n ): Promise<SendMessageResponse> {\n const request: EditMessageRequest = {\n Id: messageId,\n Phone: phone,\n Body: newBody,\n };\n return this.post<SendMessageResponse>(\"/chat/send/edit\", request, options);\n }\n}\n"],"names":["BaseClient"],"mappings":";;;AA2BO,MAAM,mBAAmBA,OAAAA,WAAW;AAAA;AAAA;AAAA;AAAA,EAIzC,MAAM,SACJ,SACA,SAC8B;AAC9B,WAAO,KAAK,KAA0B,mBAAmB,SAAS,OAAO;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aACJ,SACA,SAC8B;AAC9B,WAAO,KAAK;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UACJ,SACA,SAC8B;AAC9B,WAAO,KAAK,KAA0B,oBAAoB,SAAS,OAAO;AAAA,EAC5E;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UACJ,SACA,SAC8B;AAC9B,WAAO,KAAK,KAA0B,oBAAoB,SAAS,OAAO;AAAA,EAC5E;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aACJ,SACA,SAC8B;AAC9B,WAAO,KAAK;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,UACJ,SACA,SAC8B;AAC9B,WAAO,KAAK,KAA0B,oBAAoB,SAAS,OAAO;AAAA,EAC5E;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,YACJ,SACA,SAC8B;AAC9B,WAAO,KAAK;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,aACJ,SACA,SAC8B;AAC9B,WAAO,KAAK;AAAA,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AC9B,WAAO,KAAK;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,SACJ,OACA,YACA,aACA,SACA,UACA,YACA,IACA,SAC8B;AAC9B,UAAM,UAA2B;AAAA,MAC/B,OAAO;AAAA,MACP,YAAY;AAAA,MACZ,MAAM;AAAA,MACN,SAAS;AAAA,MACT,UAAU;AAAA,MACV,YAAY;AAAA,MACZ,IAAI;AAAA,IAAA;AAEN,WAAO,KAAK,KAA0B,mBAAmB,SAAS,OAAO;AAAA,EAC3E;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,SACJ,UACA,QACA,SACA,IACA,gBAC8B;AAC9B,UAAM,UAA2B;AAAA,MAC/B,OAAO;AAAA,MACP,QAAQ;AAAA,MACR,SAAS;AAAA,MACT,IAAI;AAAA,IAAA;AAEN,WAAO,KAAK;AAAA,MACV;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,EAEJ;AAAA;AAAA;AAAA;AAAA,EAKA,MAAM,YACJ,WACA,OACA,SACA,SAC8B;AAC9B,UAAM,UAA8B;AAAA,MAClC,IAAI;AAAA,MACJ,OAAO;AAAA,MACP,MAAM;AAAA,IAAA;AAER,WAAO,KAAK,KAA0B,mBAAmB,SAAS,OAAO;AAAA,EAC3E;AACF;;"}
@@ -9,7 +9,7 @@ export declare class GroupModule extends BaseClient {
9
9
  /**
10
10
  * Get group invite link
11
11
  */
12
- getInviteLink(groupJID: string, options?: RequestOptions): Promise<GroupInviteLinkResponse>;
12
+ getInviteLink(groupJID: string, reset?: boolean, options?: RequestOptions): Promise<GroupInviteLinkResponse>;
13
13
  /**
14
14
  * Get group information
15
15
  */
@@ -11,11 +11,10 @@ class GroupModule extends client.BaseClient {
11
11
  /**
12
12
  * Get group invite link
13
13
  */
14
- async getInviteLink(groupJID, options) {
15
- const request = { GroupJID: groupJID };
16
- return this.post(
17
- "/group/invitelink",
18
- request,
14
+ async getInviteLink(groupJID, reset = false, options) {
15
+ const params = `groupJID=${encodeURIComponent(groupJID)}&reset=${reset}`;
16
+ return this.get(
17
+ `/group/invitelink?${params}`,
19
18
  options
20
19
  );
21
20
  }
@@ -23,8 +22,8 @@ class GroupModule extends client.BaseClient {
23
22
  * Get group information
24
23
  */
25
24
  async getInfo(groupJID, options) {
26
- const request = { GroupJID: groupJID };
27
- return this.post("/group/info", request, options);
25
+ const params = `groupJID=${encodeURIComponent(groupJID)}`;
26
+ return this.get(`/group/info?${params}`, options);
28
27
  }
29
28
  /**
30
29
  * Change group photo (JPEG only)