@builderbot/provider-evolution-api 1.2.7 → 1.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,11 +1,16 @@
1
- import type { MetaList } from '~/types';
1
+ import type polka from 'polka';
2
2
  export interface EvolutionInterface {
3
- sendText: (to: string, message: string, context: string | null) => Promise<any>;
4
- sendImage: (to: string, mediaInput: string | null, caption: string, context: string | null) => Promise<any>;
5
- sendImageUrl: (to: string, url: string, caption: string, context: string | null) => Promise<void>;
6
- sendVideo: (to: string, pathVideo: string | null, caption: string, context: string | null) => Promise<any>;
7
- sendVideoUrl: (to: string, url: string, caption: string, context: string | null) => Promise<void>;
8
- sendMedia: (to: string, text: string, mediaInput: string, context: string | null) => Promise<any>;
9
- sendList: (to: string, list: MetaList) => Promise<any>;
3
+ indexHome?: polka.Middleware;
4
+ sendMessageEvoApi: (body: any, ruta: string) => Promise<any>;
5
+ sendMessageMeta: (body: any) => Promise<any>;
6
+ sendMessageToApi: (body: any, ruta?: string) => Promise<any>;
7
+ sendMessage: <K = any>(to: string, message: string, args?: any) => Promise<K>;
8
+ sendText: (to: string, message: string, context?: string | null) => Promise<any>;
9
+ sendImage: (to: string, mediaInput: string, caption?: string, context?: string | null) => Promise<any>;
10
+ sendVideo: (to: string, mediaUrl: string, mediaName?: string, caption?: string) => Promise<any>;
11
+ sendAudio: (to: string, mediaUrl: string, mediaName?: string, caption?: string) => Promise<any>;
12
+ sendMedia: (to: string, file: string, type: string) => Promise<any>;
13
+ sendFile: (to: string, file: string, caption?: string) => Promise<any>;
14
+ incomingMsg: (req: any, res: any) => void | Promise<void>;
10
15
  }
11
16
  //# sourceMappingURL=evolution.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"evolution.d.ts","sourceRoot":"","sources":["../../src/interface/evolution.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAqE,QAAQ,EAAE,MAAM,SAAS,CAAA;AAE1G,MAAM,WAAW,k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AM,EAAE,IAAI,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACnE,QAAQ,EAAE,CAAC,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,MAAM,KAAK,OAAO,CAAC,GAAG,CAAC,CAAA;IACtE,WAAW,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,GAAG,KAAK,IAAI,GAAG,OAAO,CAAC,IAAI,CAAC,CAAA;CAC5D"}
package/dist/types.d.ts CHANGED
@@ -9,199 +9,76 @@ export declare class File {
9
9
  caption?: string;
10
10
  link?: string;
11
11
  }
