Automatically retry requests using Request Method

In the Freshworks app, if you happen to perform an HTTP API request using the platform feature Request Method, and you receive an error response like 429 rate-limit exception or 5xx server error, then retrying the same request after some time might help you.

Request Method supports two properties in the options parameter that help you perform the retrying request.

Properties Description
maxAttempts The maximum number of times a request will try to retrieve a response if a network or 429/5xx HTTP error occurs. The maximum permissible value for this argument is 5.
retryDelay The delay between retry requests, specified in milliseconds. The maximum permissible value for this argument is 1500 ms.

Sample code snippet:

await client.request.get("https://example.url", {
		headers: {
			Authorization: "Basic ASZXXXXX",
			"Content-Type": "application/json",
		maxAttempts: 5,
		retryDelay: 1500,

If the above request hits 429/5xx, it retries back for 5 times with a delay of 1.5 seconds.