Smart action to send request to 3rd party server

I wonder if it’s possible to make an async call to 3rd party server? The idea is to trigger some action on 3rd party server, get result and show in Forest Admin. I assume the only place for that is adding into route. If that’s correct, how to make an async call inside route?

Hey @Zuren, and welcome to our community :wave:

It is possible indeed.

router.post('/actions/my-awesome-smart-action', permissionMiddlewareCreator.smartAction(), async (request, response) => {
     ...
     const responseOfThirdParty = await callThirdParty(...);
     ...
     response.send({ success: 'Success!' });
});

Should work as expected in your case.
If you encounter any issue while implementing this, don’t hesitate to share a bit of code.

Let me know if that helps :pray:

Awesome, thanks for great support!

1 Like