Giter Site home page Giter Site logo

chouhan-rahul / whatsapp Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rohit-chouhan/whatsapp

0.0 0.0 0.0 356 KB

A package for whatsapp business api, send messages, product, media, location through flutter app.

Home Page: https://pub.dev/packages/whatsapp

License: MIT License

Dart 100.00%

whatsapp's Introduction

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.

rohit-chouhan sponsor

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:

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

chouhan-rahul

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.

whatsapp's People

Contributors

rohit-chouhan avatar chouhan-rahul avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.