Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@great-detail/whatsapp

Package Overview
Dependencies
Maintainers
0
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 7.0.5 to 7.0.6

dist/chunk-HXKRHTK4.js

2

dist/cli.js
#!/usr/bin/env node
import{a as m}from"./chunk-EWHC6BU5.js";import{program as n}from"commander";import c from"get-stdin";var s=process.env.WHATSAPP_ACCESS_TOKEN,p=process.env.WHATSAPP_PHONE_NUMBER_ID,o=new m;n.name("whatsapp").description("WhatsApp SDK CLI");var i=n.command("media").description("Media");i.command("download").description("Download Media").argument("<MEDIA_URL>","Media URL").requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async e=>{let a=await(await o.media.download(e)).arrayBuffer(),r=Buffer.from(a);process.stdout.write(r)});i.command("delete").description("Delete Media").argument("<MEDIA_ID>","Media ID").option("--phone-number-id <PHONE_NUMBER_ID>","From Phone Number ID",p).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async(e,t)=>{let a=await o.media.delete({mediaID:e,phoneNumberID:t.phoneNumberId});console.log(await a.json())});i.command("get-url").description("Get Media URL").argument("<MEDIA_ID>","Media ID").option("--phone-number-id <PHONE_NUMBER_ID>","From Phone Number ID",p).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async(e,t)=>{let a=await o.media.getURL({mediaID:e,phoneNumberID:t.phoneNumberId});console.log(await a.json())});i.command("upload").description("Upload Media").option("--filename <FILENAME>","Filename").requiredOption("--mime-type <MIME_TYPE>","MIME Type").requiredOption("--phone-number-id <PHONE_NUMBER_ID>","From Phone Number ID",p).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async e=>{let t=await c.buffer(),a=new Blob([t],{type:e.mimeType}),r=await o.media.upload({file:a,phoneNumberID:e.phoneNumberId,mimeType:e.mimeType,filename:e.filename});console.log(await r.json())});var d=n.command("message").description("Message");d.command("text").description("Send a Text message").argument("<RECIPIENT>","Message recipient Phone Number or Phone Number ID").requiredOption("--body <BODY>","Message body").option("--preview-url","Enable URL previewing for the message").action(async(e,t)=>{let a=await o.message.createMessage({to:e,phoneNumberID:t.phoneNumberId,type:"text",text:{body:t.body,preview_url:t.previewUrl}});console.log(await a.json())});n.parseAsync();
import{a as m}from"./chunk-HXKRHTK4.js";import{program as n}from"commander";import c from"get-stdin";var s=process.env.WHATSAPP_ACCESS_TOKEN,p=process.env.WHATSAPP_PHONE_NUMBER_ID,o=new m;n.name("whatsapp").description("WhatsApp SDK CLI");var i=n.command("media").description("Media");i.command("download").description("Download Media").argument("<MEDIA_URL>","Media URL").requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async e=>{let a=await(await o.media.download(e)).arrayBuffer(),r=Buffer.from(a);process.stdout.write(r)});i.command("delete").description("Delete Media").argument("<MEDIA_ID>","Media ID").option("--phone-number-id <PHONE_NUMBER_ID>","From Phone Number ID",p).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async(e,t)=>{let a=await o.media.delete({mediaID:e,phoneNumberID:t.phoneNumberId});console.log(await a.json())});i.command("get-url").description("Get Media URL").argument("<MEDIA_ID>","Media ID").option("--phone-number-id <PHONE_NUMBER_ID>","From Phone Number ID",p).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async(e,t)=>{let a=await o.media.getURL({mediaID:e,phoneNumberID:t.phoneNumberId});console.log(await a.json())});i.command("upload").description("Upload Media").option("--filename <FILENAME>","Filename").requiredOption("--mime-type <MIME_TYPE>","MIME Type").requiredOption("--phone-number-id <PHONE_NUMBER_ID>","From Phone Number ID",p).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async e=>{let t=await c.buffer(),a=new Blob([t],{type:e.mimeType}),r=await o.media.upload({file:a,phoneNumberID:e.phoneNumberId,mimeType:e.mimeType,filename:e.filename});console.log(await r.json())});var d=n.command("message").description("Message");d.command("text").description("Send a Text message").argument("<RECIPIENT>","Message recipient Phone Number or Phone Number ID").requiredOption("--body <BODY>","Message body").option("--preview-url","Enable URL previewing for the message").action(async(e,t)=>{let a=await o.message.createMessage({to:e,phoneNumberID:t.phoneNumberId,type:"text",text:{body:t.body,preview_url:t.previewUrl}});console.log(await a.json())});n.parseAsync();

@@ -85,3 +85,3 @@ import * as ky from 'ky';

interface MethodOptions$3 {
interface MethodOptions$4 {
request?: Options$1;

@@ -93,4 +93,4 @@ }

protected getEndpoint(phoneNumberID: PhoneNumberID): string;
getBusinessProfile<Fields extends GetBusinessProfileFields = object>({ phoneNumberID, fields, request, }: MethodOptions$3 & GetBusinessProfileOptions<Fields>): ky.ResponsePromise<GetBusinessProfilePayload<Fields>>;
updateBusinessProfile({ phoneNumberID, request, ...json }: MethodOptions$3 & UpdateBusinessProfileOptions): ky.ResponsePromise<UpdateBusinessProfilePayload>;
getBusinessProfile<Fields extends GetBusinessProfileFields = object>({ phoneNumberID, fields, request, }: MethodOptions$4 & GetBusinessProfileOptions<Fields>): ky.ResponsePromise<GetBusinessProfilePayload<Fields>>;
updateBusinessProfile({ phoneNumberID, request, ...json }: MethodOptions$4 & UpdateBusinessProfileOptions): ky.ResponsePromise<UpdateBusinessProfilePayload>;
}

