WhatsApp API package for flutter, to send message and product information.

Overview

WhatsApp API package for flutter, to send message and product information.

Platform Support

Android iOS MacOS Web Linux Windows
✔️ ✔️ ✔️ ✔️ ✔️ ✔️

WhatsApp Business Configuration

You must have WhatsApp apps in facebook developer, to use this package, please follow this link for Guidence.

Installation

import 'package:whatsapp/whatsapp.dart';
Whatsapp whatsapp = Whatsapp();

Configure accessToken and Phone ID

whatsapp.setup(
	accessToken: "your_access_token_here",
	fromNumberId: 10000000000000 //integer
);

💬 short Direct chat link

this method used to generate direct chat link

parameter:-

  • to - number of client
  • message - message
  • compress - true / false for compress link

sample code:-

whatsapp.short(
	to: 910000000000, // number with country code (without +),
	message: "Hey",
	compress: true
);

//return : https://wa.me/910000000000?text=Hy

💬 messagesTemplate Send a template message

this method used to send a template message to client's whatsapp

parameter:-

  • to - number of client
  • templateName - name of a template

sample code:-

whatsapp.messagesTemplate(
	to: 910000000000, // number with country code (without +),
	templateName: "hello_world" //template name
);

💬 messagesText Send a text message

this method used to send a text message to client's whatsapp

parameter:-

  • to - number of client
  • message - message your want to send
  • previewUrl - true and false for preview url in message

sample code:-

whatsapp.messagesTemplate(
	to: 910000000000, // number with country code (without +),
	message: "Hey, Flutter, follow me on https://example.com", //message
	previewUrl: true
);

💬 messagesMedia Send a media message

this method used to send a media message to client's whatsapp

parameter:-

  • to - number of client
  • mediaType - type of media ex. image
  • mediaId - uploaded media id on whatsapp business

sample code:-

whatsapp.messagesMedia(
	to: 910000000000, // number with country code (without +),
	mediaType: "image",
	mediaId: "f043afd0-f0ae-4b9c-ab3d-696fb4c8cd68"
);

💬 messagesLocation Send a location message

this method used to send a location message to client's whatsapp

parameter:-

  • to - number of client
  • longitude -longitude string
  • latitude - latitude string
  • name - name of location
  • address - full address of location

sample code:-

whatsapp.messagesLocation(
	to: 910000000000, // number with country code (without +),
	longitude: "26.4866491",
	latitude: "74.5288578",
	name: "Pushkar",
	address: "Rajasthan, India"
);

Feel free to contribute ❤️

You might also like...

Provides API to generate Dart source code

DartWriter DartWriter provides API to generate Dart source code. It can make your job easier while developing flutter/dart tools. You can also generat

Oct 24, 2022

Call OpenGL ES Api By Dart

Call OpenGL ES Api By Dart

Flutter GL Flutter GL can call OpenGL ES API with Dart Support iOS,Android,Web OpenGL ES API Now the api is similar to WebGL How to use Now this is on

Jan 5, 2023

This library contains methods that make it easy to consume Mpesa Api.

This library contains methods that make it easy to consume Mpesa Api. It's multi-platform, and supports CLI, server, mobile, desktop, and the browser.

Dec 15, 2021

A CLI tool to help generate dart classes from json returned from API

Json 2 Dart Command line utility Important note There is already a package called json2dart so this package will be called json2dartc ! This project w

Oct 5, 2022

Volt is a wrapper over the Revolt API for easily writing bots using the Dart language.

Volt is a wrapper over the Revolt API for easily writing bots using the Dart language. It is currently in active development so not all of the functionality has yet been implemented.

Dec 13, 2022

This is a dart library covering nearly 100% of the latest Planning Center public API.

Planning Center API for Dart Planning Center is an online platform for church management. It provides multiple apps for things like check-ins, service

Oct 6, 2022

🔍 👀 CLI utility to check last-visit of your CodeForces friends & much more, 🚀 powered by CodeForces API

JoJo 🔍 👀 CLI utility to check last-visit of your CodeForces friends & much more, 🚀 powered by CodeForces API Features Online Friends All Friends Pr

Jul 20, 2020

Cache json map to local file with Dart:io. Read file with sync api.

local_cache_sync 一个非常简单易用的Flutter本地储存库,适用于在本地储存一列轻量数据(例如用户保存在本地的设备信息,或者缓存一系列用户信息)。 local_cache_sync的所有方法都是同步,而不是异步的。这意味着你不需要使用await就可以获取数据。在flutter中,这

Jun 24, 2022

🏂 A self-hostable rest api server for Tenka

🏂 A self-hostable rest api server for Tenka

Fuyu 🏂 A self-hostable rest api server for Tenka. By using this project, you agree to the usage policy. Installation Pre-built binaries are released

