You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
LINE reply token is not guaranteed to work beyond 1 minute after the webhook event is received (Official doc).
Currently when a query takes more than 58 seconds to finish, the bot will reply with "Line bot is busy, or we cannot handle this message." error.
This timeout mechanism is implemented in singleUserHandler. When a webhook event takes more than REPLY_TIMEOUT to finish, it will consume the reply token to send the reply above and flip a toggle isRepliedDueToTimeout to stop future send() calls to send reply again. This is
However, as we starts to support multiple multimedia messages, it is easy for a query to be minutes long, due to the fact that we need to transcribe it first.
To-be
We would like to support a new reply token management mechanism that would tell the user about the current status, and use quick reply to collect new reply tokens.
Technical-wise, we will modify singleUserHandler to remove the existing isRepliedDueToTimeout flag. Instead, we will do the following for UX#2 timeout management:
Store latest reply token and its received time in context
Just before the 1 minute timeout, we send the message with quick reply to collect reply token. This "message with token-collecting quick reply" can be wrapped as a utility function sendReplyTokenCollector(ctx: Context, message: string). It consumes the current reply token (which will be outdated very soon) and hope that the user would click the quick reply, which provides us a new reply token.
If the token has already been outdated (maybe because the user did not click the last quick reply), this method does nothing. User may still click the latest quick reply in this case.
In send() we consume reply token in context if the reply token does not timeout.
Otherwise, we use push message to push the reply to the user.
Then for UX#1 and UX#3, we pass sendReplyTokenCollector to handler function so that they can call the method before a long query call (UX#1). sendReplyTokenCollector can be called multiple times as a method to report current status to the user (UX#3).
The text was updated successfully, but these errors were encountered:
From 20240701 meeting note
As-is
LINE reply token is not guaranteed to work beyond 1 minute after the webhook event is received (Official doc).
Currently when a query takes more than 58 seconds to finish, the bot will reply with "Line bot is busy, or we cannot handle this message." error.
This timeout mechanism is implemented in
singleUserHandler
. When a webhook event takes more thanREPLY_TIMEOUT
to finish, it will consume the reply token to send the reply above and flip a toggleisRepliedDueToTimeout
to stop futuresend()
calls to send reply again. This isHowever, as we starts to support multiple multimedia messages, it is easy for a query to be minutes long, due to the fact that we need to transcribe it first.
To-be
We would like to support a new reply token management mechanism that would tell the user about the current status, and use quick reply to collect new reply tokens.
The UX would be something like this (Figma):
Technical-wise, we will modify
singleUserHandler
to remove the existingisRepliedDueToTimeout
flag. Instead, we will do the following for UX#2 timeout management:sendReplyTokenCollector(ctx: Context, message: string)
. It consumes the current reply token (which will be outdated very soon) and hope that the user would click the quick reply, which provides us a new reply token.send()
we consume reply token in context if the reply token does not timeout.Then for UX#1 and UX#3, we pass
sendReplyTokenCollector
to handler function so that they can call the method before a long query call (UX#1).sendReplyTokenCollector
can be called multiple times as a method to report current status to the user (UX#3).The text was updated successfully, but these errors were encountered: