whatsapp_sender_flutter
WhatsApp Sender Flutter는 Flutter용 비공식 API로, WhatsApp에 대량 메시지를 보낼 수 있습니다
WhatsApp Sender Flutter는 Flutter용 비공식 API로, WhatsApp에 대량 메시지를 보내는 데 사용됩니다
아래는 영문 원문 스냅샷입니다. 최신 내용은 GitHub에서 확인하세요.
pub package pub points pub popularity pub likes
WhatsApp Sender Flutter is an unofficial API for Flutter to send bulk messages in Whatsapp. It's not recommended using it in your company or for marketing purpose.
Thanks to rohitsangwan01 for reference!
In the pubspec.yaml of your flutter project, add the following dependency:
dependencies:
...
whatsapp_sender_flutter: latest
Import it:
import 'package:whatsapp_sender_flutter/whatsapp_sender_flutter.dart';
For the first usage, wait for the automatic download of the .local-chromium folder in your project root. Without this folder the package will not work,this is because this package is based on puppeteer.
The process for sending messages is like for WhatsApp Web:
After you have scanned the code, you can start the sending campaign.
All phones must contain the international prefix!
await WhatsAppSenderFlutter.send(
phones: [ "391111111", "391111111", "391111111"],
message: "Hello",
);
After you have scanned the code, you can start the sending campaign.
All phones must contain the international prefix!
await WhatsAppSenderFlutter.send(
phones: [ "391111111", "391111111", "391111111"],
message: "Hello",
file: File("path-to-file.pdf"),
);
New functions for listen changes:
onEvent(WhatsAppSenderFlutterStatus status), usethis function to listen the sending statusonQrCode(String qrCode), use this function to intercept the qrCodeonSending(WhatsAppSenderFlutterCounter counter), use this function to count the number of successful or unsuccessful submissions.onError(WhatsAppSenderFlutterErrorMessage errorMessage), use this feature to catch errors while sending await WhatsAppSenderFlutter.send(
phones: [ "391111111", "391111111", "391111111"],
message: "Hello",
file: File("path-to-file.pdf"),
onEvent: (WhatsAppSenderFlutterStatus status) {
print(status);
},
onQrCode: (String qrCode) {
print(qrCode);
},
onSending: (WhatsAppSenderFlutterCounter counter) {
print(counter.success.toString());
print(counter.fails.toString());
},
onError: (WhatsAppSenderFlutterErrorMessage errorMessage) {
print(errorMessage);
},
);
To know in detail the possible states of WhatsAppSenderFlutterStatus, WhatsAppSenderFlutterCounter, WhatsAppSenderFlutterErrorMessage read documentation
await WhatsAppSenderFlutter.send(
phones: [ "391111111", "391111111", "391111111"],
message: "Hello",
savedSessionDir: "./userData"
);
To save the session you must indicate a folder name in savedSessionDir.
If you save the session you will no longer have to scan the qr code !
Do not indicate savedSessionDir if you want to be asked to scan the qr code at each sending.