सार्वजनिक जानकारी से बना चयन मार्गदर्शन। केवल संदर्भ हेतु।
एक Flutter/Dart पैकेज जो Puppeteer के माध्यम से वेब स्क्रैपिंग के माध्यम से WhatsApp बॉट कार्यक्षमता सुनिश्चित करता है, डेस्कटॉप और वेब एप्लिकेशन के लिए डिज़ाइन किया गया है। यह डेवलपर्स को हेडलेस ब्राउज़र क्षमता का उपयोग करके WhatsApp वेब के साथ इंटरैक्शन को स्वचालित करने की अनुमति देता है। इस पैकेज का समर्थन वेब, macOS, Windows और Linux पर क्रॉस-प्लेटफॉर्म डेप्लॉयमेंट के लिए है, जो कस्टम मैसेजिंग टूल बनाने के लिए आदर्श है। यह Flutter प्रोजेक्ट में बिना किसी बाधा के एकीकृत होता है, जो Dart तर्क और ब्राउज़र-आधारित WhatsApp इंटरैक्शन के बीच एक सेतु प्रदान करता है।
उपयोग
स्वचालित ग्राहक समर्थन संदेश
बैच संदेश प्रसारण
योजित व्हाट्सएप सूचनाएं
इंटरैक्टिव चैटबॉट इंटरफेस
डेस्कटॉप-आधारित व्हाट्सएप स्वचालन
मुख्य विशेषताएँ
Puppeteer-संचालित WhatsApp Web छानबीन
क्रॉस-प्लेटफ़ॉर्म समर्थन (वेब, macOS, Windows, Linux)
Flutter और Dart प्रोजेक्ट एकीकरण
हेडलेस ब्राउज़र स्वचालन
रियल-टाइम संदेश प्रबंधन
हल्का और सेटअप करने में आसान
इनके लिए उपयुक्त
डेस्कटॉप/वेब व्हाट्सएप बॉट बनाने वाले डेवलपर्स
स्वचालित संदेश समाधान की आवश्यकता वाली टीमें
आधिकारिक API के बिना व्हाट्सएप एकीकरण की आवश्यकता वाले प्रोजेक्ट
शैक्षिक या प्रोटोटाइपिंग उपयोग केस
विचार योग्य बातें
WhatsApp Web के सार्वजनिक इंटरफ़ेस पर निर्भर है (अपडेट के साथ तोड़ा जा सकता है)
QR कोड के माध्यम से उपयोगकर्ता प्रमाणीकरण की आवश्यकता है
व्हाट्सएप से संभावित दर सीमा या बैन
व्हाट्सएप द्वारा आधिकारिक रूप से समर्थित नहीं
प्लेटफॉर्म के आधार पर स्थिर Puppeteer प्रदर्शन पर निर्भर करता है
मूल README
संबंधित सोर्स रिपॉज़िटरी के मूल README का स्नैपशॉट। नवीनतम सामग्री के लिए रिपॉज़िटरी देखें।
Whatsapp bot flutter
Getting Started
We can use this library in Flutter as well as Pure dart projects , checkout dart_example
First launch on Desktop apps will take some time, it will download chromium files locally, using puppeteer
Usage
Get WhatsappClient using connect method
Either link with QRCode (default) and get QrCode in onQrCode callback or set linkWithPhoneNumber, and get code in onPhoneLinkCode callback
// use WhatsappBotFlutterMobile.connect for Android/IOS platformsWhatsappClient? whatsappClient = awaitWhatsappBotFlutter.connect(
onConnectionEvent: (ConnectionEvent event) {
print(event.toString());
},
onQrCode: (String qr, Uint8List? imageBytes) {
// use imageBytes to display in flutter : Image.memory(imageBytes)print(WhatsappBotFlutter.convertStringToQrCode(qr));
},
);
We have these modules to access whatsappClient features :
phone parameter can be of this format : countryCode+phoneNumber , eg : 91xxxxxxxxxx , or we can get phone from messageEvents in this format : countryCode+phone+"@c.us"
Supported Whatsapp features :
- Create multiple whatsapp clients
Login with QR
Auto refresh QrCode
Logout
Keep session
Listen to whatsapp events
Reject calls
Send text message
Send image, audio & document
Send location message
Send poll in groups
Send contact card
Reply to a message
Archive/Unarchive chats
Mute/Unmute chat
Clear chat
Delete chat
Get lastSeen
Get chats
Mark messages as seen
Mark message as unread
Pin/Unpin chat
Delete messages
Download media
Get messages
Get profile picture
Get status
Get contacts
Get status of loggedIn user
Set status
check if logged in user have business account
Set profile picture of logged in user
and many more..
Mobile Setup (Android/IOS)
To setup on Android , make sure to checkout flutter_inappwebview documentation for Android and IOS setup
Android sdk:minSdkVersion cannot be smaller than version 19
Desktop setup (Windows/Mac/Linux)
For Macos , Enable outgoing and incoming connections, If getting sandbox issue , try disabling sandbox mode comment this out in macos/Runner/*.entitlements:
<key>com.apple.security.app-sandbox</key>
<true/>
Should run out of the box in Windows and Linux
Web setup
checkout web demo app : https://rohitsangwan01.github.io/whatsapp_bot_flutter
We can use browserless, Create a free account there and get API_TOKEN from browserless, and use this url to connect : wss://chrome.browserless.io?token=API_TOKEN
Or we can run puppeteer, and get browserWsEndpoint from there and pass into the connect method, checkout this example
then pass this browserWsEndpoint in connect method, and also requires wppJsContent, we can download this file from here, add this file in assets and pass like this,
We can use this on Mobile or Desktop platforms as well , to connect to a chrome server hosted somewhere else
If we have to access this webSocket url locally on Mobile or other platforms , we can use ngrok to expose our local Websocket url to internet
Resources
Thanks to wa-js for exporting functions from WhatsApp Web
Disclaimer
This project is not affiliated, associated, authorized, endorsed by, or in any way officially connected with WhatsApp or any of its subsidiaries or its affiliates. The official WhatsApp website can be found at https://whatsapp.com. "WhatsApp" as well as related names, marks, emblems and images are registered trademarks of their respective owners.
Note
Its just initial version, I can't guarantee you will not be blocked by using this method, try to avoid primary whatsapp numbers. WhatsApp does not allow bots or unofficial clients on their platform, so this shouldn't be considered totally safe.