broadcastbuddy 1.0.1
broadcastbuddy: ^1.0.1 copied to clipboard
Official Dart & Flutter client SDK for Broadcast Buddy. Automated WhatsApp messaging, interactive polls, high-res media streaming, and real-time hotline diagnostics.
Broadcast Buddy Dart & Flutter SDK π #
Official Dart and Flutter client library for the Broadcast Buddy WhatsApp Gateway API. Send formatted text, interactive multi-choice polls, high-resolution media, PDF invoices, GPS location pins, and check real-time phone number registration on WhatsApp.
β¨ Features #
- Cross-Platform Compatibility β Works seamlessly across Flutter (iOS, Android, Web, macOS, Windows, Linux) and Server-side Dart (Dart Frog, Shelf).
- 100% Sound Null-Safety β Built for modern Dart 3+ with complete type safety.
- Interactive WhatsApp Polls β Create single and multi-select WhatsApp polls with one line of code.
- High-Res Media Streaming β Send images, documents, audio voice notes, and videos from URLs or Base64.
- Real-Time Number Verification β Verify if customer phone numbers exist on WhatsApp before dispatching broadcasts.
- Hotline Diagnostics β Monitor live WhatsApp session connection states.
π¦ Installation #
In your Dart or Flutter project, run:
dart pub add broadcastbuddy
Or for Flutter apps:
flutter pub add broadcastbuddy
π Quickstart #
import 'package:broadcastbuddy/broadcastbuddy.dart';
void main() async {
// Initialize with your API Key (Session ID)
final bb = BroadcastBuddy('bb_live_YOUR_API_KEY');
try {
// 1. Verify if a recipient is registered on WhatsApp
final check = await bb.isOnWhatsApp('233240001122');
print('On WhatsApp: ${check.isRegistered}');
// 2. Send a WhatsApp Text Message
final res = await bb.sendMessage(
'233240001122',
'π Hello from Broadcast Buddy Flutter SDK!',
);
print('Message Sent: ${res.success}');
// 3. Send an Interactive Multi-Choice Poll
await bb.sendPoll(
'233240001122',
'Which feature should we build next?',
['AI Auto-Pilot Agent', 'Custom Webhook Flows', 'Enterprise CRM Sync'],
isMultiSelect: false,
);
// 4. Send Image with Caption (URL or Base64)
await bb.sendImage(
'233240001122',
'https://example.com/receipt.png',
caption: 'Your Payment Receipt #1092',
);
// 5. Send PDF Document / Invoice
await bb.sendDocument(
'233240001122',
'data:application/pdf;base64,...',
filename: 'Invoice_2026.pdf',
caption: 'Here is your monthly invoice',
);
// 6. Check Hotline Connection Status
final status = await bb.getStatus();
print('Hotline Status: ${status.status} (Connected: ${status.success})');
} catch (e) {
print('Error: $e');
} finally {
bb.close();
}
}
π API Reference #
BroadcastBuddy(String apiKey, {String baseUrl, Duration timeout}) #
| Method | Arguments | Returns | Description |
|---|---|---|---|
sendMessage |
String phone, String text, {SendMessageOptions? options} |
Future<ApiResponse> |
Send formatted text message. |
sendPoll |
String phone, String question, List<String> options, {bool isMultiSelect = false} |
Future<ApiResponse> |
Send interactive multi-choice poll. |
sendImage |
String phone, String imageSource, {String caption = '', String filename = 'image.png'} |
Future<ApiResponse> |
Send JPG/PNG/WebP image (URL or Base64). |
sendDocument |
String phone, String docSource, {String filename = 'document.pdf', String caption = ''} |
Future<ApiResponse> |
Send PDF, Excel, Word, or zip document. |
sendAudio |
String phone, String audioSource, {String filename = 'audio.mp3'} |
Future<ApiResponse> |
Send audio voice notes. |
sendLocation |
String phone, double latitude, double longitude, {String name = '', String address = ''} |
Future<ApiResponse> |
Send a GPS Location / Map Pin. |
sendContact |
String phone, String name, String contactPhone, {String organization = ''} |
Future<ApiResponse> |
Send a Contact Card (vCard). |
scheduleMessage |
String phone, String message, dynamic scheduledTime |
Future<ApiResponse> |
Schedule message for future ISO timestamp. |
isOnWhatsApp |
String phone |
Future<WhatsAppNumberCheckResponse> |
Verify if a number exists on WhatsApp. |
getNumberId |
String phone |
Future<Map<String, dynamic>> |
Fetch standard WhatsApp JID format. |
getStatus |
- | Future<SessionStatusResponse> |
Check WhatsApp hotline connection state. |
π License #
MIT Β© Broadcast Buddy