You should have four flow variables :
peopleAmount (string type) peopleAction (string type) imageStyle (string type) outputUrls (array type)
After creating your prompt (which saves the answers to the first three variables), add this code to the next node to get the urls of the images. They will be stored to outputUrls.
Make sure to replace YOUR_OPENAPI_KEY with your openai api key.
const endpoint = 'https://api.openai.com/v1/images/generations'
const inputData = JSON.stringify({
prompt: `There are ${workflow.peopleAmount} people. They are ${workflow.peopleAction}. ${workflow.imageStyle}`,
n: 2,
size: '1024x1024'
})
const config = {
method: 'post',
url: 'https://api.openai.com/v1/images/generations',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer YOUR_OPENAPI_KEY'
},
data: inputData,
withCredentials: false
}
const result = await axios(config)
const { data } = result
workflow.outputUrls = data.data
after the code block, you can add a content element, selecting carousel as the type.
Your carousel should have two cards, with the "Image" fields set to : {{workflow.outputUrls[0].url}} (for the first) {{workflow.outputUrls[1].url}} (for the second)
That's it!