12
- interface TemplateMessage {
13
- name: string;
14
- language: {
15
- code: string;
16
- };
17
- components: TemplateComponent[];
18
- }
19
- interface TemplateComponent {
20
- type: 'header' | 'body' | 'button';
21
- parameters?: TemplateParameter[];
22
- }
23
- interface Section {
24
- title: string;
25
- rows: Row[];
26
- }
27
- interface Row {
28
- id: string;
29
- title: string;
30
- description: string;
31
- }
32
- interface TemplateParameter {
33
- type: string;
34
- }
35
- export interface MediaResponse {
36
- url?: string;
37
- }
38
- export interface MetaList {
39
- header: {
40
- type: string;
41
- text: string;
42
- };
43
- body: {
44
- text: string;
45
- };
46
- footer: {
47
- text: string;
48
- };
49
- action: {
50
- button: string;
51
- sections: Section[];
52
- };
53
- }
54
- export interface EvolutionGlobalVendorArgs extends GlobalVendorArgs {
55
- name: string;
56
- apiKey: string;
57
- baseURL: string;
58
- instanceName: string;
59
- }
60
- export interface Order {
61
- catalog_id: string;
62
- product_items: string[];
63
- }
64
- export interface Contact {
65
- profile: Profile;
66
- wa_id: string;
67
- name: string;
68
- phones: string[];
69
- }
70
- export interface Message {
71
- message_id?: string;
72
- timestamp?: any;
73
- type: string;
74
- from: string;
75
- to: string;
76
- body: string;
77
- pushName: string;
78
- name: string;
79
- url?: string;
80
- fileData?: File | null;
81
- payload?: string;
82
- title_button_reply?: string;
83
- title_list_reply?: string;
84
- latitude?: number;
85
- longitude?: number;
86
- contacts?: Contact[];
87
- nfm_reply?: string;
88
- order?: Order;
89
- id?: string;
90
- caption?: string;
91
- }
92
- export interface ParamsIncomingMessage {
93
- messageId?: string;
94
- messageTimestamp?: any;
95
- pushName: string;
96
- to: string;
97
- jwtToken: string;
98
- numberId: string;
99
- version: string;
100
- message: any;
101
- fileData?: File | null;
102
- }
103
- export type TextGenericParams = {
104
- messaging_product: 'whatsapp';
105
- recipient_type: string;
106
- to: string;
107
- type: string;
108
- [key: string]: any;
109
- };
110
- export interface ParsedContact {
111
- name: {
112
- formatted_name: string;
113
- first_name: string;
114
- [key: string]: any;
115
- };
116
- phones: {
117
- phone: string;
118
- type: string;
119
- [key: string]: any;
120
- }[];
121
- [key: string]: any;
122
- }
123
- export interface TextMessageBody {
124
- messaging_product: string;
125
- to: string;
126
- type: string;
127
- recipient_type?: string;
128
- text?: {
129
- preview_url: boolean;
130
- body: string;
131
- };
132
- image?: File;
133
- video?: File;
134
- audio?: File;
135
- document?: File;
136
- interactive?: any;
137
- contacts?: any[];
138
- context?: string;
139
- template?: TemplateMessage;
140
- }
141
- export interface Reaction {
142
- message_id: string;
143
- emoji: string;
144
- }
145
- export interface Localization {
146
- long_number: string;
147
- lat_number: string;
148
- name: string;
149
- address: string;
150
- }
151
12
  export interface SaveFileOptions {
152
13
  path?: string;
153
14
  }
