Cross Origin error on call onExternalEvent from the portal

I created a onExternalEvent and got the external url. I need to call the event from the portal to send data to my API, I tried to do this with an ajax request but I got an CORS error.
The error:
print
In postman I can call the URL normally, in local and web version and dont get the error.

Hi @Matheus_Nunes,
You can use Request API to fix the CORS Error

Thanks

1 Like

Hi, how can I get the client object to call the client.request?

I’m not running the code in an app, the request is sent from the client portal to the app, I tried to import the fresh_client.js and get the client object like in an app but the app.initialized() don’t returns.

Can you give an example?

@Matheus_Nunes Are you trying make this request from the User-side portal in the Freshdesk or any other place?

Currently, the fresh_client.js will only work in the Agent-side portal of the Freshdesk. So is Request Method platform feature. It is in our roadmap to make Freshworks apps run in the User-side portal. We do not have a timeline on when it will be available yet.

So, to fix this issue for now, there are two options.

  1. To allow the API request from the freshdesk.com domain at the receiver server (hooks.freshworks.com)
  2. Add a proxy to pass the request so browser will not block the request

For #1, we can check if its a secure way and if we will be able to do it.
For #2, you can check if you have any option at your side.

1 Like

Thanks, it would be really great if you could check if first option is possible.

To check this option would take a long time?

Hi Matheus,

The apps are enabled for the end-user portal in Freshdesk. Check out the documentation.

The app can make an SMI call from the app, which can then use the app’s webhook URL to call the external events.

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