New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

@great-detail/whatsapp

Package Overview
Dependencies
Maintainers
2
Versions
93
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@great-detail/whatsapp - npm Package Compare versions

Comparing version 5.4.1 to 5.5.0

5

dist/CloudAPI/CloudAPIMessage/index.d.ts

@@ -32,7 +32,2 @@ /**

* @author Dom Webber <dom.webber@hotmail.com>
* @example
* // Send a Text Message
* const message = sdk.message.text({ body: "Hello"}, { toNumber: "1234567890" });
* const sendReceipt = await message.send();
* console.log(sendReceipt);
*/

@@ -39,0 +34,0 @@ export default class CloudAPIMessage extends AbstractAPI {

2

dist/CloudAPI/CloudAPIWebhook/index.d.ts

@@ -103,3 +103,3 @@ /// <reference types="node" />

*
* @since 1.0.0
* @since 4.0.0
* @author Dom Webber <dom.webber@hotmail.com>

@@ -106,0 +106,0 @@ */

@@ -0,1 +1,2 @@

/// <reference types="node" />
/**

@@ -12,2 +13,25 @@ * WhatsApp NodeJS SDK.

import CloudAPIWebhook from "./CloudAPIWebhook";
export interface WhatsAppAPICreateVerifyTokenParams {
/**
* The length of the verify token.
*
* @since 5.1.0
* @default 16
*/
length?: number;
/**
* The encoding of the verify token.
*
* @since 5.1.0
* @default hex
*/
encoding?: BufferEncoding;
/**
* Random Bytes Generation.
*
* @since 5.1.0
* @default crypto.randomBytes
*/
random?: (length: number) => Buffer;
}
export interface WhatsAppAPIParams extends AbstractAPIParams {

@@ -22,8 +46,45 @@ }

* // SDK instantiation
* const sdk = new CloudWhatsAppAPI("123456")
* const sdk = new CloudAPI("123456")
*/
export default class CloudAPI extends AbstractAPI {
/**
* Default Verify Token Length.
*
* @since 5.6.0
*/
static DEFAULT_VERIFY_TOKEN_LENGTH: number;
/**
* Default Verify Token Encoding.
*
* @since 5.6.0
*/
static DEFAULT_VERIFY_TOKEN_ENCODING: BufferEncoding;
/**
* Message API.
*
* @since 5.5.0
* @example
* // Send a Text Message
* const message = sdk.message.text({ body: "Hello"}, { toNumber: "1234567890" });
* const sendReceipt = await message.send();
* console.log(sendReceipt);
*/
message: CloudAPIMessage;
/**
* Webhook API.
* Receive and handle messages from WhatsApp via WebHook.
*
* @since 4.0.0
*/
webhook: CloudAPIWebhook;
constructor(params: WhatsAppAPIParams);
/**
* Create a new Verify Token.
* This is a random string that is used to verify that the request is coming
* from WhatsApp. This method **only** creates the value, it's usage is up to
* the implementer.
*
* @since 5.6.0
*/
static createVerifyToken({ length, encoding, random, }: WhatsAppAPICreateVerifyTokenParams): string;
}

@@ -14,2 +14,3 @@ "use strict";

