Puppeteer를 통한 웹 스크래핑을 통해 WhatsApp 봇 기능을 가능하게 하는 Flutter/Dart 패키지로, 데스크톱 및 웹 애플리케이션용으로 설계되었습니다. 헤드리스 브라우저 기능을 활용하여 WhatsApp 웹과의 상호작용을 자동화할 수 있습니다. 웹, macOS, Windows, Linux에서의 크로스플랫폼 배포를 지원하여 맞춤형 메시징 도구 개발에 이상적입니다. Flutter 프로젝트에 원활하게 통합되며, Dart 로직과 브라우저 기반 WhatsApp 상호작용 사이의 다리를 제공합니다.
사용 사례
자동화된 고객 지원 메시지
대량 메시지 브로드캐스팅
예약된 웨이트스앱 알림
인터랙티브 챗봇 인터페이스
데스크톱 기반의 WhatsApp 자동화
주요 기능
Puppeteer 기반의 WhatsApp 웹 스크래핑
크로스 플랫폼 지원 (웹, macOS, Windows, Linux)
Flutter 및 Dart 프로젝트 통합
헤드리스 브라우저 자동화
실시간 메시지 처리
경량이며 설치가 간편합니다
적합한 대상
데스크톱/웹 WhatsApp 봇을 개발하는 개발자
자동 메시지 솔루션을 필요로 하는 팀
공식 API 없이 WhatsApp 통합을 필요로 하는 프로젝트
교육 또는 프로토타이핑 사용 사례
고려 사항
WhatsApp 웹의 공개 인터페이스에 의존합니다(업데이트로 인해 작동이 중단될 수 있음)
QR 코드를 통한 사용자 인증이 필요합니다
WhatsApp에서의 잠재적인 속도 제한 또는 금지
워그램에서 공식적으로 지원되지 않음
다양한 플랫폼에서 안정적인 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.