Medusa won the Golden Kitty Award for Best Ecommerce Product ✨  Learn More

Medusa Logo
  • Developers
  • Blog
  • Pricing
  • Community
  • About
  • Careers
  • Get Started
  • Developers
  • Blog
  • Pricing
  • Community
  • About
  • Careers
  • Get Started
Browse

Built by

monkeymars

Category

Notification

Version

0.1.8

Last updated

Oct 24, 2022, 10:55:14 AM5 months ago
View sourceView on NPMCopy link

medusa-plugin-whatsapp-cloud-api

WhatsApp Cloud API / Messaging plugin.

Learn more about how you can use this plugin in the documentaion.

Install Plugin

In the directory of your Medusa server, run the following command to install WhatsApp Cloud API plugin:

Yarn or NPM

npm install --save medusa-plugin-whatsapp-cloud-api
yarn add medusa-plugin-whatsapp-cloud-api

Options

Next, you need to add configurations for medusa-plugin-whatsapp-cloud-api plugin. In medusa-config.js add the following at the plugins array:

const plugins = [
{
resolve: `medusa-plugin-whatsapp-cloud-api`,
options: {
accessToken: "<Temporary or permanent access token>",
WABA_ID: "<WhatsApp Business Account ID>",
senderPhoneNumberId: "<Phone number ID>",
graphAPIVersion: "<Graph API Version>",
},
},
];

Dynamic usage

You can resolve the WhatsApp service to dynamically send messages via WhatsApp Cloud API. Example:

sendMessageTemplate

router.get("/send-message-sample", async (req, res) => {
const whatsappService = req.scope.resolve("whatsappService");
const response = await whatsappService.sendMessageTemplate({
templateId: "flight_confirmation", // your message templates
recipientPhone: "+6281556750222",
headerMessage: [
{
type: "image",
image: {
link: "https://<URL>",
},
},
],
contentMessage: [
{ type: "text", text: "NYC" },
{ type: "text", text: "JFK" },
{
type: "date_time",
date_time: {
fallback_value: "December 24, 2022",
},
},
],
lang: "en_US",
});
res.json({
message: `message sent: ${response.status}`,
});
});

sendLocation

whatsappService.sendLocation({
name: "GBK Stadium",
address: "Jl. Pintu Satu Senayan, Gelora, Kota Jakarta Pusat, DKI Jakarta",
recipientPhone: "+6281556750222",
latitude: -6.21844,
longitude: 106.8018,
});

Preview: sendMessageTemplate

Participants

GitHubTwitterDiscord
monkeymars@SoekmoWibowoNaN#5123
madzarmr@madzarmrmadzarmr
putra299@putra29putra299
silogos@AminLogosGeeks#8128

Resources

  • Overview of plugins in Medusa
  • Create Message Templates for WhatsApp Business Account
  • WhatsApp Cloud API Messages References
  • Create Plugin
altText of the image

Build your own plugins

Take Medusa up another level, and develop your own plugins with our API to speed up your processes.

Focus on building plugins for tools you use in your daily workflow, and publish to the Medusa Plugin Store for others to install.

Read more
altText of the image
Medusa

Product

Medusa for B2BIntegrationsGet StartedCareers
We're hiring

Developers

DocsAPI ReferencesCommunityDiscussions

Medusa

BlogPricingAboutContact Us

Newsletter

Get a summary of what we’ve shipped during the last month, behind the scenes updates, and team picks. Unsubscribe any time.

© 2023 MedusaJS, Inc.