Update typebot.service.ts

This commit is contained in:
Luis-Fernando 2024-03-28 22:01:45 -03:00 committed by GitHub
parent 893e290b15
commit efd98643c3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -271,6 +271,7 @@ export class TypebotService {
private getTypeMessage(msg: any) {
this.logger.verbose('get type message');
const types = {
messageType: 'UNKNOWN',
conversation: msg.conversation,
extendedTextMessage: msg.extendedTextMessage?.text,
audioMessage: msg.audioMessage?.url,
@ -282,15 +283,14 @@ export class TypebotService {
viewOnceMessageV2: msg.viewOnceMessageV2?.message?.imageMessage?.url,
listResponseMessage: msg.listResponseMessage?.singleSelectReply?.selectedRowId,
responseRowId: msg.listResponseMessage?.singleSelectReply?.selectedRowId,
UNKNOWN: 'unknown',
};
types['messageType'] = Object.keys(types).find((key) => types[key] !== undefined) || 'UNKNOWN';
types.messageType = Object.keys(types).find((key) => types[key] !== undefined) || 'UNKNOWN';
this.logger.verbose('type message: ' + JSON.stringify(types));
return types;
}
private getMessageContent(types: any) {
this.logger.verbose('get message content');
const typeKey = Object.keys(types).find((key) => types[key] !== undefined);