Skip to content

Commit

Permalink
Added message status to the messaging-history.set
Browse files Browse the repository at this point in the history
  • Loading branch information
PauloAK committed Apr 18, 2024
1 parent 8caf3a0 commit bb974e1
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions src/api/models/message.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ export class MessageRaw {
source_reply_id?: string;
chatwoot?: ChatwootMessage;
contextInfo?: any;
status?: wa.StatusMessage | any;
}

type MessageRawBoolean<T> = {
Expand Down
10 changes: 10 additions & 0 deletions src/api/services/whatsapp/whatsapp.baileys.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -976,6 +976,15 @@ export class BaileysStartupService extends WAStartupService {
continue;
}

const status: Record<number, wa.StatusMessage> = {
0: 'ERROR',
1: 'PENDING',
2: 'SERVER_ACK',
3: 'DELIVERY_ACK',
4: 'READ',
5: 'PLAYED',
};

messagesRaw.push({
key: m.key,
pushName: m.pushName || m.key.remoteJid.split('@')[0],
Expand All @@ -984,6 +993,7 @@ export class BaileysStartupService extends WAStartupService {
messageType: getContentType(m.message),
messageTimestamp: m.messageTimestamp as number,
owner: this.instance.name,
status: m.status ? status[m.status] : null,
});
}

Expand Down

0 comments on commit bb974e1

Please sign in to comment.