Open edkwchan opened 7 months ago
Root cause analysis: Could not reproduce the issue but it appears that the same webhook - the one carrying "edkwchan@hotmail.com" - was processed by the bot twice.
Apparently the bot threw an error when processing the first webhook, so the webhook controller sent out the text message "Error in the chatbot...". For reason that is not immediately clear to me, the webhook controller could not generate this message before Facebook resent the same webhook (Note: Facebook resends webhooks if the first one is not responded within 5 seconds).
When the same webhook was processed by the Bot for the second time, seemingly there was no error and the Bot generated "A confirmation code...", which was sent out by the webhook controller, resulting in the impression that the flow could continue even when an error had occurred.
Solution: Added a database table to remember which webhook notifications have been processed. From now on, the bot would not process the same webhook twice.
The image shows an error encountered (caused by a missing permission granted to the client). However confirmation code is still sent and it seems can be continued with the purchase.