whatsapp 1.0.5 whatsapp: ^1.0.5 copied to clipboard
A top package for whatsapp business api, send messages, product, media, location through flutter app.
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 clientmessage
- messagecompress
- 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 clienttemplateName
- 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 clientmessage
- message your want to sendpreviewUrl
- 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 clientmediaType
- type of media ex. imagemediaId
- 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 clientlongitude
-longitude stringlatitude
- latitude stringname
- name of locationaddress
- 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"
);