fix: typebot's wait now pauses the flow and composing is defined by the delay_message parameter in set typebot

This commit is contained in:
Davidson Gomes 2024-02-16 10:31:15 -03:00
parent b095c9dfb9
commit 3a37fd9d32
2 changed files with 18 additions and 7 deletions

View File

@ -8,6 +8,7 @@
* Read messages from whatsapp in chatwoot
* Add support to use use redis in cacheservice
* Add support for labels
* Command to clearcache from chatwoot inbox
### Fixed
@ -32,6 +33,11 @@
* Fix looping when deleting a message in chatwoot
* When receiving a file from whatsapp, use the original filename in chatwoot if possible
* Correction in the sendList Function
* Implement contact upsert in messaging-history.set
* Improve proxy error handling
* Refactor fetching participants for group in WhatsApp service
* Fixed problem where the typebot final keyword did not work
* Typebot's wait now pauses the flow and composing is defined by the delay_message parameter in set typebot
# 1.6.1 (2023-12-22 11:43)

View File

@ -450,8 +450,6 @@ export class TypebotService {
async function processMessages(instance, messages, input, clientSideActions, eventEmitter, applyFormatting) {
for (const message of messages) {
const wait = findItemAndGetSecondsToWait(clientSideActions, message.id);
if (message.type === 'text') {
let formattedText = '';
@ -467,7 +465,7 @@ export class TypebotService {
await instance.textMessage({
number: remoteJid.split('@')[0],
options: {
delay: wait ? wait * 1000 : instance.localTypebot.delay_message || 1000,
delay: instance.localTypebot.delay_message || 1000,
presence: 'composing',
},
textMessage: {
@ -480,7 +478,7 @@ export class TypebotService {
await instance.mediaMessage({
number: remoteJid.split('@')[0],
options: {
delay: wait ? wait * 1000 : instance.localTypebot.delay_message || 1000,
delay: instance.localTypebot.delay_message || 1000,
presence: 'composing',
},
mediaMessage: {
@ -494,7 +492,7 @@ export class TypebotService {
await instance.mediaMessage({
number: remoteJid.split('@')[0],
options: {
delay: wait ? wait * 1000 : instance.localTypebot.delay_message || 1000,
delay: instance.localTypebot.delay_message || 1000,
presence: 'composing',
},
mediaMessage: {
@ -508,7 +506,7 @@ export class TypebotService {
await instance.audioWhatsapp({
number: remoteJid.split('@')[0],
options: {
delay: wait ? wait * 1000 : instance.localTypebot.delay_message || 1000,
delay: instance.localTypebot.delay_message || 1000,
presence: 'recording',
encoding: true,
},
@ -517,6 +515,13 @@ export class TypebotService {
},
});
}
const wait = findItemAndGetSecondsToWait(clientSideActions, message.id);
console.log('wait', wait);
if (wait) {
await new Promise((resolve) => setTimeout(resolve, wait * 1000));
}
}
if (input) {
@ -534,7 +539,7 @@ export class TypebotService {
await instance.textMessage({
number: remoteJid.split('@')[0],
options: {
delay: 1200,
delay: instance.localTypebot.delay_message || 1000,
presence: 'composing',
},
textMessage: {