How to Set time to make third party API call in serverless

Hi,

We have a requirement which is integration between Freshdesk and third party. Here the third party API has some limitation which is at least minimum 5secs gap is required between each API calls.

Currently we have implemented this third party API call in OnTicketUpdate event. So the OnTicketUpdate event is triggered simultaneously for multiple tickets. Is there any option to set time for the API call in serverless?

Kindly help us if there is any option to handle this situation.

Thanks!

1 Like

Hi @Priya_Dharshini, you can use Scheduled Events to create one-off functions. So, instead of triggering the API calls in the onTicketUpdate event, you schedule them instead.

Optionally, use K/V storage to keep track of scheduled events.

2 Likes

Another way probably you can explore is by using an npm package that works along for delay.

For example, if you use superagent npm package to make requests, you can use superagent-retry-delay to set delays.

1 Like

Thanks for the approach!

We will try with the approaches.