Problem timeout webhook fb messanger

Hi, My custom action takes a long time in the response because I have a great deal of treatment in it. The problem that the Fb messenger webhook sends a post every 20 seconds until the custom action sends the response. This problem will do this :

doc fb messanger webhook

can you help me ?

Hey @wassimgt, this is an interesting problem! I urge you to think about the user experience… how does it feel to have a conversation with a bot that you ask something and it takes multiple minutes to respond, without being able to ask it anything in the meantime?

What I would recommend in this case is actually having your custom action trigger an external service that processes the information which sends an External Event when it is done. This will allow the user to continue the conversation while they’re waiting for their results, and will also avoid this facebook issue.

@erohmensing my chatbot is for stock market investors, the chatbot will ask questions about the stock market and in the custom action, I have to make a prediction on the next 30 day of market action price … this custom action will take a long time to respond to the user. my problem is in the Facebook webhook every 20s send a post

Yes, so what I recommended with external events sounds like a good solution then. When the user asks for it, the bot can trigger the calcuation and respond with something like “let me calculate that for you. this might take a few minutes…” and then send the information through an external event when it’s ready.