whatsapp 1.0.7
whatsapp: ^1.0.7 copied to clipboard
A top package for whatsapp business api, send messages, product, media, location through flutter app.
WhatsApp API package for flutter, to send message and product information.
WhatsApp Business Configuration #
You must have WhatsApp apps in facebook developer, to use this package, please follow this Guidelines.
WhatsApp whatsapp = WhatsApp();
Configure accessToken
and fromNumberId
.
whatsapp.setup(
accessToken: "your_access_token_here",
fromNumberId: 10000000000000
);
💬 Short link
Generate the short link of the WhatsApp.
to
- the phone number with country code but without the plus (+) sign.message
- the message to be sent.compress
- passtrue
to compress the link.
whatsapp.short(
to: 910000000000,
message: "Hey",
compress: true
);
//return : https://wa.me/910000000000?text=Hy
💬 Send template
Send the template to the client.
to
- the phone number with country code but without the plus (+) sign.templateName
- the template name.
whatsapp.messagesTemplate(
to: 910000000000,
templateName: "hello_world"
);
💬 Send text message
Send the text message to the client.
to
- the phone number with country code but without the plus (+) sign.message
- the message to be sent.previewUrl
- is used to preview the URL in the chat window.
whatsapp.messagesTemplate(
to: 910000000000,
message: "Hey, Flutter, follow me on https://example.com",
previewUrl: true
);
💬 Send media files
Send the media files to the client.
to
- the phone number with country code but without the plus (+) sign.mediaType
- the type of media such as image, document, audio, image, video, or sticker.mediaId
- Use this edge to retrieve and delete media.
whatsapp.messagesMedia(
to: 910000000000,
mediaType: "image",
mediaId: "f043afd0-f0ae-4b9c-ab3d-696fb4c8cd68"
);
💬 Send location details
Send the location to the client.
to
- the phone number with country code but without the plus (+) sign.longitude
- the longitude of the location.latitude
- the latitude of the location.name
- the name of the location.address
- the full address of the location.
whatsapp.messagesLocation(
to: 910000000000,
longitude: "26.4866491",
latitude: "74.5288578",
name: "Pushkar",
address: "Rajasthan, India"
);
💬 Send image by link
Send the location to the client.
to
- the phone number with country code but without the plus (+) sign.imageLink
- the image to be sent.
whatsapp.messagesImageByLink(
to: 910000000000,
imageLink: "https://example.com/image.png",
);
💬 Send video by link
Send the location to the client.
to
- the phone number with country code but without the plus (+) sign.videoLink
- the video to be sent.caption
- the caption of the video.
whatsapp.messagesVideoByLink(
to: 910000000000,
videoLink: "https://example.com/video.mp4",
caption: "demo video"
);
💬 Send reaction on message
Send the location to the client.
to
- the phone number with country code but without the plus (+) sign.messageId
- the message id.emoji
- the emoji to be sent.
whatsapp.messagesReaction(
to: 910000000000,
messageId: "wamid.xxxxxxxxxxxxxxxxxx==",
emoji: "👍"
);
💬 Send reply on message
Send the location to the client.
to
- the phone number with country code but without the plus (+) sign.messageId
- the message id.message
- the message to be sent.previewUrl
- used to preview the URL in the chat window.
whatsapp.messagesReply(
to: 910000000000,
messageId: "wamid.xxxxxxxxxxxxxxxxxx==",
message: "Hey, Flutter!",
previewUrl: true
);
Contributors #
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.