Assistance Needed: Calling an API Inside a Script

Hi Team,

Can anyone assist is it possible to call an API from within a script?

Please see the attached for more information.

Thanks,
Bafana Promise Kopo

2 Likes

@Sam please help promise

1 Like

Hello @Promise_Bafana_Kopo ,
Based on my understanding, calling an external API directly from within a script node using methods like fetch or axios is not supported in Reels. The recommended approach would be:

  1. Use an API node to call your external API and retrieve the response.
  2. Map the result from that API node into the script model editor as input, and then access it in your script as IP_result.
  3. Perform any operations or transformations you need within the script.

This approach ensures that the flow remains consistent with the Reels execution model and that data is managed properly.

Also, from your screenshot, I noticed that you’re using console.log. Please note that console logs won’t appear in Reels execution. Instead, you should use IP (inputs) and OP (outputs) to connect with the model editor. This way, you can debug and validate the results more effectively.

Additionally, I’ll confirm with the seniors if there’s any way to trigger an external API call directly inside a script node, and I’ll share it with you once I find something useful.

I’ll attach the documentation for the script node for your reference — please go through it for more clarity.
Script Rule

3 Likes

Good morning @Sam Thank you so much for clarity and the steps.

2 Likes