Node.js library for sending message through Whatsapp Business API
MIT License
Whatsapp Business Sender is the library for sending whatsapp for business message api using node js.
npm install @hyperjumptech/whatsapp-business-sender
- loginUser
- checkContacts
- sendMessageTemplateText
loginUser
The method to run login-user endpoint in the Whatsapp Business API :
usage:
import whatsapp from "@hyperjumptech/whatsapp-business-sender";
const resp = await whatsapp.loginUser("<server host>", {
username: "<whatsapp username>",
password: "<whatsapp password>",
});
checkContacts
The method to run check-contacts endpoint in the Whatsapp Business API :
usage:
import whatsapp from "@hyperjumptech/whatsapp-business-sender";
const resp = await whatsapp.checkContacts("<server host>", "<login token>", [
"<phone number>",
"<phone number>",
"<phone number>",
]);
sendMessageTemplateText
The method to run send-message-template-text endpoint in Whatsapp Business API :
usage:
import whatsapp from "@hyperjumptech/whatsapp-business-sender";
const resp = await whatsapp.sendMessageTemplateText(
"<server host>",
"<login token>",
{
phone: "<phone number with country code>",
template: {
namespace: "<Message Template Namespace>",
name: "<Message Template Element Name>",
language: {
policy: "<Message Template Language Policy>",
code: "<Message Template Language Code>",
},
components: [
{
type: "body",
parameters: [
{
type: "<param type>",
text: "<param value>",
},
],
},
],
},
}
);
If you need help, want to give feedback, or have a great idea to improve this library, get involved! Let us know in the Github discussions.
Please abide by the Contributor's Code of Conduct
MIT License.