My skill uses various API endpoints. The response of such an endpoint includes a user_id
. There is another endpoint which retrieves user detail by user_id
.
My intention is to fetch the the user detail by calling the corresponding endpoint inside a loop.
const result = await custom.get_email_clicks(emailId);
for(let i = 0; i < result.data.records.length; i++){
const r = records[i];
const user_id = r.data.user_id;
// here I want to call the other API which gets me user detail.
const user = await custom.get_user_detail(user_id);
speech+= user.data.firstName + ' ' + user.data,lastName;
}
//output all user names
this.tell(speech);
The avobe approach gives me the following error:
There was a problem with the requested skill’s response
Probably this is not the right way to accomplish what I am trying to. Please let me know if there is a way to achieve the same.