Call API Runtime in ACS | Community
Skip to main content
aurélienh561651
November 5, 2020
Question

Call API Runtime in ACS

  • November 5, 2020
  • 1 reply
  • 1059 views

Hi,

 

I am trying to create an API in Runtime, and call it in ACS.

Javascript action's is :

function main(params) { for (var i=0; i < params.count; i++) { return new Promise (function (resolve, reject) { var resp = { statusCode: 200, headers: { 'Content-Type': 'application/json' }, body: {msg: 'Hello' + params.firstname} }; resolve(resp); }); } }

 

In ACS, I have a workflow and I target 10 contacts.

For theses contacts,  I would like call my API, and recover "Hello <firstname>" as result.

 

 

This workflow fail, and I got the error below (but no more details....) :

 

What is wrong ? Can you help me on this subject ?

 

Thank you,

Regards,

Aurélien

 

 

 

 

 

 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

1 reply

Level 2
November 5, 2020

Hard to tell what your end result is meant to be, but you can't "return" multiple times in a single function. If you're wanting 10 responses of "Hello <firstName>", you'll need to call the function 10 times.

Also, if your action is a web action and is invoked by a web service, the params object contains a lot more information than just the parameters you're passing into the function.