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

whatsapp-business

Package Overview
Dependencies
Maintainers
1
Versions
32
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

whatsapp-business - npm Package Compare versions

Comparing version 1.2.0 to 1.2.1

5

dist/package.json
{
"name": "whatsapp-business",
"author": "MarcosNicolau",
"version": "1.2.0",
"version": "1.2.1",
"description": "This is the common configuration for node js project with typescript I always do",

@@ -28,3 +28,4 @@ "licenses": [

"dependencies": {
"axios": "^0.27.2"
"axios": "^0.27.2",
"form-data": "^4.0.0"
},

@@ -31,0 +32,0 @@ "devDependencies": {

4

dist/src/client.d.ts

@@ -20,5 +20,5 @@ import { Message, SendMessageResponse, GetBusinessPhoneNumberResponse, RequestPhoneNumberVerificationCodeArgs, VerifyPhoneNumberArgs, RegisterPhoneArgs, SetUpTwoFactorAuthArgs, DefaultResponse, BusinessProfile, BusinessProfileFieldsQuery, UpdateBusinessProfilePayload, GetMediaResponse, UploadMediaPayload, UploadMediaResponse, BusinessPhoneNumber } from "./types";

updateBusinessProfile(payload: UpdateBusinessProfilePayload): Promise<DefaultResponse>;
uploadMedia(payload: Omit<UploadMediaPayload, "messaging_product">): Promise<UploadMediaResponse>;
uploadMedia({ file, type }: Omit<UploadMediaPayload, "messaging_product">): Promise<UploadMediaResponse>;
getMedia(id: string): Promise<GetMediaResponse>;
deleteMedia(id: string): void;
deleteMedia(id: string): Promise<DefaultResponse>;
/**

@@ -25,0 +25,0 @@ *

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

var fs_1 = __importDefault(require("fs"));
var form_data_1 = __importDefault(require("form-data"));
var errorHandler_1 = require("./utils/errorHandler");

@@ -104,10 +105,17 @@ var restClient_1 = require("./utils/restClient");

*/
WABAClient.prototype.uploadMedia = function (payload) {
return this.restClient.post("".concat(this.phoneId, "/media"), __assign(__assign({}, payload), { messaging_product: "whatsapp" }));
WABAClient.prototype.uploadMedia = function (_a) {
var file = _a.file, type = _a.type;
var formData = new form_data_1.default();
formData.append("type", type);
formData.append("file", fs_1.default.createReadStream(file));
formData.append("messaging_product", "whatsapp");
return this.restClient.post("".concat(this.phoneId, "/media"), formData, {
headers: { "Content-Type": "multipart/form-data" },
});
};
WABAClient.prototype.getMedia = function (id) {
return this.restClient.get("".concat(this.phoneId, "/").concat(id));
return this.restClient.get(id);
};
WABAClient.prototype.deleteMedia = function (id) {
this.restClient.delete("".concat(this.phoneId, "/").concat(id));
return this.restClient.delete(id);
};

@@ -121,9 +129,15 @@ /**

return __awaiter(this, void 0, void 0, function () {
var response;
var response, err_1;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.restClient.get("", {}, { baseURL: url, responseType: "stream" })];
case 0:
_a.trys.push([0, 2, , 3]);
return [4 /*yield*/, this.restClient.get(url, {}, { baseURL: "", responseType: "stream" })];
case 1:
response = _a.sent();
return [2 /*return*/, response.pipe(fs_1.default.createWriteStream(pathToSaveFile))];
case 2:
err_1 = _a.sent();
return [2 /*return*/, Promise.reject(err_1)];
case 3: return [2 /*return*/];
}

@@ -174,3 +188,3 @@ });

return __generator(this, function (_a) {
return [2 /*return*/, this.restClient.get("/".concat(this.accountId, "/").concat(phoneNumberId))];
return [2 /*return*/, this.restClient.get(phoneNumberId)];
});

@@ -214,3 +228,3 @@ });

return __generator(this, function (_b) {
return [2 /*return*/, this.restClient.post("".concat(phoneNumberId), payload)];
return [2 /*return*/, this.restClient.post(phoneNumberId, payload)];
});

@@ -217,0 +231,0 @@ });

@@ -16,2 +16,2 @@ export declare type BusinessVertical = "UNDEFINED" | "OTHER" | "AUTO" | "BEAUTY" | "APPAREL" | "EDU" | "ENTERTAIN" | "EVENT_PLAN" | "FINANCE" | "GROCERY" | "GOVT" | "HOTEL" | "HEALTH" | "NONPROFIT" | "PROF_SERVICES" | "RETAIL" | "TRAVEL" | "RESTAURANT" | "NOT_A_BIZ";

export declare type BusinessProfileFieldsQuery = (keyof BusinessProfileFields)[];
export declare type UpdateBusinessProfilePayload = Partial<Omit<BusinessProfileFields, "messaging_product">>;
export declare type UpdateBusinessProfilePayload = Partial<Omit<BusinessProfileFields, "messaging_product" | "id">>;
export declare type MediaAcceptedFileTypes = "image/jpeg" | "image/png" | "text/plain" | "application/pdf" | "application/vnd.ms-powerpoint" | "application/msword" | "application/vnd.ms-excel" | "application/vnd.openxmlformats-officedocument.wordprocessingml.document" | "application/vnd.openxmlformats-officedocument.presentationml.presentation" | "application/vnd.openxmlformats-officedocument.spreadsheetml.sheet" | "audio/aac" | "audio/mp4" | "audio/mpeg" | "audio/amr" | "audio/ogg" | "audio/opus" | "video/mp4" | "video/3gp" | "image/webp";
export declare type UploadMediaPayload = {
/**
* Path to the file stored in your local directory. For example: "@/local/path/file.jpg".
*/
file: string;

@@ -4,0 +7,0 @@ type: MediaAcceptedFileTypes;

export declare type BusinessPhoneNumber = {
verified_name: "Jasper's Market";
display_phone_number: "+1 631-555-5555";
id: "1906385232743451";
quality_rating: "GREEN";
verified_name: string;
display_phone_number: string;
id: string;
quality_rating: string;
code_verification_status?: string;
};
export declare type GetBusinessPhoneNumberResponse = {
data: BusinessPhoneNumber[];
paging: {
cursors: {
before: string;
after: string;
};
};
};

@@ -15,3 +22,3 @@ export declare type RequestPhoneNumberVerificationCodePayload = {

*/
locale: string;
language: string;
};

@@ -18,0 +25,0 @@ export declare type RequestPhoneNumberVerificationCodeArgs = RequestPhoneNumberVerificationCodePayload & {

@@ -20,4 +20,4 @@ "use strict";

var err = __assign(__assign({}, error === null || error === void 0 ? void 0 : error.error), { message: message });
return Promise.reject(err);
return Promise.reject(err.message ? err : error);
};
exports.WABAErrorHandler = WABAErrorHandler;
{
"name": "whatsapp-business",
"author": "MarcosNicolau",
"version": "1.2.0",
"version": "1.2.1",
"description": "This is the common configuration for node js project with typescript I always do",

@@ -28,3 +28,4 @@ "licenses": [

"dependencies": {
"axios": "^0.27.2"
"axios": "^0.27.2",
"form-data": "^4.0.0"
},

@@ -31,0 +32,0 @@ "devDependencies": {

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