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

插件详情v4.0.1

whatsapp

一个用于集成 WhatsApp Business API 的 Flutter 包。直接从您的 Flutter 应用发送消息、产品、媒体和位置。

AndroidiOSWebmacOSWindowsLinux
近 30 天下载
196
喜欢数
212
Pub 分数
140

安装插件

flutter pub add whatsapp

插件介绍

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

一个 Flutter 包,可实现与 WhatsApp Business API 的集成,使开发者能够从其 Flutter 应用程序直接发送消息、产品目录、媒体文件和位置数据。专为无缝跨平台通信设计,支持 Android、iOS、Web、macOS、Windows 和 Linux。该包简化了通过 WhatsApp 发送丰富内容的过程,非常适合客户互动、订单确认和自动化通知。基于官方 WhatsApp Business API 构建,确保消息传递的可靠性和安全性。

适合场景

  • 发送订单确认
  • 自动客户通知
  • 共享产品目录
  • 发送位置更新
  • 共享媒体文件
  • 客户支持消息

主要特点

  • 支持包括文本、媒体和位置在内的消息类型
  • 与 WhatsApp Business API 集成
  • 跨平台兼容性
  • 使用 Flutter pub 轻松设置
  • 实时消息传递
  • 产品目录共享

适合对象

  • 电子商务应用
  • 客户服务平台
  • 商务沟通工具
  • 自动化通知系统
  • 需要 WhatsApp 集成的移动应用

使用建议

  • 需要 WhatsApp Business API 访问权限
  • 需要正确的身份验证设置
  • 可能需要企业账户验证
  • 速率限制适用
  • 依赖稳定的互联网连接
  • 遵守WhatsApp的政策

原始 README

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

WhatsApp Flutter Banner

This Flutter package allows you to integrate the WhatsApp Business API into your Flutter applications. It enables sending messages, media, templates, managing business information, creating interactives and flows, sending catalog messages, and more. The package is updated to support the latest WhatsApp Business API v23.0.

Pub Likes Pub Points Pub Monthly Downloads GitHub Issues GitHub PRs GitHub Forks

Rohit Chouhan Sponsor


Documentation

Full documentation for the WhatsApp Flutter package is available at whatsapp-flutter.github.io.

You can switch the documentation version using the version selector at the top of the page (version:).

Other useful links:


New Features in v4

  • Performance Improvements – Optimized core methods, now up to 3x faster than previous versions.
  • Web Platform Support – Now supports fully compatibility with Flutter Web for most features.
  • Service-Specific Methods – Each service now provides dedicated getters for cleaner and more explicit usage.
  • Flow Messages – Added support for interactive flow messages to improve user engagement.
  • Catalog & Product Messages – Send product details and catalog messages for e-commerce use cases.
  • Resumable Uploads – Support for creating and managing resumable upload sessions for large files.
  • Error Handling Enhancements – Improved and added WhatsAppException handling with detailed error types.
  • Bug Fixes – Resolved multiple issues affecting stability and reliability.
  • API Upgrade – Updated to support WhatsApp Business API v23.0 (stable).

Basic Usage

// Access token provided by Meta for WhatsApp Cloud API
const accessToken = 'YOUR_ACCESS_TOKEN';

// Your WhatsApp Business phone number ID
const fromNumberId = 'YOUR_PHONE_NUMBER_ID';

// Create WhatsApp client instance
final whatsapp = WhatsApp(accessToken, fromNumberId);

try {
  // Send a simple text message
  var message = await whatsapp.sendMessage(
    phoneNumber: 'RECEIPT_NUMBER', // Recipient's phone number in international format
    text: 'Hi, how are you?',      // Message content
  );

  // Message sent successfully
  // Get and print the unique ID of the sent message
  print('Message ID: ${message.getMessageId()}');
  // Get and print the recipient number
  print('Message sent to: ${message.getContactId()}');
  // Get and print the full API response body
  print('API Response: ${message.getFullResponse()}');
} on WhatsAppException catch (e) {
  // Message failed to send
  // Print HTTP error code returned by the API
  print('HTTP Code: ${e.statusCode}');
  // Print exact error details from WhatsApp Cloud API
  print('API Error: ${e.message}');
  // Print type of request error (e.g., validation, authorization, etc.)
  print('Request Error: ${e.errorType}');
} catch (e) {
  print('Unexpected error: $e');
}

📌 Looking for a Better Example?

👉 Check out this working example here:
🔗 pub.dev WhatsApp Example

Contributors

chouhan-rahul

Have you found a bug or have a suggestion of how to enhance WhatsApp Package? Open an issue or pull request and we will take a look at it as soon as possible.

Report bugs or issues

You are welcome to open a ticket on github if any problems arise. New ideas are always welcome.

Copyright and License

Copyright © 2022 Rohit Chouhan. Licensed under the MIT LICENSE.

所属分类

依赖

依赖清单 2 项

源码仓库

使用此插件的项目

暂无相关数据。