evolution-api-sdk
Version:
Unofficial SDK for the Evolution Whatsapp API v2
124 lines (121 loc) • 4.08 kB
JavaScript
var __defProp = Object.defineProperty;
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
var __getOwnPropNames = Object.getOwnPropertyNames;
var __hasOwnProp = Object.prototype.hasOwnProperty;
var __export = (target, all) => {
for (var name in all)
__defProp(target, name, { get: all[name], enumerable: true });
};
var __copyProps = (to, from, except, desc) => {
if (from && typeof from === "object" || typeof from === "function") {
for (let key of __getOwnPropNames(from))
if (!__hasOwnProp.call(to, key) && key !== except)
__defProp(to, key, { get: () => from[key], enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable });
}
return to;
};
var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
// src/modules/webhook/index.ts
var webhook_exports = {};
__export(webhook_exports, {
WebhookModule: () => WebhookModule
});
module.exports = __toCommonJS(webhook_exports);
// src/api/routes.ts
var Routes = {
Message: {
SendText: "message/sendText",
SendMedia: "message/sendMedia",
SendVoice: "message/sendWhatsAppAudio",
SendSticker: "message/sendSticker",
SendLocation: "message/sendLocation",
SendContact: "message/sendContact",
SendPoll: "message/sendPoll",
SendReaction: "message/sendReaction",
SendTemplate: "message/sendTemplate",
SendStatus: "message/sendStatus",
SendList: "message/sendList"
},
Chats: {
Check: "chat/whatsappNumbers",
FindAll: "chat/findChats",
SendPresence: "chat/sendPresence",
MarkAsRead: "chat/markMessageAsRead",
MarkAsUnread: "chat/markChatUnread",
Archive: "chat/archive",
DeleteMessage: "chat/deleteMessageForEveryone",
FetchProfilePicture: "chat/fetchProfilePictureUrl",
FindContacts: "chat/findContacts",
FindMessages: "chat/findMessages",
FindStatusMessage: "chat/findStatusMessage",
UpdateMessage: "chat/updateMessage"
},
Groups: {
FindAll: "group/fetchAllGroups",
FindByJid: "group/findGroupInfos",
FindByInviteCode: "group/inviteInfo",
Create: "group/create",
UpdatePicture: "group/updateGroupPicture",
UpdateSubject: "group/updateGroupSubject",
UpdateDescription: "group/updateGroupDescription",
FetchInviteCode: "group/fetchInviteCode",
AcceptInviteCode: "group/acceptInviteCode",
RevokeInviteCode: "group/revokeInviteCode",
SendGroupInvite: "group/sendGroupInvite",
FindMembers: "group/findGroupMembers",
UpdateMembers: "group/updateGroupMembers",
UpdateSetting: "group/updateGroupSetting",
ToggleEphemeral: "group/toggleEphemeral",
Leave: "group/leaveGroup"
},
Profile: {
FetchBusinessProfile: "chat/fetchBusinessProfile",
FetchProfile: "chat/fetchProfile",
UpdateName: "chat/updateProfileName",
UpdateStatus: "chat/updateProfileStatus",
UpdatePicture: "chat/updateProfilePicture",
RemovePicture: "chat/removeProfilePicture",
FetchPrivacySettings: "chat/fetchPrivacySettings",
UpdatePrivacySettings: "chat/updatePrivacySettings"
},
Webhook: {
Set: "webhook/set",
Find: "webhook/find"
},
Settings: {
Set: "settings/set",
Find: "settings/find"
},
Instance: {
Create: "instance/create",
FetchAll: "instance/fetchInstances",
Connect: "instance/connect",
Restart: "instance/restart",
ConnectionState: "instance/connectionState",
Logout: "instance/logout",
Delete: "instance/delete",
SetPresence: "instance/setPresence"
}
};
// src/modules/webhook/index.ts
var WebhookModule = class {
constructor(api) {
this.api = api;
}
async set(options, methodOptions) {
const response = await this.api.post(Routes.Webhook.Set, {
body: options,
...methodOptions
});
return response;
}
async find(methodOptions) {
const response = await this.api.get(Routes.Webhook.Find, methodOptions);
return response;
}
};
// Annotate the CommonJS export names for ESM import in node:
0 && (module.exports = {
WebhookModule
});
//# sourceMappingURL=index.js.map