Periodically call an API/Action

I know this sounds odd but I want to call an API every 2 days as I don’t want to overwhelm my server if many people make requests. There is no hook I can use for this use case. I want to call API → store manipulated response accessible to the bot (maybe using ghost?) → After 2 days, API is called and data is updated. The response is that I want to save are 2 arrays of strings or I could also save the text output (console.log). Would appreciate assistance.

Hi @sentientAI,

Indeed there is no built-in to do that…

One option could be to use the ghost (store in the bot) to store the last date you updated the api file.

Then you can check the saved date and the current date to check if it’s been more than 2 days. The good point is that you can shutdown botpress, relaunch it and it will still works. The bad ones is that you have to read the ghost quite often.

I don’t have another solution in mind but this can be a fix.

Hope it helps,
Have a good day and happy building :robot: