@great-detail/whatsapp
Advanced tools
Comparing version 7.0.1 to 7.0.2
#!/usr/bin/env node | ||
import{a as c}from"./chunk-WN3DZAG2.js";import{program as r}from"commander";import d from"get-stdin";var a=process.env.WHATSAPP_ACCESS_TOKEN,m=process.env.WHATSAPP_PHONE_NUMBER_ID,i=new c;r.name("whatsapp").description("WhatsApp SDK CLI");var t=r.command("media").description("Media");t.command("download").description("Download Media").argument("<MEDIA_URL>","Media URL").requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",a).action(async e=>{let o=await(await i.media.download(e)).arrayBuffer(),s=Buffer.from(o);process.stdout.write(s)});t.command("delete").description("Delete Media").argument("<MEDIA_ID>","Media ID").option("--phone-number-id <PHONE_NUMBER_ID>","From Phone Number ID",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",a).action(async(e,n)=>{let o=await i.media.delete({mediaID:e,phoneNumberID:n.phoneNumberId});console.log(await o.json())});t.command("get-url").description("Get Media URL").argument("<MEDIA_ID>","Media ID").option("--phone-number-id <PHONE_NUMBER_ID>","From Phone Number ID",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",a).action(async(e,n)=>{let o=await i.media.getURL({mediaID:e,phoneNumberID:n.phoneNumberId});console.log(await o.json())});t.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",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",a).action(async e=>{let n=await d.buffer(),o=new Blob([n],{type:e.mimeType}),s=await i.media.upload({file:o,phoneNumberID:e.phoneNumberId,mimeType:e.mimeType,filename:e.filename});console.log(await s.json())});r.parseAsync(); | ||
import{a as c}from"./chunk-C6HFTFLD.js";import{program as r}from"commander";import d from"get-stdin";var a=process.env.WHATSAPP_ACCESS_TOKEN,m=process.env.WHATSAPP_PHONE_NUMBER_ID,i=new c;r.name("whatsapp").description("WhatsApp SDK CLI");var t=r.command("media").description("Media");t.command("download").description("Download Media").argument("<MEDIA_URL>","Media URL").requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",a).action(async e=>{let o=await(await i.media.download(e)).arrayBuffer(),s=Buffer.from(o);process.stdout.write(s)});t.command("delete").description("Delete Media").argument("<MEDIA_ID>","Media ID").option("--phone-number-id <PHONE_NUMBER_ID>","From Phone Number ID",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",a).action(async(e,n)=>{let o=await i.media.delete({mediaID:e,phoneNumberID:n.phoneNumberId});console.log(await o.json())});t.command("get-url").description("Get Media URL").argument("<MEDIA_ID>","Media ID").option("--phone-number-id <PHONE_NUMBER_ID>","From Phone Number ID",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",a).action(async(e,n)=>{let o=await i.media.getURL({mediaID:e,phoneNumberID:n.phoneNumberId});console.log(await o.json())});t.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",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",a).action(async e=>{let n=await d.buffer(),o=new Blob([n],{type:e.mimeType}),s=await i.media.upload({file:o,phoneNumberID:e.phoneNumberId,mimeType:e.mimeType,filename:e.filename});console.log(await s.json())});r.parseAsync(); |
@@ -1218,3 +1218,2 @@ import * as ky from 'ky'; | ||
interface Options { | ||
accessToken?: string; | ||
prefixUrl?: string; | ||
@@ -1228,5 +1227,5 @@ graphVersion?: `v${string}` | (string & NonNullable<unknown>); | ||
webhook: Webhook; | ||
constructor({ accessToken, prefixUrl, graphVersion, }?: Options); | ||
constructor({ prefixUrl, graphVersion, }?: Options); | ||
} | ||
export { type AccountID, type BusinessAccountID, Client, Client as CloudAPI, type ConversationType, type CreateMessageContact, type CreateMessageLocation, type CreateMessageMedia, type CreateMessageOptions, type CreateMessagePayload, type CreateMessageText, type CreateStatusOptions, type CreateStatusPayload, type EventNotificationMessageIdentity, type EventNotificationMessageMedia, type EventNotificationMessageReferral, type EventNotificationMessageSystem, type EventNotificationMessageText, type MediaDeleteOptions, type MediaDeletePayload, type MediaGetURLOptions, type MediaGetURLPayload, type MediaID, type MediaUploadOptions, type MediaUploadPayload, type MessageID, type MessageRecipientType, type MessageStatusType, MessageType, type PhoneNumberID, type PhoneNumberString, type WebhookEventNotification, type WhatsappError, Client as default }; |
@@ -1,1 +0,1 @@ | ||
import{a}from"./chunk-WN3DZAG2.js";export{a as Client,a as CloudAPI,a as default}; | ||
import{a}from"./chunk-C6HFTFLD.js";export{a as Client,a as CloudAPI,a as default}; |
{ | ||
"name": "@great-detail/whatsapp", | ||
"version": "7.0.1", | ||
"version": "7.0.2", | ||
"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
4
99806
1253