External APIs in scripting
Use scripting to call external APIs and fetch data from other sources.
Scripting runtime uses a node-fetch package on the back end to provide this functionality. The fetch method exposed to scripts has the same API as defined in the node-fetch package. Refer to the node-fetch API documentation for more details.
You can use the fetch method directly in your scripts without explicitly importing node-fetch module.
const response = await fetch('https://github.com/');
const body = await response.text();
console.log(body);
Note:
- External API calls have a timeout of 4.5 seconds. Calls to complete are aborted if they exceed that time.
- You cannot add secrets inline. For secret management, please contact Alida Technical Support.
- Scripting runtime automatically adds an 'Alida Script Runner' user-agent request header to all external API calls.