Mar 14, 2022
Comments
  • Duda sobre envio de mensajes

    Duda sobre envio de mensajes "Send text message"

    En la documentación para enviar un mensaje aplicando whatsapp 2.0.0 aparece como:

    whatsapp.messagesTemplate( to: 910000000000, message: "Hey, Flutter, follow me on https://example.com", previewUrl: true ); Esto es correcto?

    Cuando utilizo ya configurado en flutter "whatsapp 2.0.0" si funciona con messagesTemplate y recibo en mi celular el mensaje del template de developer facebook, pero cuando lo intento con:

    whatsapp.messagesText( to: 910000000000, message: "Hey, Flutter, follow me on https://example.com", previewUrl: true );

    No recibo el mensaje en mi celular, aplique flutter logs y aparece lo siguiente:

    evidencia envio WHATSAPP

    opened by Albertiko74 1
  • messagesText function returns false, fix key 'previewUrl' to 'preview_url'

    messagesText function returns false, fix key 'previewUrl' to 'preview_url'

    I was testing your flutter package, and sending a simple message with the messagesText function always returned false. I did the test with Postman, sending the json that is sent with the messagesText function, and I got an error (Status 400).

    image

    As you can see, the message says Unexpected key 'previewUrl'. I read the Whatsapp Api Documentation and it says that the correct key inside the text object is "preview_url".

    I changed the 'previewUrl' key to 'preview_url' and did the test with Postman, and I got the whatsapp message to my phone number.

    image image

    So I corrected the key previewUrl to preview_url in the messagesText function, in my proyect.

    Map data = {
      "messaging_product": "whatsapp",
      "recipient_type": "individual",
      "to": "$to",
      "type": "text",
      "text": {"preview_url": previewUrl, "body": "$message"}
    };
    

    And when using the function, the WhatsApp message is already sent and returns true.

    I hope that you correct the key previewUrl, so that others who use your whatsapp package for flutter do not have the same problem.

    opened by JoseAndresCartuche 1
  • Add

    Add "components" field for making the templates more useful in production environments

    Adding Components field will make the "messagesTemplate" function more useful.

    I have modified the definition of the "messagesTemplate" a bit for my use case and realised that It will be useful for many people out there for integrating WhatsApp api more efficiently and easily. image Here you can see the modified changes I have made in this function definition. You can add this as a seperate feature or extend the "messageTemplate" by adding another fields. I am always ready to contribute and help you at any point.

    opened by nabilpatel4012 2
Releases(v2.0)
  • v2.0(Oct 9, 2022)

Owner
Rohit Chouhan
Associate Analyst at Deloitte
Rohit Chouhan
A simple flexible API wrapper for coinbase commerce API. Totally unofficial.

coinbase_commerce A dart library that connects to interact with the Coinbase Commerce API. Enables projects to connect seamlessly to coinbase and rece

Onuoha Obinna 3 Oct 17, 2021
This package binds to Cronet's native API to expose them in Dart.

Experimental Cronet Dart bindings This package binds to Cronet's native API to expose them in Dart. This is an HTTP Client Package with almost the sam

Google 103 Dec 9, 2022
A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully & easily modifiable.

A package that lets you include a cool, nice looking and validated Password TextFormField in your app to enhance user experience. The package is fully

Muhammad Hamza 20 Jun 7, 2022
null 2 Apr 17, 2022
A Dart package which supports checking if a current package is up-to-date.

pub_updater A Dart package which enables checking whether packages are up to date and supports updating them. Intended for use in CLIs for prompting u

Very Good Open Source 47 Oct 27, 2022
Converts SVG icons to OTF font and generates Flutter-compatible class. Provides an API and a CLI tool.

Fontify The Fontify package provides an easy way to convert SVG icons to OpenType font and generate Flutter-compatible class that contains identifiers

Igor Kharakhordin 88 Oct 28, 2022
An encapsulation made around openrouteservice API for Dart and Flutter projects.

An encapsulation made around openrouteservice API for Dart and Flutter projects. Made for easy generation of Routes and Directions on Maps, Isochrones, Time-Distance Matrix, Pelias Geocoding, POIs, Elevation and routing Optimizations using their amazing API.

Dhiman Seal 20 Oct 10, 2022
Minimal Dart wrapper to interact with Some Random Api. Easy to use, simplified and lightweight.

SRA - Some Random Api Minimal Dart wrapper to interact with Some Random Api. Easy to use, simplified and lightweight. Getting started Add the package

Yakiyo 3 Jan 4, 2023
A Flutter library to make Rest API clients more easily. Inspired by Java Feing.

A Flutter library to make Rest API clients more easily. Inspired by Java Feing. Features Facilitated JSON encode and decode using common interfaces. F

null 2 Mar 15, 2022
JSON API parser for Flutter

Flutter Japx - JSON:API Decoder/Encoder Lightweight [JSON:API][1] parser that flattens complex [JSON:API][1] structure and turns it into simple JSON a

Infinum 23 Dec 20, 2022