Import architect flow via API

Hello,

I want to import an inbound flow in architect and I would like to ask if there is a way to do it through API or HTTP.

The flow file extension is i3InboundFlow and when I am trying to do a post request, I receive "415 Unsupported Media Type".
Also, the content of the file is a huge string of random letters. Could you please explain what is this?

Thank you.

You cannot import flows via API like you can via the Architect UI. I'd recommend using the purecloud-flow-scripting-api-sdk-javascript to build your flows programmatically or Archy. Archy is specifically made for importing flows. It's currently in beta, so you'll need to open a case with Genesys Cloud Care to request access.

What about the format of the file?
Is it encrypted? Is there any way to convert this type of file to a json?

Modifying the architect flow file directly is not supported. Tim Smith provided the correct answer.

Thank you for your answer.
I am trying to download Archy but the documentation says : "you must be in the Archy Beta to get a download link".
How can I have access to Archy Beta?

You'll need to open a case with Genesys Cloud Care to request access.

@igkouv - I've done some work in the past with Architect flow import/export automation. I can tell you that it's definitely possible to build tooling to import/export flows via API, but it's quite a bit of work.

The i3InboundFlow file is a Base64 and URL-encoded representation of the flow in JSON format. You can convert the file to the raw JSON with the following pseudocode:

JSON = UrlDecode(Base64Decode(i3InboundFlowContent))

You can also call the latestconfiguration Architect API to retrieve the raw JSON representation for a given flow: https://developer.mypurecloud.com/api/rest/v2/architect/#get-api-v2-flows--flowId--latestconfiguration.

As for importing a flow using the API, again it's possible but quite a bit of work.

At a high level you need to call the following Architect APIs in order:

  1. Unlock Flow - https://developer.mypurecloud.com/api/rest/v2/architect/#post-api-v2-flows-actions-unlock
  2. Checkout Flow - https://developer.mypurecloud.com/api/rest/v2/architect/#post-api-v2-flows-actions-checkout
  3. Create Flow Version - https://developer.mypurecloud.com/api/rest/v2/architect/#post-api-v2-flows--flowId--versions

Actually validating the flow and publishing a new version is possible via the API as well, but quite complex because the calls are essentially asynchronous and require subscriptions.

You can follow along by looking at the HTTP interactions in your browser when importing a flow in the Architect Console - it's calling the same APIs.

1 Like

Hi @Jesse_Doyle,

We want to create a premium app wizard which, among other things, would create a flow using a template flow we have on our end. If we use the "latestconfiguration" API method to get the JSON representation of our template, can we use that JSON to create a new flow using an API call? Is there an API method supporting this?

Thank you,
Nikos

Hi @ngiannopoulos, yes I'm quite certain that's possible. I haven't tried it, but you'd have to programmatically create a new flow via the API first.

I'd imagine this is the API call you're looking for: https://developer.mypurecloud.com/api/rest/v2/architect/#post-api-v2-flows.

With your new flow, you can take the JSON from the latestconfiguration call and pass it to the "Create Flow Version" API call for your newly created flow: https://developer.mypurecloud.com/api/rest/v2/architect/#post-api-v2-flows--flowId--versions.

You'll likely need to do some work to replace any "hardcoded" IDs and resources in the JSON data. I believe the flow JSON object contains a manifest property that defines any of the flow's hard dependencies.

Hello @Jesse_Doyle,

I have tried the above step for creating and configuring a new flow.
But at the last step when I create a new flow version, although the response is 200 OK, if I try to open the flow from the architect inbound call flow menu, it does not seem to work. However when I am trying to get the latest configuration for this flow, I get the correct json body.
Could you please tell me why I can not open the flow from the UI at PureCloud?
I have tried to implement this (create new flow version) using both code and the api explorer from the developer tools and after to open it, but neither works.

Thank you

I'm not certain, but I've "broken" flows in the past so that they only show as "Loading" in the Architect console. If this is what you're running into, then it's likely that the JSON configuration has an error in it. Try taking a look at your browser's JS console when the error is occurring - you'll probably see a console error that explains the issue.

Is there a way to clone a Flow using the JAVA sdk?
Here what I have done:

  1. Get the flow by id
  2. Call create flow endpoint.

The result:
The flow was created, but not configured. Is there a way to be configured ?

Thank you.

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