unicef / iogt

BSD 2-Clause "Simplified" License
25 stars 35 forks source link

Chatbot: reload after sending message #1088

Open geoo89 opened 2 years ago

geoo89 commented 2 years ago

Currently, after sending a message to the chatbot, the page does not reload with responses from the bot. This can be confusing.

See https://github.com/unicef/iogt/issues/288#issuecomment-880873435 for some concrete long-term solutions.

Is the following hacky solution feasible: After the user has sent a message, delay the request response: Ideally check whether we have received a response from RapidPro, and respond if a message has come in, or after 5 seconds in total, whichever is earlier. (Our average load time is ~1.5 seconds, so this isn't that much worse.) The response could consist of multiple parts, so a variation could be to wait until 1 second after the last RapidPro response (still 5 sec max).

We could supplement this with a "Check for responses" button that refreshes the page, as a backup

cbunicef commented 2 years ago

RapidPro response times are typically VERY fast, you can see the true speed by setting up a Telegram channel in an example workspace as other messaging platforms delay the messages.

Even while the system is doing massive amounts of other work (eg sending millions of queued messages) the interactive elements are prioritized.