How integrate with Stack AI
# 🤝help
I have use that in my execute code: "// Set these to the names of your stack-AI in/out nodes var inNode = 'in-0' var outNode = 'out-0' // Change this to your Stack-AI URL let url = '' try { const response = await url, { [inNode]: ${event.preview} }, // Be sure to set your API key as an env variable { headers: { Authorization: Bearer ${env.apiKey}, 'Content-Type': 'application/json' } } ) workflow.stackAIResponse =[outNode] } catch (e) { console.error(There was an error calling Stack-AI: ${e}) }" apprently the content of event.preview was capture. So the problem come of the transmisson of the variable inNode to the Stack Ai project but I have do all the prompts in the realm help>how_to_integrate_with_stack_ai. please help me. Image Image

I've done this by doing:
Copy code
const endpoint = "YOUR_STACK_AI_ENDPOINT_URL"

const headers = {
  Authorization: `Bearer ${stackAiapiKey}`

//save the user's question or send event.preview
const data = {
  "in-0": workflow.question,

  try {
    const response = await, data, { headers })
    workflow.apiResponse =["out-0"]
  } catch (error) {
    throw new Error(`stack-error: ${error}`)
Thank! I have test your code that not works but i have modifie that line : Authorization:
Bearer ${stackAiapiKey}
to: Authorization:
Bearer ${stackAiapiKey}
, 'Content-Type': 'application/json' and that works! else I have test once again my code and it finally work modifing that line: { [inNode]: ${event.preview} }, by that line: { "int-0": ${event.preview} },