Flutterパッケージで、WhatsApp Business APIとの統合を可能にし、開発者がFlutterアプリからメッセージ、製品カタログ、メディアファイル、場所データを直接送信できるようにします。シームレスなクロスプラットフォーム通信を目的としており、Android、iOS、Web、macOS、Windows、Linuxをサポートしています。このパッケージは、WhatsAppを通じた豊富なコンテンツの送信を簡素化し、顧客エンゲージメント、注文確認、自動通知に最適です。公式のWhatsApp Business APIに基づいて構築されており、信頼性とセキュリティを確保したメッセージングを実現しています。
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.
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 APIconst accessToken = 'YOUR_ACCESS_TOKEN';
// Your WhatsApp Business phone number IDconst fromNumberId = 'YOUR_PHONE_NUMBER_ID';
// Create WhatsApp client instancefinal whatsapp = WhatsApp(accessToken, fromNumberId);
try {
// Send a simple text messagevar 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 messageprint('Message ID: ${message.getMessageId()}');
// Get and print the recipient numberprint('Message sent to: ${message.getContactId()}');
// Get and print the full API response bodyprint('API Response: ${message.getFullResponse()}');
} onWhatsAppExceptioncatch (e) {
// Message failed to send// Print HTTP error code returned by the APIprint('HTTP Code: ${e.statusCode}');
// Print exact error details from WhatsApp Cloud APIprint('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');
}
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.