@great-detail/whatsapp
Advanced tools
Comparing version 7.0.8 to 7.0.9
#!/usr/bin/env node | ||
import{a as d}from"./chunk-EW3NUE3Y.js";import{program as t}from"commander";import c from"get-stdin";var s=process.env.WHATSAPP_ACCESS_TOKEN,m=process.env.WHATSAPP_PHONE_NUMBER_ID,a=new d;t.name("whatsapp").description("WhatsApp SDK CLI");var i=t.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 n=await(await a.media.download(e)).arrayBuffer(),r=Buffer.from(n);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",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async(e,o)=>{let n=await a.media.delete({mediaID:e,phoneNumberID:o.phoneNumberId});console.log(await n.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",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async(e,o)=>{let n=await a.media.getURL({mediaID:e,phoneNumberID:o.phoneNumberId});console.log(await n.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",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async e=>{let o=await c.buffer(),n=new Blob([o],{type:e.mimeType}),r=await a.media.upload({file:n,phoneNumberID:e.phoneNumberId,mimeType:e.mimeType,filename:e.filename});console.log(await r.json())});var p=t.command("message").description("Message");p.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,o)=>{let n=await a.message.createMessage({to:e,phoneNumberID:o.phoneNumberId,type:"text",text:{body:o.body,preview_url:o.previewUrl}});console.log(await n.json())});t.parseAsync(); | ||
import{a as d}from"./chunk-FLWK7R2Z.js";import{program as t}from"commander";import c from"get-stdin";var s=process.env.WHATSAPP_ACCESS_TOKEN,m=process.env.WHATSAPP_PHONE_NUMBER_ID,a=new d;t.name("whatsapp").description("WhatsApp SDK CLI");var i=t.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 n=await(await a.media.download(e)).arrayBuffer(),r=Buffer.from(n);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",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async(e,o)=>{let n=await a.media.delete({mediaID:e,phoneNumberID:o.phoneNumberId});console.log(await n.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",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async(e,o)=>{let n=await a.media.getURL({mediaID:e,phoneNumberID:o.phoneNumberId});console.log(await n.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",m).requiredOption("--access-token <ACCESS_TOKEN>","WhatsApp Access Token",s).action(async e=>{let o=await c.buffer(),n=new Blob([o],{type:e.mimeType}),r=await a.media.upload({file:n,phoneNumberID:e.phoneNumberId,mimeType:e.mimeType,filename:e.filename});console.log(await r.json())});var p=t.command("message").description("Message");p.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,o)=>{let n=await a.message.createMessage({to:e,phoneNumberID:o.phoneNumberId,type:"text",text:{body:o.body,preview_url:o.previewUrl}});console.log(await n.json())});t.parseAsync(); |
@@ -1315,2 +1315,7 @@ import * as ky from 'ky'; | ||
* ```ts | ||
* // See: https://github.com/fastify/fastify/issues/707#issuecomment-817224931 | ||
* fastify.addContentTypeParser("application/json", { parseAs: "buffer" }, (_req, body, done) => { | ||
* done(null, body); | ||
* }); | ||
* | ||
* fastify.route({ | ||
@@ -1320,6 +1325,9 @@ * method: "GET", | ||
* handler: (request, reply) => { | ||
* assert(Buffer.isBuffer(request.body) || typeof request.body === "string"); | ||
* const body = request.body.toString(); | ||
* | ||
* const reg = await sdk.webhook.register({ | ||
* method: request.method, | ||
* query: request.query, | ||
* body: JSON.stringify(request.body), | ||
* body, | ||
* headers: request.headers, | ||
@@ -1396,2 +1404,14 @@ * }); | ||
eventNotification: WebhookEventNotification; | ||
signature: { | ||
sha1: { | ||
value: string; | ||
getCalculatedSignature: (appSecret: string) => string; | ||
check: (appSecret: string) => boolean; | ||
}; | ||
sha256: { | ||
value: string; | ||
getCalculatedSignature: (appSecret: string) => string; | ||
check: (appSecret: string) => boolean; | ||
}; | ||
}; | ||
checkSignature: (appSecret: string) => boolean; | ||
@@ -1398,0 +1418,0 @@ verifySignature(appSecret: string): void; |
@@ -1,1 +0,1 @@ | ||
import{a as e,b as s}from"./chunk-EW3NUE3Y.js";export{e as Client,e as CloudAPI,s as MessageType,e as default}; | ||
import{a as e,b as s}from"./chunk-FLWK7R2Z.js";export{e as Client,e as CloudAPI,s as MessageType,e as default}; |
{ | ||
"name": "@great-detail/whatsapp", | ||
"version": "7.0.8", | ||
"version": "7.0.9", | ||
"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
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
121992
1484