@@ -136,3 +136,3 @@

interface MethodOptions$2 {
interface MethodOptions$3 {
request?: Options$1;

@@ -152,3 +152,3 @@ }

*/
upload({ phoneNumberID, file, filename, mimeType, request, }: MethodOptions$2 & MediaUploadOptions): ky.ResponsePromise<MediaUploadPayload>;
upload({ phoneNumberID, file, filename, mimeType, request, }: MethodOptions$3 & MediaUploadOptions): ky.ResponsePromise<MediaUploadPayload>;
/**

@@ -163,4 +163,4 @@ * Retrieve Media URL.

*/
getURL({ mediaID, phoneNumberID, request, }: MethodOptions$2 & MediaGetURLOptions): ky.ResponsePromise<MediaGetURLPayload>;
delete({ mediaID, phoneNumberID, request, }: MethodOptions$2 & MediaDeleteOptions): ky.ResponsePromise<MediaDeletePayload>;
getURL({ mediaID, phoneNumberID, request, }: MethodOptions$3 & MediaGetURLOptions): ky.ResponsePromise<MediaGetURLPayload>;
delete({ mediaID, phoneNumberID, request, }: MethodOptions$3 & MediaDeleteOptions): ky.ResponsePromise<MediaDeletePayload>;
/**

@@ -188,3 +188,3 @@ * Download Media.

*/
download({ mediaURL, request }: MethodOptions$2 & DownloadOptions): ky.ResponsePromise<unknown>;
download({ mediaURL, request }: MethodOptions$3 & DownloadOptions): ky.ResponsePromise<unknown>;
}

@@ -647,3 +647,3 @@

interface MethodOptions$1 {
interface MethodOptions$2 {
request?: Options$1;

@@ -655,4 +655,4 @@ }

protected getEndpoint(phoneNumberID: PhoneNumberID): string;
createStatus({ phoneNumberID, request, ...status }: MethodOptions$1 & CreateStatusOptions): ky.ResponsePromise<CreateStatusPayload>;
createMessage({ to, phoneNumberID, context, recipientType, request, ...message }: MethodOptions$1 & CreateMessageOptions): ky.ResponsePromise<CreateMessagePayload>;
createStatus({ phoneNumberID, request, ...status }: MethodOptions$2 & CreateStatusOptions): ky.ResponsePromise<CreateStatusPayload>;
createMessage({ to, phoneNumberID, context, recipientType, request, ...message }: MethodOptions$2 & CreateMessageOptions): ky.ResponsePromise<CreateMessagePayload>;
}

@@ -677,2 +677,69 @@

type ListPhoneNumbersOptions = {
businessAccountID: BusinessAccountID;
sort?: string;
filtering?: string;
};
type ListPhoneNumbersPaylod = {
data: {
id: PhoneNumberID;
verified_name: string;
code_verification_status: "VERIFIED" | (string & NonNullable<unknown>);
display_phone_number: string;
quality_rating: string;
platform_type: string;
throughput: {
level: string;
};
last_onboarded_time?: string;
webhook_configuration: {
application?: string;
};
}[];
};
type GetPhoneNumberFields = {
name_status?: boolean;
};
type GetPhoneNumberOptions<Fields extends GetPhoneNumberFields = object> = {
phoneNumberID: PhoneNumberID;
fields?: Fields;
};
type GetPhoneNumberPayload<Fields extends GetPhoneNumberFields = object> = {
id: PhoneNumberID;
verified_name: string;
name_status: Fields extends {
name_status: true;
} ? "APPROVED" | "AVAILABLE_WITHOUT_REVIEW" | "DECLINED" | "EXPIRED" | "PENDING_REVIEW" | "NONE" | (string & NonNullable<unknown>) : undefined;
code_verification_status: "VERIFIED" | (string & NonNullable<unknown>);
display_phone_number: string;
quality_rating: string;
platform_type: string;
throughput: {
level: string;
};
last_onboarded_time?: string;
webhook_configuration: {
application?: string;
};
};
interface MethodOptions$1 {
request?: Options$1;
}
declare class PhoneNumbers {
protected _request: Options$1;
constructor(_request: Options$1);
getEndpoint(businessAccountID: BusinessAccountID): string;
getPhoneNumber<Fields extends GetPhoneNumberFields = object>({ phoneNumberID, fields, request, }: MethodOptions$1 & GetPhoneNumberOptions): ky.ResponsePromise<GetPhoneNumberPayload<Fields>>;
listPhoneNumbers({ businessAccountID, sort, filtering, request, }: MethodOptions$1 & ListPhoneNumbersOptions): ky.ResponsePromise<ListPhoneNumbersPaylod>;
}
/**
* WhatsApp NodeJS SDK.
*
* @author Great Detail Ltd <info@greatdetail.com>
* @author Dom Webber <dom.webber@hotmail.com>
* @see https://greatdetail.com
*/
type CreateSubscriptionOptions = {

@@ -1350,2 +1417,3 @@ businessAccountID: BusinessAccountID;

message: Message;
phoneNumbers: PhoneNumbers;
subscribedApps: SubscribedApps;

@@ -1352,0 +1420,0 @@ media: Media;

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

import{a as e}from"./chunk-EWHC6BU5.js";export{e as Client,e as CloudAPI,e as default};
import{a as e}from"./chunk-HXKRHTK4.js";export{e as Client,e as CloudAPI,e as default};
{
"name": "@great-detail/whatsapp",
"version": "7.0.5",
"version": "7.0.6",
"type": "module",

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

Sorry, the diff of this file is not supported yet

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