Request on React App with FreshWorks Servers and client

Hi FreshWorks community.

I’m developing an app witch calls to an API of our company (secured). The API is allowed to recive requests from the FreshDesk servers and client calls within our company network.

The think is that, I’d like to try a request from the client side and, if that fails, try it though FreshWorks servers. I’ve encountered a problem on this. When I use the $request functions and I have axios imported, it does an axios request. When it’s not imported it gives me a “ReferenceError: $request is not defined at …” error.

Any idea on how can I do it?

Thanks

Hi Manuel, $request.* methods are available only from serverless functions. One way to implement what you want is:

  1. Try sending request from frontend using client.request.* methods
  2. If it fails, trigger a serverless function from the frontend using SMI. The SMI function can call the $request.* methods sending out the request in turn.

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.