const CloudAPIWebhook_1 = __importDefault(require("./CloudAPIWebhook"));
const crypto_1 = require("crypto");
class CloudAPI extends AbstractAPI_1.default {

@@ -21,3 +22,12 @@ constructor(params) {

}
static createVerifyToken({
length = this.DEFAULT_VERIFY_TOKEN_LENGTH,
encoding = this.DEFAULT_VERIFY_TOKEN_ENCODING,
random = crypto_1.randomBytes
}) {
return random(length).toString(encoding);
}
}
CloudAPI.DEFAULT_VERIFY_TOKEN_LENGTH = 16;
CloudAPI.DEFAULT_VERIFY_TOKEN_ENCODING = "hex";
exports.default = CloudAPI;
{
"name": "@great-detail/whatsapp",
"version": "5.4.1",
"version": "5.5.0",
"type": "commonjs",

@@ -5,0 +5,0 @@ "description": "SDK for interfacing with WhatsApp Business Platform in Typescript or Node.js using the Cloud API, hosted by Meta.",

@@ -10,3 +10,3 @@ <!-- Copyright (c) Meta Platforms, Inc. and affiliates.

This is a fork of the original, deprecated, Official SDK.
A SDK for Meta's WhatsApp Business Messaging APIs - Cloud & On-Premises.

@@ -25,2 +25,11 @@ [![npm (scoped)][]][sdk-npmjs]

```typescript
import { CloudAPI } from "@great-detail/whatsapp";
// const businessID = "123...etc...";
const sdk = new CloudAPI(businessID);
const message = sdk.message.text({ body: "Hello"}, { toNumber: "1234567890" });
const sendReceipt = await message.send();
```
## Installation

@@ -27,0 +36,0 @@

@@ -44,7 +44,2 @@ /**

* @author Dom Webber <dom.webber@hotmail.com>
* @example
* // Send a Text Message
* const message = sdk.message.text({ body: "Hello"}, { toNumber: "1234567890" });
* const sendReceipt = await message.send();
* console.log(sendReceipt);
*/

@@ -51,0 +46,0 @@ export default class CloudAPIMessage extends AbstractAPI {

@@ -113,3 +113,3 @@ /**

*
* @since 1.0.0
* @since 4.0.0
* @author Dom Webber <dom.webber@hotmail.com>

@@ -116,0 +116,0 @@ */

@@ -12,3 +12,30 @@ /**

import CloudAPIWebhook from "./CloudAPIWebhook";
import { randomBytes } from "crypto";
export interface WhatsAppAPICreateVerifyTokenParams {
/**
* The length of the verify token.
*
* @since 5.1.0
* @default 16
*/
length?: number;
/**
* The encoding of the verify token.
*
* @since 5.1.0
* @default hex
*/
encoding?: BufferEncoding;
/**
* Random Bytes Generation.
*
* @since 5.1.0
* @default crypto.randomBytes
*/
random?: (length: number) => Buffer;
}
export interface WhatsAppAPIParams extends AbstractAPIParams {}

@@ -23,6 +50,37 @@

* // SDK instantiation
* const sdk = new CloudWhatsAppAPI("123456")
* const sdk = new CloudAPI("123456")
*/
export default class CloudAPI extends AbstractAPI {
/**
* Default Verify Token Length.
*
* @since 5.6.0
*/
public static DEFAULT_VERIFY_TOKEN_LENGTH = 16;
/**
* Default Verify Token Encoding.
*
* @since 5.6.0
*/
public static DEFAULT_VERIFY_TOKEN_ENCODING: BufferEncoding = "hex";
/**
* Message API.
*
* @since 5.5.0
* @example
* // Send a Text Message
* const message = sdk.message.text({ body: "Hello"}, { toNumber: "1234567890" });
* const sendReceipt = await message.send();
* console.log(sendReceipt);
*/
public message: CloudAPIMessage;
/**
* Webhook API.
* Receive and handle messages from WhatsApp via WebHook.
*
* @since 4.0.0
*/
public webhook: CloudAPIWebhook;

@@ -35,2 +93,18 @@

}
/**
* Create a new Verify Token.
* This is a random string that is used to verify that the request is coming
* from WhatsApp. This method **only** creates the value, it's usage is up to
* the implementer.
*
* @since 5.6.0
*/
public static createVerifyToken({
length = this.DEFAULT_VERIFY_TOKEN_LENGTH,
encoding = this.DEFAULT_VERIFY_TOKEN_ENCODING,
random = randomBytes,
}: WhatsAppAPICreateVerifyTokenParams): string {
return random(length).toString(encoding);
}
}

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc