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

0.8.0 • Public • Published

WhatsApp Platform

Receive events and send messages on WhatsApp through Cloud API.

Install

npm install @sociably/core @sociably/http @sociably/whatsapp
# or with yarn
yarn add @sociably/core @sociably/http @sociably/whatsapp

Docs

Check the platform document and the package reference.

Setup

import Sociably from '@sociably/core';
import Http from '@sociably/http';
import WhatsApp from '@sociably/whatsapp';

const {
  WHATS_APP_ACCESS_TOKEN,
  WHATS_APP_ACCOUNT_ID,
  WHATS_APP_NUMBER_ID,
  WHATS_APP_PHONE_NUMBER,
  WHATS_APP_APP_SECRET,
  WHATS_APP_VERIFY_TOKEN,
} = process.env;

const app = Sociably.createApp({
  modules: [
    Http.initModule({ /* ... */ }),
  ],
  platforms: [
    WhatsApp.intiModule({
      entryPath: '/webhook/whatsapp',
      agentSettings: {
        accountId: WHATS_APP_ACCOUNT_ID,
        numberId: WHATS_APP_NUMBER_ID,
        phoneNumber: WHATS_APP_PHONE_NUMBER,
      },
      appSecret: WHATS_APP_APP_SECRET,
      accessToken: WHATS_APP_ACCESS_TOKEN,
      verifyToken: WHATS_APP_VERIFY_TOKEN,
    }),
  ],
});

Dependencies (6)

Dev Dependencies (1)

Package Sidebar

Install

npm i @sociably/whatsapp

Weekly Downloads

2

Version

0.8.0

License

MIT

Unpacked Size

178 kB

Total Files

138

Last publish

Collaborators

  • lrills