A simplified workflow of ETM message delivery
2.1.1. Receive message
Due to the limitation of Telegram Bot API , each message can only be retrieved once. There are no way to request for past messages. Therefore, in some cases, ETM might not even know if a message came, despite the user may see the message has been “successfully sent”.
2.1.2. Verify and transform message
In the case that ETM has to reject message, it can only inform the user by replying the user with a new message informing the failure of delivery. (see 2.2.3 for failure case)
2.1.3. Send message to slave channel
The message might not be delivered due to multiple reasons, probably due to rejection of middleware, slave channel, or failure of delivery to the remote IM . When ETM detects such exception, it will try to inform the user via a reply. (see 2.2.3 for failure case)
2.2.1. Deliver message to ETM
As this portion should be taken care by the framework, middlewares and slave channels, ETM would not, and should not be aware of any missing messages.
This is just listed here for completeness.
2.2.2. Verify and transform
Usually when an unsupported message is received by ETM , it would be delivered in the fallback form (text message) to the user. Thus there should not be any error occuring on this stage.
2.2.3. Sending message to Telegram (incl. any error messages)
This is another crucial scenario in the entire message process. It is (almost) the only way that ETM can pass information to the user. However, ETM cannot do much on this situation other than just retry.
Retry for a fixed number of times This would not work in some cases. As in the case of internet disruption, all of the consecutive requests would fail until giving up, leading to a misdelivery.
Retry indefinitely This would work in some cases. However, some users have reported that the same message was flooded to him when “retry indefinitely” strategy is used. This is potentially caused by incomplete response from the server, which has resulted in a detection of failure, despite the message is successfully sent to the server. Furthermore, there is no API from Telegram that can allow a bot to double-check if a previous message is successfully sent.
In general, the main problem of message delivery for a master channel rely on Telegram Bot API is that:
Client is not informed when ETM has difficulty retrieve message from Telegram
Lack of idempotent method of message re-delivery compare to generic IM implementations