154
- export interface WhatsAppProfile {
155
- verified_name: string;
156
- code_verification_status: string;
157
- display_phone_number: string;
158
- quality_rating: string;
159
- platform_type: string;
160
- throughput: {
161
- level: string;
162
- };
163
- id: string;
164
- }
165
- export interface IncomingMessage {
166
- object: string;
167
- entry: Entry[];
168
- }
169
- export interface Entry {
170
- id: string;
171
- changes: Change[];
172
- }
173
- export interface Change {
174
- value: Value;
175
- field: string;
176
- }
177
- export interface Value {
178
- messaging_product: string;
179
- metadata: Metadata;
180
- contacts: ContactMeta[];
181
- messages: MessageFromMeta[];
182
- }
183
- export interface Metadata {
184
- display_phone_number: string;
185
- phone_number_id: string;
186
- }
187
- export interface ContactMeta {
188
- profile: Profile;
189
- wa_id: string;
190
- name: string;
191
- phones: string[];
192
- }
193
- export interface Profile {
194
- name: string;
195
- }
196
- export interface MessageFromMeta {
197
- from: string;
198
- id: string;
199
- timestamp: string;
200
- text: Text;
201
- type: string;
202
- }
203
- export interface Text {
204
- body: string;
15
+ export interface EvolutionGlobalVendorArgs extends GlobalVendorArgs {
16
+ participant?: string;
17
+ }
18
+ /**
19
+ * Device metadata for message encryption
20
+ */
21
+ export interface DeviceListMetadata {
22
+ senderKeyHash: string;
23
+ senderTimestamp: string;
24
+ recipientKeyHash: string;
25
+ recipientTimestamp: string;
26
+ }
27
+ /**
28
+ * Context information for a message
29
+ */
30
+ export interface MessageContextInfo {
31
+ deviceListMetadata: DeviceListMetadata;
32
+ deviceListMetadataVersion: number;
33
+ messageSecret: string;
34
+ }
35
+ /**
36
+ * Types of messages that can be received
37
+ */
38
+ export type MessageType = 'conversation' | 'imageMessage' | 'videoMessage' | 'audioMessage' | 'documentMessage' | 'stickerMessage' | 'contactMessage' | 'locationMessage' | 'extendedTextMessage' | 'buttonResponseMessage' | 'templateButtonReplyMessage' | 'listResponseMessage' | 'reactionMessage';
39
+ /**
40
+ * Possible sources for the webhook event
41
+ */
42
+ export type MessageSource = 'android' | 'ios' | 'web' | 'desktop' | 'unknown';
43
+ /**
44
+ * Possible message content types in a webhook
45
+ */
46
+ export interface WebhookMessage {
47
+ conversation?: string;
48
+ messageContextInfo?: MessageContextInfo;
49
+ }
50
+ /**
51
+ * Status of a message
52
+ */
53
+ export type MessageStatus = 'PENDING' | 'SERVER_ACK' | 'DELIVERY_ACK' | 'READ' | 'PLAYED';
54
+ /**
55
+ * Main data payload of the webhook event
56
+ */
57
+ export interface WebhookEventData {
58
+ key: WebhookEvent;
59
+ pushName: string;
60
+ status: MessageStatus;
61
+ message: WebhookMessage;
62
+ messageType: MessageType;
63
+ messageTimestamp: number;
64
+ instanceId: string;
65
+ source: MessageSource;
66
+ }
67
+ /**
68
+ * Event types supported by the webhook
69
+ */
70
+ export type WebhookEventType = 'messages.upsert' | 'messages.update' | 'messages.delete' | 'presence.update' | 'contacts.update' | 'groups.update' | 'groups.upsert' | 'group-participants.update' | 'status.update';
71
+ /**
72
+ * Complete webhook event structure
73
+ */
74
+ export interface WebhookEvent {
75
+ event: WebhookEventType;
76
+ instance: string;
77
+ data: WebhookEventData;
78
+ destination: string;
79
+ date_time: string;
80
+ sender: string;
81
+ server_url: string;
82
+ apikey: string;
205
83
  }
206
- export {};
207
84
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAA;AAclE,qBAAa,IAAI;IACb,SAAS,CAAC,EAAE,MAAM,CAAA;IAClB,MAAM,CAAC,EAAE,MAAM,CAAA;IACf,EAAE,CAAC,EAAE,MAAM,CAAA;IACX,KAAK,CAAC,EAAE,OAAO,CAAA;IACf,QAAQ,CAAC,EAAE,OAAO,CAAA;IAClB,QAAQ,CAAC,EAAE,MAAM,CAAA;IACjB,OAAO,CAAC,EAAE,MAAM,CAAA;IAChB,IAAI,CAAC,EAAE,MAAM,CAAA;CAChB;AAED,UAAU,eAAe;IACrB,IAAI,EAAE,MAAM,CAAA;IACZ,QAAQ,EAAE;QACN,IAAI,EAAE,MAAM,CAAA;KACf,CAAA;IACD,UAAU,EAAE,iBAAiB,EAAE,CAAA;CAClC;AAED,UAAU,iBAAiB;IACvB,IAAI,EAAE,QAAQ,GAAG,MAAM,GAAG,QAAQ,CAAA;IAClC,UAAU,CAAC,EAAE,iBAAiB,EAAE,CAAA;CACnC;AAED,UAAU,OAAO;IACb,KAAK,EAAE,MAAM,CAAA;IACb,IAAI,EAAE,GAAG,EAAE,CAAA;CACd;AAED,UAAU,GAAG;IACT,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE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B;IAC7B,GAAG,EAAE,YAAY,CAAA;IACjB,QAAQ,EAAE,MAAM,CAAA;IAChB,MAAM,EAAE,aAAa,CAAA;IACrB,OAAO,EAAE,cAAc,CAAA;IACvB,WAAW,EAAE,WAAW,CAAA;IACxB,gBAAgB,EAAE,MAAM,CAAA;IACxB,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,aAAa,CAAA;CACxB;AAED;;GAEG;AACH,MAAM,MAAM,gBAAgB,GACtB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,iBAAiB,GACjB,eAAe,GACf,eAAe,GACf,2BAA2B,GAC3B,eAAe,CAAA;AAErB;;GAEG;AACH,MAAM,WAAW,YAAY;IACzB,KAAK,EAAE,gBAAgB,CAAA;IACvB,QAAQ,EAAE,MAAM,CAAA;IAChB,IAAI,EAAE,gBAAgB,CAAA;IACtB,WAAW,EAAE,MAAM,CAAA;IACnB,SAAS,EAAE,MAAM,CAAA;IACjB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,MAAM,EAAE,MAAM,CAAA;CACjB"}
@@ -0,0 +1,8 @@
1
+ /**
2
+ * Descargar archivo binario en tmp
3
+ * @param url - La URL del archivo a descargar
4
+ * @returns La ruta al archivo descargado
5
+ */
6
+ declare const generalDownload: (url: string, pathToSave?: string, headers?: Record<string, any>) => Promise<string>;
7
+ export { generalDownload };
8
+ //# sourceMappingURL=download.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"download.d.ts","sourceRoot":"","sources":["../../src/utils/download.ts"],"names":[],"mappings":"AAuBA;;;;GAIG;AACH,QAAA,MAAM,eAAe,GAAU,KAAK,MAAM,EAAE,aAAa,MAAM,EAAE,UAAU,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,KAAG,OAAO,CAAC,MAAM,CA0E9G,CAAA;AAED,OAAO,EAAE,eAAe,EAAE,CAAA"}
@@ -1,6 +1,2 @@
1
- export { getMediaUrl } from './mediaUrl';
2
- export { downloadFile, fileTypeFromFile } from './downloadFile';
3
- export { processIncomingMessage } from './processIncomingMsg';
4
- export { getProfile } from './profile';
5
- export { parseMetaNumber } from './number';
1
+ export { generalDownload } from './download';
6
2
  //# sourceMappingURL=index.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,YAAY,CAAA;AACxC,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,MAAM,gBAAgB,CAAA;AAC/D,OAAO,EAAE,sBAAsB,EAAE,MAAM,sBAAsB,CAAA;AAC7D,OAAO,EAAE,UAAU,EAAE,MAAM,WAAW,CAAA;AACtC,OAAO,EAAE,eAAe,EAAE,MAAM,UAAU,CAAA"}
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/utils/index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,eAAe,EAAE,MAAM,YAAY,CAAA"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@builderbot/provider-evolution-api",
3
- "version": "1.2.7",
3
+ "version": "1.2.8",
4
4
  "description": "> TODO: description",
5
5
  "author": "aurik3 <aurik3@gmail.com>",
6
6
  "homepage": "https://github.com/aurik3/bot-whatsapp#readme",
@@ -8,12 +8,6 @@
8
8
  "main": "dist/index.cjs",
9
9
  "types": "dist/index.d.ts",
10
10
  "type": "module",
11
- "exports": {
12
- ".": {
13
- "import": "./dist/index.js",
14
- "require": "./dist/index.cjs"
15
- }
16
- },
17
11
  "directories": {
18
12
  "src": "src",
19
13
  "test": "__tests__"
@@ -35,16 +29,18 @@
35
29
  "url": "https://github.com/aurik3/bot-whatsapp/issues"
36
30
  },
37
31
  "dependencies": {
32
+ "@polka/parse": "1.0.0-next.0",
38
33
  "axios": "^1.6.8",
39
34
  "body-parser": "^1.20.2",
40
35
  "file-type": "^19.0.0",
36
+ "follow-redirects": "^1.15.6",
41
37
  "form-data": "^4.0.0",
42
38
  "mime-types": "^2.1.35",
43
39
  "polka": "^0.5.2",
44
40
  "queue-promise": "^2.2.1"
45
41
  },
46
42
  "devDependencies": {
47
- "@builderbot/bot": "workspace:^",
43
+ "@builderbot/bot": "^1.2.8",
48
44
  "@jest/globals": "^29.7.0",
49
45
  "@rollup/plugin-commonjs": "^25.0.7",
50
46
  "@rollup/plugin-json": "^6.1.0",
@@ -69,5 +65,5 @@
69
65
  "tslib": "^2.6.2",
70
66
  "tsm": "^2.3.0"
71
67
  },
72
- "gitHead": "f21e49621dffad2a1226aecea535668016f07b14"
68
+ "gitHead": "78def3faaf078251134c8eca52cdcb31d390c623"
73
69
  }
