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.
example/broadcastbuddy_example.dart
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 number is registered on WhatsApp
final check = await bb.isOnWhatsApp('233240001122');
print('Is Registered on WhatsApp: ${check.isRegistered}');
// 2. Send a WhatsApp Text Message
final msgRes = await bb.sendMessage(
'233240001122',
'🚀 Hello from Broadcast Buddy Dart/Flutter SDK!',
);
print('Message Sent: ${msgRes.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
await bb.sendImage(
'233240001122',
'https://example.com/receipt.png',
caption: 'Your Payment Receipt',
);
// 5. Send PDF Document / Invoice
await bb.sendDocument(
'233240001122',
'data:application/pdf;base64,...',
filename: 'Invoice_2026.pdf',
caption: '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();
}
}