@peopl-health/nexus 2.0.6 → 2.0.7

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.
@@ -444,13 +444,8 @@ class NexusMessaging {
444
444
  }
445
445
 
446
446
  async handleInteractive(messageData) {
447
- if (this.messageStorage) {
448
- await this.messageStorage.saveInteractive(messageData);
449
- }
450
-
451
447
  this.events.emit('interactive:received', messageData);
452
448
 
453
- // Run interactive handler if available
454
449
  const result = await this._runPipeline('interactive', messageData, async (ctx) => {
455
450
  const handler = this.handlers.onInteractive;
456
451
  if (handler) {
@@ -14,7 +14,7 @@ const messageSchema = new mongoose.Schema({
14
14
  is_group: { type: Boolean, required: true },
15
15
  is_media: { type: Boolean, required: true },
16
16
  is_interactive: { type: Boolean, default: false },
17
- interaction_type: {
17
+ interactive_type: {
18
18
  type: String,
19
19
  enum: ['button', 'list', 'flow', 'quick_reply'],
20
20
  default: null
@@ -98,7 +98,7 @@ async function insertMessage(values) {
98
98
  is_group: values.is_group,
99
99
  is_media: values.is_media,
100
100
  is_interactive: values.is_interactive || false,
101
- interaction_type: values.interaction_type || null,
101
+ interactive_type: values.interactive_type || null,
102
102
  interactive_data: values.interactive_data || null,
103
103
  group_id: values.group_id,
104
104
  reply_id: values.reply_id,
@@ -21,7 +21,7 @@ class MongoStorage {
21
21
  const interactionSchema = new mongoose.Schema({
22
22
  messageId: String,
23
23
  numero: String,
24
- interaction_type: String, // 'button', 'list', 'flow'
24
+ interactive_type: String, // 'button', 'list', 'flow'
25
25
  payload: mongoose.Schema.Types.Mixed,
26
26
  timestamp: String,
27
27
  createdAt: { type: Date, default: Date.now }
@@ -202,7 +202,7 @@ class MongoStorage {
202
202
  is_group: isGroup,
203
203
  is_media: isMedia,
204
204
  is_interactive: messageData.isInteractive || false,
205
- interaction_type: messageData.interactionType || null,
205
+ interactive_type: messageData.interactionType || null,
206
206
  interactive_data: messageData.interactiveData || null,
207
207
  group_id: isGroup ? normalizedNumero : null,
208
208
  reply_id: messageData.reply_id || messageData.replyId || null,
@@ -214,24 +214,6 @@ class MongoStorage {
214
214
  };
215
215
  }
216
216
 
217
- async saveInteractive(interactionData) {
218
- try {
219
- const interaction = new this.schemas.Interaction({
220
- messageId: interactionData.messageId,
221
- numero: interactionData.from,
222
- interaction_type: interactionData.type, // 'button', 'list', 'flow'
223
- payload: interactionData.payload,
224
- timestamp: this.formatTimestamp(interactionData.timestamp)
225
- });
226
-
227
- await interaction.save();
228
- return interaction;
229
- } catch (error) {
230
- console.error('Error saving interaction:', error);
231
- throw error;
232
- }
233
- }
234
-
235
217
  async getMessages(numero, limit = 50) {
236
218
  try {
237
219
  return await this.schemas.Message
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@peopl-health/nexus",
3
- "version": "2.0.6",
3
+ "version": "2.0.7",
4
4
  "description": "Core messaging and assistant library for WhatsApp communication platforms",
5
5
  "keywords": [
6
6
  "whatsapp",