AI node lets you describe what you want to do with your data in plain English. Under the hood it sends your prompt — along with the upstream data — to a large language model powered by Groq, then structures the response into named output fields that subsequent nodes can reference. This guide walks you through building a complete workflow that reads a CSV of customers, uses an AI node to identify top raters, and sends each of them a personalized coupon email.
Prerequisites
Before you begin, make sure you have the following:Access Token
Obtained by calling
POST /api/auth/login. Pass it as Authorization: Bearer <accessToken> on every request.Upload ID
An
uploadId returned after uploading your CSV file. Follow the Upload Data guide if you haven’t done this yet.The
AI node requires a Groq API key to be configured on the Flowmatic server. If you are self-hosting, consult the self-hosting setup guide to configure the required Groq API key before starting the server. If you are using Flowmatic Cloud, this is handled for you automatically.Understanding the AI node
TheAI node accepts two main configuration fields:
prompt— A free-form natural language instruction. You can embed template expressions like{{ds.rows}}directly inside the prompt string to inject upstream data at runtime.output— An array of named output field definitions. Each entry specifies aname(the key you’ll reference downstream) and atype("string","array","number", or"boolean"). The LLM is instructed to return a JSON object conforming to this schema.
output becomes available as {{nodeId.fieldName}} in downstream nodes. For a node with id: "ai" and an output field named customers, you’d reference the result as {{ai.customers}}.
How template variables work in this workflow
The graph in this guide uses four nodes connected in sequence:
Inside the
OUTPUT node’s forEach loop, {{item.fieldName}} refers to a single element of the array being iterated — so {{item.email}} and {{item.name}} resolve to the email and name of whichever customer is being processed in the current iteration.
Building the workflow
1
Authenticate and obtain your access token
If you don’t already have an access token, log in with your Flowmatic credentials:The response contains both an Store the
accessToken (short-lived) and a refreshToken (long-lived):accessToken in an environment variable for convenience:2
Upload your CSV data
Upload the customer CSV that the workflow will process. If you’ve already done this, skip ahead and use your existing You’ll receive an Your CSV should include at least
uploadId.uploadId in return:name, email, and rating columns:3
Create the workflow
With your A successful response returns HTTP Save the workflow
uploadId in hand, submit the full workflow definition. Replace <your-upload-id> with the actual value from the previous step.201 with the full workflow object, including a generated id:id — you’ll need it to trigger a run.4
Run the workflow
Trigger an execution by posting to the run endpoint:The API responds with HTTP The run is now queued. See the Run & Monitor guide for instructions on polling for completion and inspecting per-node output.
202 and a run identifier:Understanding the full JSON body
Here is the complete workflow definition for reference, with annotations explaining each node’s role:t(TRIGGER) — The entry point of every Flowmatic workflow. It has no configuration and simply starts the execution chain.ds(DATA_SOURCE) — Fetches the uploaded CSV and exposes all rows as{{ds.rows}}, an array of objects where each key corresponds to a CSV column header.ai(AI) — Receives the rows via the prompt template, instructs the LLM to select customers with a rating above 4 and compose a coupon message. It returns two structured fields:customers(an array of matching customer objects) andmessageBody(a string with the promotional copy).out(OUTPUT) — Iterates over{{ai.customers}}and sends one email per entry. Theto,subject, andbodyfields each use{{item.*}}to personalize each email with data from the current row.