How to map data from external API

Hello Team,

So I am working on my database where I need to call extrenal API and get contact enrichment I was able to connect to the extrnal API and was able to receive a code:200 but now the issue is I cant map it back to my database as the HTTP Module is not shown in the next modules how can this be fixed ?

Here is the attached

Hello Team,

So I figured out the issue, I had to run the Python script to fix the issue but how ever I am able to receive the data in my python script but I am not able to print it any help here would be appreciated.

Hey,

when you assign variables with Python in the Run Script action, they automatically become output parameters! For example, if your script does:

import httpx
url = 'https://api.exchangerate-api.com/v4/latest/USD'
r = httpx.get(url)
data = r.json()

You’ll see both ‘url’ and ‘data’ values in the Run Script action’s output:

The print() function doesn’t return values though, so you won’t see those in run history.

Run script action docs: Run Script | Bika.ai

Hello Kelvin,

I am able to get the output from the script that I am running but the ouput is not delimated as json output which is not mapable in the next stage what is the solution to this issue ?

This is the code:
import httpx
import json

Define the endpoint and parameters

linkedin_url = “<%= _triggers.trg7rsIZEEtorEwbneVEetIF.record.cells.flds8yb94LbJnAeb9NcUDaZ3.value %>”
api_url = “https://contacts.muraena.ai/api/client_api/reveal/
params = {
“linkedin_url”: linkedin_url
}

Set headers

headers = {
“Authorization”: “Token xxxxxx”,
“Accept”: “application/json”
}

response = httpx.get(api_url, headers=headers, params=params)
data = response.json()

Here is the output:

Let me know how this issue can be resolved.

Best,

Hi Burhan,
Hmm, not sure I fully get what you mean by “not delimited as JSON output” – the screenshot shows your Run Script output is already a JSON object, and the HTTP response looks properly formatted too.

Maybe check how you’re accessing the data in the next step? Here’s a quick demo of using script output values downstream:

insert-variable

Hope this helps!

Hello Kelvin,

I have done exactly the same but cant see the data here is the screenshot. This is the main issue.

Could you head back to the Run Script Action editor and click “Run Test” again? Wait for the HTTP response to show up, then close that editor. Now reopen your Update Record editor and check if the data variable pops up in the variable picker?

The variable list automatically updates based on the latest “Run Test” results from each action, so sometimes we gotta give it another click when stuff changes. Let me know if that works!

Hello Kelvin,

Yes by runing the test run it worked and data is populated, I was actually running the whole automation again even for testing. Anyhow thankyou so much for your support but I need it again as I am stuck in the next step now to map the data with the record.

So the current senario is Trigger > Script > update record. When the automation reaches update record it actually just pulls the current data in the row and wont update the data pulled from the script command. Need your support to map the data correctly unique identifier will be the linkedin link. Here is the screenshot in how I have set it up.

Your support is much appreciated.

Best,

From your “Update Record Action” setup, it looks like it’s only updating the first record in your “Canada Sales Contact” database.

I think you want to use the LinkedIn link to find and update the specific record where linkedin_link matches the one from your Script/Trigger, right?

Quick fix: Add a “Get Record” action before the “Update Record” step. Set its filter to {Canada_Sales_Contact.linkedin_link} = {Script.linkedin_link}. Then in your “Update Record” action, use the Record ID from this “Get Record” output as the target record. Just make sure only one record matches that LinkedIn link, otherwise the automation might get stuck.

This post has a similar setup example: Cant remove header from the list I have! - #8 by Kelvin

Hello Kelvin,

I tried this and it still wont work here is the screenshot

I request connecting with you and fix this issue as its more than a week now I am stuck at this stage appreciate your help but please let us finalize this ASAP.

really sorry you’re still stuck on this! :pray: Since this comunity is meant for sharing knowledge, I can’t offer one-on-one connection here.
Could you help me help you faster? If you could record a quick video (maybe using something like Vimeo) showing your screen while walking me through the error - especially the Run History results and your Find Record Action configuration - that’d be super helpful. The more details you can share, the better chance we have to figure this out together!