@hyperjumptech/whatsapp-business-sender
TypeScript icon, indicating that this package has built-in type declarations

1.0.3 • Public • Published

Whatsapp Business Sender

Whatsapp Business Sender is the library for sending whatsapp for business message api using node js.

Built With

Getting Started

Prerequisites

  • Node.js v^14.14.37
  • npm v6.14.11

Installing

npm install @hyperjumptech/whatsapp-business-sender

Libraries

Exposed Libraries

  - loginUser
  - checkContacts
  - sendMessageTemplateText

Descriptions

loginUser

The method to run login-user endpoint in the Whatsapp Business API :

  • baseURL : Whatsapp business api server host
  • creds : Whatsapp business user credentials, consist of username and password

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 :

  • baseURL : Whatsapp business api server host
  • token : token from the user login
  • phones : string arrays of phone number using country code

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 :

  • baseURL : Whatsapp business api server host
  • token : token from the user login
  • data : consist of phone number and template configurations

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>",
            },
          ],
        },
      ],
    },
  }
);

Discussions

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

License

MIT License.

Readme

Keywords

none

Package Sidebar

Install

npm i @hyperjumptech/whatsapp-business-sender

Weekly Downloads

1

Version

1.0.3

License

MIT

Unpacked Size

63.7 kB

Total Files

24

Last publish

Collaborators

  • khermawan
  • nico-hyperjump
  • rafel
  • haricnugraha
  • budhi_npm
  • raosanfl
  • gregoryhyperjump
  • satriyopranoto
  • garychristianto