Whatsapp Unofficial
Media Message

Getting Started with Whatsapp Unofficial

Make sure you install the packages and get your env variables first

Package Setup

Install the packages

npm install node-fetch

Add env variables

WOTMASTER_SECRET=... # A secret key for your app (starts with wotmaster_)
⚠️

If you don't already have a wotmaster secret key, sign up (opens in a new tab) and create one from the dashboard! (opens in a new tab)

Set Up A Whatsapp Unofficial Service

Send request to send message

src/utils/sendMessage.ts
import fetch from "node-fetch";
 
const url = "http://wotmaster.com/api/wu/media";
 
const response = await fetch(url, {
  method: "POST",
  headers: { "Content-Type": "application/json" },
  body: JSON.stringfy({
    key: "wotmaster_••••••••••••••••••••••••",
    countryCode: "91",
    phone: "9999999999",
    instanceId: "••••••••••••••••••••••••",
    text: "Hey, This message is sent from an api",
    mediaUrl:
      "https://www.google.com/images/branding/googlelogo/2x/googlelogo_color_272x92dp.png",
  }),
});
if (response.ok) {
  const body = await response.json();
  const { id, phone, text, message, mediaUrl } = body;
  console.log(id, phone, text, message, mediaUrl);
}

Params

key = WOTMASTER_SECRET
countryCode = International country code without +
phone = Whatsapp number of receiver without countryCode
instanceId = Instance Id of whatsapp account connected and active
text = Mesasge string to be sent to receiver
mediaUrl = Url of media publicly accessible