@@ -1,16 +0,0 @@
1
- import type { AxiosResponse } from 'axios';
2
- /**
3
- * Extraer el mimetype from buffer
4
- * @param response - La respuesta HTTP
5
- * @returns Un objeto con el tipo y la extensión del archivo
6
- */
7
- declare const fileTypeFromFile: (response: AxiosResponse) => Promise<{
8
- type: string | null;
9
- ext: string | false;
10
- }>;
11
- declare function downloadFile(url: string, Token: string): Promise<{
12
- buffer: Buffer;
13
- extension: string;
14
- }>;
15
- export { downloadFile, fileTypeFromFile };
16
- //# sourceMappingURL=downloadFile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"downloadFile.d.ts","sourceRoot":"","sources":["../../src/utils/downloadFile.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,OAAO,CAAA;AAG1C;;;;GAIG;AACH,QAAA,MAAM,gBAAgB,GAAU,UAAU,aAAa,KAAG,OAAO,CAAC;IAAE,IAAI,EAAE,MAAM,GAAG,IAAI,CAAC;IAAC,GAAG,EAAE,MAAM,GAAG,KAAK,CAAA;CAAE,CAO7G,CAAA;AAED,iBAAe,YAAY,CAAC,GAAG,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC;IAAE,MAAM,EAAE,MAAM,CAAC;IAAC,SAAS,EAAE,MAAM,CAAA;CAAE,CAAC,CAkBtG;AAED,OAAO,EAAE,YAAY,EAAE,gBAAgB,EAAE,CAAA"}
@@ -1,3 +0,0 @@
1
- declare function getMediaUrl(version: string, IdMedia: string, numberId: string, Token: string): Promise<string | undefined>;
2
- export { getMediaUrl };
3
- //# sourceMappingURL=mediaUrl.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"mediaUrl.d.ts","sourceRoot":"","sources":["../../src/utils/mediaUrl.ts"],"names":[],"mappings":"AAKA,iBAAe,WAAW,CACtB,OAAO,EAAE,MAAM,EACf,OAAO,EAAE,MAAM,EACf,QAAQ,EAAE,MAAM,EAChB,KAAK,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,GAAG,SAAS,CAAC,CAe7B;AAED,OAAO,EAAE,WAAW,EAAE,CAAA"}
@@ -1,2 +0,0 @@
1
- export declare const parseMetaNumber: (number: string) => string;
2
- //# sourceMappingURL=number.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"number.d.ts","sourceRoot":"","sources":["../../src/utils/number.ts"],"names":[],"mappings":"AAAA,eAAO,MAAM,eAAe,GAAI,QAAQ,MAAM,KAAG,MAMhD,CAAA"}
@@ -1,3 +0,0 @@
1
- import type { Message, ParamsIncomingMessage as ParamsIncomingMessage } from '../types';
2
- export declare const processIncomingMessage: ({ messageId, messageTimestamp, pushName, message, to, jwtToken, version, numberId, fileData, }: ParamsIncomingMessage) => Promise<Message>;
3
- //# sourceMappingURL=processIncomingMsg.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"processIncomingMsg.d.ts","sourceRoot":"","sources":["../../src/utils/processIncomingMsg.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,OAAO,EAAE,qBAAqB,IAAI,qBAAqB,EAAE,MAAM,UAAU,CAAA;AAEvF,eAAO,MAAM,sBAAsB,GAAU,gGAU1C,qBAAqB,KAAG,OAAO,CAAC,OAAO,CA2KzC,CAAA"}
@@ -1,4 +0,0 @@
1
- import type { WhatsAppProfile } from '~/types';
2
- declare function getProfile(version: string, numberId: string, token: string): Promise<WhatsAppProfile>;
3
- export { getProfile };
4
- //# sourceMappingURL=profile.d.ts.map
@@ -1 +0,0 @@
1
- {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../../src/utils/profile.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,MAAM,SAAS,CAAA;AAE9C,iBAAe,UAAU,CAAC,OAAO,EAAE,MAAM,EAAE,QAAQ,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,GAAG,OAAO,CAAC,eAAe,CAAC,CAUpG;AAED,OAAO,EAAE,UAAU,EAAE,CAAA"}