drago_whatsapp_flutter 0.1.3 copy "drago_whatsapp_flutter: ^0.1.3" to clipboard
drago_whatsapp_flutter: ^0.1.3 copied to clipboard

This plugin will allow to send text, files in the background using whatsapp web

drago_whatsapp_flutter #

A powerful Flutter plugin to automate WhatsApp Web interactions. Built on top of wa-js (WPPConnect) and flutter_inappwebview, it allows you to send messages, media, manage groups, and listen to events either headlessly or through an interactive UI.

Features #

  • 🚀 Fast Connect: Optimized initialization sequence and early script injection.
  • 🎭 Headless & Visual Modes: Run in the background or embed WhatsApp Web in your UI.
  • 📱 Messaging: Send text (edit/pin), images, videos, documents, and buttons/templates.
  • 👥 Group Management: Fetch groups, manage participants (promote/demote), and more.
  • 📉 Status/Story: Post text, image, and video updates to your status.
  • 🏷️ Labels: Full support for WhatsApp Business labels (list/add/delete).
  • 🔔 Event Stream: Real-time listeners for messages, calls, and connection states.
  • 💾 Session Management: Persistent login support for seamless restarts.
  • 🛠️ Customizable: Supply specific wa-js versions and configurations.

Platform Support #

Android iOS Windows macOS Linux Web

Getting Started #

Add the dependency to your pubspec.yaml:

dependencies:
  drago_whatsapp_flutter: ^0.1.0

or run:

flutter pub add drago_whatsapp_flutter

Basic Usage #

Initialize Headless Connection #

This is ideal for background bots.

WhatsappClient? client;

client = await DragoWhatsappFlutter.connect(
  saveSession: true,
  onConnectionEvent: (event) {
    print("Connection Event: ${event.name}");
  },
  onQrCode: (qrCodeUrl, imageBytes) {
    // Display QR Code to user
  },
);

if (client != null) {
  print("Connected successfully!");
}

Send a Message #

await client?.chat.sendTextMessage(
  phone: "1234567890", // With country code
  message: "Hello from Flutter!",
);

Send Media/Buttons #

// Send Image
await client?.chat.sendFileMessage(
  phone: "1234567890",
  fileBytes: imageBytes,
  fileType: WhatsappFileType.image,
  caption: "Check this out!",
);

// Send Buttons (Templates)
await client?.chat.sendTextMessage(
  phone: "1234567890",
  message: "Pick an option:",
  useTemplate: true,
  buttons: [
    MessageButtons(
      text: "Visit Google",
      buttonData: "https://google.com",
      buttonType: ButtonType.url,
    ),
  ],
);

Listen to Incoming Messages #

client?.on(WhatsappEvent.chatnewmessage, (data) {
  final List<Message> messages = Message.parse(data);
  for (var msg in messages) {
    print("New message from ${msg.from}: ${msg.body}");
  }
});

Advanced Configuration #

Using specific wa-js version #

You can specify a version from wa-js releases.

client = await DragoWhatsappFlutter.connect(
  wppVersion: "1.30.0",
);

Visual Browser Integration #

If you want the user to see the WhatsApp Web interface (useful for debugging or first-time login):

// In your UI using flutter_inappwebview
InAppWebView(
  onLoadStop: (controller, url) async {
    client = await DragoWhatsappFlutter.connectWithInAppBrowser(
      controller: controller,
    );
  },
)

Session Cleanup #

To logout and clear all saved credentials:

await client?.clearSession(); 

Credits #

This package is built using:

License #

This project is licensed under the MIT License - see the LICENSE file for details.

0
likes
0
points
568
downloads

Publisher

unverified uploader

Weekly Downloads

This plugin will allow to send text, files in the background using whatsapp web

Repository (GitHub)
View/report issues

License

unknown (license)

Dependencies

flutter, flutter_inappwebview, http, mime, zxing2

More

Packages that depend on drago_whatsapp_flutter