https://discord.gg/botpress logo
Adding delay to autonomous node replies
# 🤝help
m
Hey. My bot is connected via twilio (SMS) and web. Often times, sms users send multiple messages quickly without waiting for a reply. This causes issues with out of order replies at times. I want my bot to delay sending replies to SMS messages by 20 seconds so it can handle multiple messages and respond to them together in one go. How do I do that using an autonomous node?
@prehistoric-airplane-85682 a little help please.
p
Adding a delay doesn't mean that the bot will reply once to a group of short messages sent within the interval. However, you can do so by adding this '''javascript await new Promise(resolve => setTimeout(resolve, 5000)); // Wait for 5 seconds ''' To make the bot respond only once for multiple messages, check out this thread: https://discord.com/channels/1108396290624213082/1272647969866252453
m
p
No, the code should be in an action and then the card added to the AN. you must also instruct the AN to run the action before every message.
m
Just tried it. It still replies twice if two messages are sent - with the set delay. Isn't it possible to treat the two messages as one, and then reply to both with one message?
p
I previously mentionned that the delay will only make the bot answer to the messages later not treat them as one. There are no built in solutions for that at the moment, but I did also send you a thread where someone built a bot matching your requirement.
2 Views