Punuru_BhanuPrasanth | 2023-05-17 14:51:12 UTC | #1
Is there any way to import yaml script through Architect Scripting?, I was able to import an i3Inbound format flow, but not in yaml format.
tim.smith | 2023-05-17 14:55:53 UTC | #2
Please refer to the Archy tool for yaml-based Architect configuration: https://developer.genesys.cloud/devapps/archy/
Punuru_BhanuPrasanth | 2023-05-17 15:03:30 UTC | #3
Hi Tim, so I wanted to import through Architect Scripting instead of Archy this is what i am trying to do...
function callbackFunctionStart(){ return scriptingFlowFactory.createFlowInboundCallAsync('flow name', 'Using Architect Scripting', scriptingLanguages.englishUnitedStates, (archInboundCall) => { return archInboundCall.importFromContentAsync(file, () => { return archInboundCall.publishAsync(); }); }); }
when I gave file in i3Inbound format it is working but if it is in YAML format it is throwing error.
tim.smith | 2023-05-17 15:08:25 UTC | #4
https://mypurecloud.github.io/purecloud-flow-scripting-api-sdk-javascript/ArchBaseFlow.html#importFromContentAsync documents the exportContent parameter as "the contents from a flow export"
https://mypurecloud.github.io/purecloud-flow-scripting-api-sdk-javascript/ArchBaseFlow.html#exportToObjectAsync is documented as "Exports the flow to a JSON object. The object passed back in the callback function will be a JSON object..."
The architect flow scripting SDK is explicitly documented to work with JSON, not YAML.
Punuru_BhanuPrasanth, post:3, topic:19970
but if it is in YAML format it is throwing error.
That makes sense based on the documentation since it requires JSON from a previous export operation.
Punuru_BhanuPrasanth | 2023-05-20 08:53:34 UTC | #5
Hi Tim,
So I have tried converting inbound flow from yaml format to json using "js-yaml" module but still I am getting errors But when I tried converting same inbound flow which is in i3Inbound format, to json format using below code
let json = decodeURIComponent(atob(i3Inbound))
It gave me a data in json format and when I tried to import this json data it is working
function callbackFunctionStart(){ return scriptingFlowFactory.createFlowInboundCallAsync('flowname', 'Using Architect Scripting', scriptingLanguages.englishUnitedStates, (archInboundCall) => { return archInboundCall.importFromContentAsync(json , () => { return archInboundCall.publishAsync(); }); }); }
Is there any reason why 'yaml to json' converted file is throwing errors and any way to import that file...?
tim.smith | 2023-05-22 13:23:02 UTC | #6
Punuru_BhanuPrasanth, post:5, topic:19970
Is there any reason why 'yaml to json' converted file is throwing errors and any way to import that file...?
Presumably they're not identical. Have you done a diff on the working vs. non-working files to see what's different between them? If they're identical, character for character, they should behave the same.
system | 2023-06-22 13:23:23 UTC | #7
This topic was automatically closed 31 days after the last reply. New replies are no longer allowed.
This post was migrated from the old Developer Forum.
ref: 19970