搜索插件、代码仓与 APP 分类

插件详情v0.2.0

whatsapp_sender_flutter

WhatsApp Sender Flutter 是一个用于 Flutter 的非官方 API,可发送大量 WhatsApp 消息

macOSWindowsLinux
近 30 天下载
45
喜欢数
31
Pub 分数
125

安装插件

flutter pub add whatsapp_sender_flutter

插件介绍

基于插件公开信息、社区数据与项目使用情况整理的选型参考。

WhatsApp Sender Flutter 是一个非官方的 Flutter 包,使开发者能够以编程方式发送批量 WhatsApp 消息。它通过浏览器自动化方法与 WhatsApp Web API 集成,无需官方 WhatsApp API 访问即可实现消息传递。该包专为 macOS、Windows 和 Linux 等桌面平台设计,适用于自动通知、提醒或营销活动。该包需要手动设置,并依赖于活跃的 WhatsApp Web 会话。虽然功能正常,但其操作不符合官方 WhatsApp 的使用指南,可能存在账号被封禁的风险。

适合场景

  • 批量通知系统
  • 自动提醒
  • 营销活动工具
  • 客户联络
  • 事件邀请

主要特点

  • 批量消息发送
  • 桌面平台支持
  • 浏览器自动化后端
  • 与 Flutter 的简单集成
  • 会话持久性

适合对象

  • 开发桌面应用程序的开发者
  • 需要大规模消息传递的团队
  • 非商业自动化项目
  • 原型化 WhatsApp 集成

使用建议

  • 非官方 API 使用
  • 账户被封禁的风险
  • 需要手动设置会话
  • 仅限桌面平台
  • 无官方 WhatsApp 支持

原始 README

以下为关联源码仓库的 README 原文快照,最新内容请访问源码仓库。

WhatsApp Sender Flutter

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.

Buy Me A Book

Thanks to rohitsangwan01 for reference!

Getting Started

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';

Configuration

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.

Basic usage

The process for sending messages is like for WhatsApp Web:

  1. Scan the qr code
  2. Start the sending
Send text message

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",
   );
Send file message

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"),
   );
Listen changes

New functions for listen changes:

  1. onEvent(WhatsAppSenderFlutterStatus status), usethis function to listen the sending status
  2. onQrCode(String qrCode), use this function to intercept the qrCode
  3. onSending(WhatsAppSenderFlutterCounter counter), use this function to count the number of successful or unsuccessful submissions.
  4. 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

Save your session
   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.

To Do

  • Send text message ✔️
  • Multi session support ✔️
  • Send files ✔️
  • Native mobile support (Android, IOS)

License

MIT

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。