@raphaelvserafim/client-api-whatsapp 1.3.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.
- package/README.md +154 -1
- 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
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@raphaelvserafim/client-api-whatsapp",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.4.0",
|
|
4
4
|
"description": "With our API, you can send text, audio, video, and image messages quickly and easily. Adapt to your business communication needs comprehensively.",
|
|
5
5
|
"main": "dist/index.js",
|
|
6
6
|
"types": "dist/index.d.ts",
|
|
@@ -21,6 +21,7 @@
|
|
|
21
21
|
"scripts": {
|
|
22
22
|
"build": "tsc --project tsconfig.compile.json",
|
|
23
23
|
"test": "echo \"Error: no test specified\" && exit 1",
|
|
24
|
+
"generate:llms": "node scripts/generate-llms-txt.js",
|
|
24
25
|
"deploy": "npm run build && npm publish --access=public"
|
|
25
26
|
},
|
|
26
27
|
"author": "Raphael Serafim <raphaelvserafim@gmail.com>",
|