@gamastudio/sendwave-provider 0.0.20 → 0.0.21-dev

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.
@@ -8,7 +8,6 @@ export interface ParsedMessage {
8
8
  media?: string;
9
9
  caption?: string;
10
10
  remoteJid: string;
11
- remoteJidAlt: string;
12
11
  originalPayload: {
13
12
  key: any;
14
13
  };
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamastudio/sendwave-provider",
3
- "version": "0.0.20",
3
+ "version": "0.0.21-dev",
4
4
  "description": "Librería para interactuar con Sendwave usando configuración dinámica.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",
@@ -30,6 +30,7 @@ class SendWaveCore extends node_events_1.EventEmitter {
30
30
  var _a, _b, _c, _d, _e;
31
31
  try {
32
32
  const { body } = req;
33
+ console.log(body);
33
34
  if (!["messages.upsert", "send.message"].includes(body.event)) {
34
35
  return res.end("Message queued");
35
36
  }
@@ -77,7 +77,7 @@ class SenderMessage {
77
77
  delay: data.delay || 2000,
78
78
  });
79
79
  return await ((_a = this.sendwaveApi) === null || _a === void 0 ? void 0 : _a.post(`/message/sendText/${(_b = this.globalVendorArgs) === null || _b === void 0 ? void 0 : _b.name}`, {
80
- number: data.from.split("@")[0],
80
+ number: data.from,
81
81
  text: data.text,
82
82
  ...this.globalVendorArgs,
83
83
  }));
@@ -118,7 +118,7 @@ class SenderMessage {
118
118
  })),
119
119
  }));
120
120
  return await ((_a = this.sendwaveApi) === null || _a === void 0 ? void 0 : _a.post(`/message/sendList/${(_b = this.globalVendorArgs) === null || _b === void 0 ? void 0 : _b.name}`, {
121
- number: data.from.split("@")[0],
121
+ number: data.from,
122
122
  title,
123
123
  description,
124
124
  footerText,
@@ -174,7 +174,7 @@ class SenderMessage {
174
174
  }
175
175
  return await ((_c = this.sendwaveApi) === null || _c === void 0 ? void 0 : _c.post(`/message/sendMedia/${(_d = this.globalVendorArgs) === null || _d === void 0 ? void 0 : _d.name}`, {
176
176
  // ...this.globalVendorArgs,
177
- number: data.from.split("@")[0],
177
+ number: data.from,
178
178
  mediatype: mediaType,
179
179
  mimetype: mimeType,
180
180
  fileName: data.fileName || `${(0, crypto_1.randomUUID)()}.${mimeType.split("/")[1]}`,
@@ -314,7 +314,7 @@ class SenderMessage {
314
314
  var _a, _b, _c, _d, _e;
315
315
  try {
316
316
  return await ((_a = this.sendwaveApi) === null || _a === void 0 ? void 0 : _a.post(`/message/sendButtons/${(_b = this.globalVendorArgs) === null || _b === void 0 ? void 0 : _b.name}`, {
317
- number: data.from.split("@")[0],
317
+ number: data.from,
318
318
  title: data.title,
319
319
  body: data.body,
320
320
  description: data.description,
@@ -340,7 +340,7 @@ class SenderMessage {
340
340
  var _a, _b, _c, _d, _e;
341
341
  try {
342
342
  return await ((_a = this.sendwaveApi) === null || _a === void 0 ? void 0 : _a.post(`/message/sendLocation/${(_b = this.globalVendorArgs) === null || _b === void 0 ? void 0 : _b.name}`, {
343
- number: data.from.split("@")[0],
343
+ number: data.from,
344
344
  name: data.name,
345
345
  address: data.address,
346
346
  latitude: data.latitude,
@@ -12,15 +12,14 @@ function parseIncomingMsg(payload) {
12
12
  return null;
13
13
  }
14
14
  // if (msg.key.fromMe) return null
15
- const fromMe = msg.key.fromMe;
16
- const remoteJid = msg.key.remoteJidAlt || "";
17
- const remoteJidAlt = msg.key.remoteJidAlt;
18
- const from = msg.key.remoteJid.includes("lid")
19
- ? msg.key.remoteJid
20
- : msg.key.remoteJid.split("@")[0].split(":")[0];
21
- // const from = (msg.key?.remoteJid || "")
15
+ const fromMe = msg.fromMe;
16
+ const remoteJid = msg.remoteJidAlt || "";
17
+ const from = msg.remoteJid.includes("lid")
18
+ ? msg.remoteJid
19
+ : msg.remoteJid.split("@")[0].split(":")[0];
20
+ // const from = (msg?.remoteJid || "")
22
21
  const to = payload.instance || "";
23
- const name = msg.pushName;
22
+ const name = msg.name;
24
23
  const messageContent = msg.message || {};
25
24
  const messageType = msg.messageType || Object.keys(messageContent)[0];
26
25
  let body = "";
@@ -93,7 +92,6 @@ function parseIncomingMsg(payload) {
93
92
  return {
94
93
  fromMe,
95
94
  remoteJid,
96
- remoteJidAlt,
97
95
  from,
98
96
  to,
99
97
  name,
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@gamastudio/sendwave-provider",
3
- "version": "0.0.20",
3
+ "version": "0.0.21-dev",
4
4
  "description": "Librería para interactuar con Sendwave usando configuración dinámica.",
5
5
  "main": "build/index.js",
6
6
  "types": "build/index.d.ts",