Architect Scripting API

Using the purecloud-flow-scripting-api-sdk-javascript is it possible to update an already existing flow with a new action (Call Data Action to be exact) script or will it error out stating that name already exist ?

Thank you in advance.

EDIT: After reviewing, you probably don't need to delete the Call Data task and create a new one to insert... try using the setDataActionByIdAsync method to simply set a different Data Action on the existing Call Data Action task (once you locate it in your script). You'll still need to save and re-use the same variable references, assuming your new action has the same inputs and outputs.

Hi Jeremy, it should be - see the documentation here:

https://mypurecloud.github.io/purecloud-flow-scripting-api-sdk-javascript/ArchActionCallData.html#setDataActionByIdAsync

I'm not too experienced with this library but worked with it a bit. If you're updating an existing flow, import it first with this method:

https://mypurecloud.github.io/purecloud-flow-scripting-api-sdk-javascript/ArchFlowInboundCall.html#importFromFileAsync

Your application would need to iterate the array of Tasks:

https://mypurecloud.github.io/purecloud-flow-scripting-api-sdk-javascript/ArchFlowInboundCall.html#tasksReusable

And iterate through its actions:

https://mypurecloud.github.io/purecloud-flow-scripting-api-sdk-javascript/ArchTask.html#actions

To find the proper Call Data action to delete and replace:

https://mypurecloud.github.io/purecloud-flow-scripting-api-sdk-javascript/ArchActionCallData.html

And then wire in the new Action at the appropriate location:

https://mypurecloud.github.io/purecloud-flow-scripting-api-sdk-javascript/ArchFactoryActions.html#addActionCallData

If you're using the same input and output variables, you'll need to save their ids from the original action before you delete it (you will need them to create the new Call Data action).

Just one thing to add. To simplify the checkout you can also use

https://mypurecloud.github.io/purecloud-flow-scripting-api-sdk-javascript/ArchFactoryFlows.html#checkoutAndLoadFlowByFlowNameAsync

1 Like

Thank you both i will start their. Starting to explore the API Scripter more.

1 Like

This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.