Socket
Socket
Sign inDemoInstall

@calculusky/meta-whatsapp-sdk

Package Overview
Dependencies
0
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @calculusky/meta-whatsapp-sdk

Meta WhatsApp SDK for the Cloud API


Version published
Weekly downloads
1
Maintainers
1
Created
Weekly downloads
 

Readme

Source

Meta WhatsApp Business SDK for Cloud API

WhatsApp Logo

The SDK is a light weight package with zero dependency written in TypeScript to simplify access to the meta whatsApp cloud API, Cloud API. The SDK currently supports most features for the messaging API such as template, text, image, video, document etc.

Installation

pnpm install @calculusky/meta-whatsapp-sdk
#or
npm install @calculusky/meta-whatsapp-sdk
#or
yarn add @calculusky/meta-whatsapp-sdk

Usage

First, obtain your credentials such as the Access Token and Phone number ID from the Meta Developer Platform

Examples

CommonJS Usage

Note: In order to gain the TypeScript typings (for intellisense / autocomplete) while using CommonJS, use require().default as seen below:

const WhatsApp = require("@calculusky/meta-whatsapp-sdk").default;

const whatsApp = new WhatsApp({
  accessToken: ACCESS_TOKEN
  phoneNumberId: PHONE_NUMBER_ID,
});



TypeScript Usage

import WhatsApp from "@calculusky/meta-whatsapp-sdk";

//ES6
whatsApp.message
    .template({
        recipient: "2347035549057",
        body: {
            language: {
                code: "en_US",
            },
            name: "hello_world",
        },
    })
    .then((resData) => {
        console.log(resData);
    })
    .catch((error) => {
        console.log(error);
    });

//ES8
try {
    await whatsApp.message.template({
        recipient: "2347035549057",
        body: {
            language: {
                code: "en_US",
            },
            name: "hello_world",
        },
    });
} catch (error) {
    console.log(error);
}

Keywords

FAQs

Last updated on 20 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc