Hello,
I’ve problem while setting up multiple calls in one Communications tab.
The idea behind this custom module:
- Fetch the Leads from the URL 1 ,
- Store and Pass the lead id from URL 1 into the URL 2 as path variable
- Pass the temp data in the output of the URL.
How it should work:
- The first call to get an array of leads. This response’s {{body}} is an array, so I iterate on it, to get the fields.
=> This works, when I change the “temp” to “output” - The second call is to the visits’ URL’s. We need to pass one by one lead id in the url of the second and push to its response {{body}}.
=> This doesn’t work. The temp.leadId is empty (undefined), even though I can see it when I don’t use the second call.
Below I have two URLs :
[
{
// Request to API endpoint.
“url”: “/accounts/{{parameters.accountId}}/custom-feeds/{{parameters.customFeed}}/leads”, // Relative to base URL
“method”: “GET”,
“headers”: { },
“qs”: {
“start_date”: “{{parameters.startDate}}”,
“end_date”: “{{parameters.endDate}}”
},
// Response handling
"response": {
"iterate": "{{body.data}}",
"temp": {
"leadId": "{{item.id}}",
"attributes": "{{item.attributes}}"
}
}
},
{
"url": "/accounts/{{parameters.accountId}}/leads/{{temp.leadId}}/visits",
"method": "GET",
"headers": { },
"qs": {
"start_date": "{{parameters.startDate}}",
"end_date": "{{parameters.endDate}}"
},
// Response handling
"response": {
"output":{
"Lead Id": "{{temp.leadId}}",
"Lead Attributes": "{{temp.attributes}}",
"Visit Attributes": "{{body.data.attributes}}",
"Page Views": "{{body.data.attributes.visit_route}}",
"Locations": "{{body.included}}"
},
"limit": "{{parameters.limit}}" // Limits number of output bundles as requested by user (even if API returns more items).
}
}
]
Hope you’ll guide me to resolve this issue?