This Flutter package allows you to integrate the WhatsApp Business API into your Flutter applications, enabling features such as sending messages
, media
, templates
, business information
, interactives
, and more.
Documentation
The full documentation for WhatsApp Package can be found on whatsapp-flutter.github.io
To switch the documentation version, use the version selector located at the top of the page, marked with version:
.
Note: The documentation in the main branch is more up-to-date than the released documentation on the official docs website.
Other useful links:
- Official WhatsApp Flutter website
- Initialization of WhatsApp Flutter
- Return Methods will help you determine your request.
- Method Usage contains important information to help you get started.
Example:
const accessToken ='EAAGp6aTb8.....';
const fromNumberId = '1082772452xxxxx';
final whatsapp = WhatsApp(accessToken, fromNumberId);
var res = await whatsapp.sendMessage(
phoneNumber : 'PHONE_NUMBER',
text : 'text_message',
previewUrl : true,
);
if (res.isSuccess()) {
// when message sent
//Return id of message
debugPrint('Message ID: ${res.getMessageId()}');
//Return number where message sent
debugPrint('Message sent to: ${res.getPhoneNumber()}');
//Return exact API Response Body
debugPrint('API Response: ${res.getResponse().toString()}');
} else {
//when something went wrong
//Will return HTTP CODE
debugPrint('HTTP Code: ${res.getHttpCode()}');
// Will return exact error from WhatsApp Cloud API
debugPrint('API Error: ${res.getErrorMessage()}');
// Will return HTTP Request error
debugPrint('Request Error: ${res.getError()}');
//Return exact API Response Body
debugPrint('API Response: ${res.getResponse().toString()}');
}
Contributors
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.
Libraries
- model/replay
- services/account
- services/audio
- services/business
- services/contact
- services/custom
- services/document
- services/image
- services/interactive
- services/location
- services/media
- services/message
- services/phone
- services/reaction
- services/registration
- services/replay
- services/sticker
- services/template
- services/text
- services/video
- utils/exception
- utils/request