library not official javascript to WhatsApp Cloud API. Repository of wppmeta.
- Sending messages
- Sending Media (images, audio, video and ducuments)
- Sending location
- Sending messages for templates
- Sending messages for buttons
- Create templates of messages
- Update templates of messages
- Delete templates of messages
$ npm install wppmetaBefore getting started with the library, you need to go through the steps and gather some information to get the library working properly.
Follow the steps of Facebook Cloud Api for you to get started.
-
After the steps, collect your TOKEN and TEST WHATSAPP NUMBER
-
Lastly verify the number you will be using for testing on the To field
Once you're follow the above procedures, now you're ready to start hacking with the Wrapper.
Here how you authenticate your application, you need to specofy two things the TOKEN and phone_number_id of your test number
import { WppMeta } from 'wppmeta'
const whatsaApp = WppMeta.config({
accountId: "YOUR_ACCOUNT_ID",
phoneId: "YOUR_PHONE_ID",
token: 'YOUR_TOKEN_AUTHORIZATION_BEARER',
});const phones = await whatsaApp.getPhones()const success = await whatsaApp.registerPhone({
phoneId: 'PHONE_ID',
pin: '6-digit'
})const response = await whatsaApp.sendText({
to: 'PHONE',
body: {
message: 'MESSAGE',
useUrl: false
}
})const response = await whatsaApp.sendMidia({
to: 'PHONE',
mediaObjectId: 'MEDIA_ID'
})const response = await whatsaApp.sendLocation({
to: 'PHONE',
location: {
address: 'ADDRESS',
latitude: 'LATITUDE',
longitude: 'LONGITUDE',
name: 'NAME_LOCATION'
}
})NOTE:
For more info check Notification Payload refernce and Notification Payload Examples
If you will face any issue with the usage of this package please raise one so as we can quickly fix it as soon as possible;
This is an opensource project under MIT License so any one is welcome to contribute from typo, to source code to documentation, JUST FORK IT.