搜尋套件、儲存庫與 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 項

原始碼儲存庫

使用此套件的專案

暫無相關資料。