[.Net SDK, Question] Send message after inactivity
Bot Info
- SDK Platform: .NET
- Active Channels: Web Chat
- Deployment Environment: Azure Bot Service
Issue Description
Send message after X second of inactivity of user.
I want to send a message "I'm still here" to the user when he is inactive (don't sends message) in 60 seconds. I tried with the proactive messages but I could not set a timer that restarts (or stop) when user sends a message.
Any idea?
Thanks in advance.
Looking into this for you.
Any update on this. Does anyone have the solution for it. if so could you please post it.
@Kothakapu I have a solution. I don't think it's the best approach possible but until now is the only one that works for me.
I have a logfile with all the user messages sent to the bot. In each one I have a 'timestamp'. In the beginning of the Dialog I start a proactive message process that every 5 seconds checks the logfile and compares the last message time with actual date. If the difference of seconds between the 2 dates is grater than 60 the proactive message is sent to the user, otherwise the thread sleeps 5 seconds, and checks again.
@JasonSowers I'm still having an issue with this. If the user sends a message to the chatbot in the moment that the chat is sending the proactive message, the user receives the message "Sorry, my bot code is having an issue". This happens probably because the user is sending a message to my main Dialog but the proactive message starts a new Dialog (since I have to receive an answer to the proactive message I send). Is there anyway to avoid this?
Thanks in advance.
@luisnatividade were you able to resolve this, or did you still need help? Many people solve the timer issue by using another application/api that hosts the timer for the bot.
@luisnatividade , I tried to use this library https://github.com/User1m/botbuilder-timeout but it has an issue which I fighting to get resolved. The fix provided isnt working. I would try it once. Issue:-
https://github.com/Microsoft/BotBuilder/issues/4608#event-1637804723