wapilot_sdk 1.0.0 copy "wapilot_sdk: ^1.0.0" to clipboard
wapilot_sdk: ^1.0.0 copied to clipboard

Official Flutter/Dart SDK for WAPILOT.io - WhatsApp Business API Integration Platform. Easily manage contacts, send messages, handle templates, and automate responses.

example/lib/main.dart

import 'package:flutter/material.dart';
import 'package:wapilot_sdk/wapilot_sdk.dart';

void main() {
  runApp(const MyApp());
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return MaterialApp(
      title: 'WAPILOT SDK Demo',
      theme: ThemeData(
        primarySwatch: Colors.blue,
        useMaterial3: true,
      ),
      home: const MyHomePage(),
    );
  }
}

class MyHomePage extends StatefulWidget {
  const MyHomePage({super.key});

  @override
  State<MyHomePage> createState() => _MyHomePageState();
}

class _MyHomePageState extends State<MyHomePage> {
  final _wapilot = WapilotSDK(token: 'your-api-token');
  final _phoneController = TextEditingController();
  final _messageController = TextEditingController();
  String _result = '';

  Future<void> _sendMessage() async {
    try {
      final result = await _wapilot.sendMessage({
        'phone': _phoneController.text,
        'message': _messageController.text,
      });
      
      setState(() {
        _result = 'Message sent successfully!\nResult: $result';
      });
    } catch (e) {
      setState(() {
        _result = 'Error sending message: $e';
      });
    }
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
      appBar: AppBar(
        title: const Text('WAPILOT SDK Demo'),
      ),
      body: Padding(
        padding: const EdgeInsets.all(16.0),
        child: Column(
          crossAxisAlignment: CrossAxisAlignment.stretch,
          children: [
            TextField(
              controller: _phoneController,
              decoration: const InputDecoration(
                labelText: 'Phone Number',
                hintText: '+1234567890',
              ),
            ),
            const SizedBox(height: 16),
            TextField(
              controller: _messageController,
              decoration: const InputDecoration(
                labelText: 'Message',
                hintText: 'Enter your message',
              ),
              maxLines: 3,
            ),
            const SizedBox(height: 16),
            ElevatedButton(
              onPressed: _sendMessage,
              child: const Text('Send Message'),
            ),
            const SizedBox(height: 16),
            Text(_result),
          ],
        ),
      ),
    );
  }

  @override
  void dispose() {
    _phoneController.dispose();
    _messageController.dispose();
    super.dispose();
  }
}
0
likes
140
points
20
downloads

Publisher

unverified uploader

Weekly Downloads

Official Flutter/Dart SDK for WAPILOT.io - WhatsApp Business API Integration Platform. Easily manage contacts, send messages, handle templates, and automate responses.

Homepage
Repository (GitHub)
View/report issues

Topics

#whatsapp #messaging #api #communication

Documentation

Documentation
API reference

License

MIT (license)

Dependencies

dio, flutter, meta

More

Packages that depend on wapilot_sdk