Skip to main content

Using Tables in Flows

FlowStack Tables integrate directly with both automation engines, allowing you to read, write, update, and delete data from within your workflows.

Flow Builder (Tables Piece)​

The Tables piece provides these actions:

Insert Row​

Add a new row to a table:

  1. Add action: Tables → Insert Row
  2. Select the target table
  3. Map values for each column from previous steps
Table: Orders
Columns:
- orderId: {{trigger.body.orderId}}
- customer: {{trigger.body.customerName}}
- amount: {{trigger.body.total}}
- status: "New"

Update Row​

Update an existing row by ID:

  1. Add action: Tables → Update Row
  2. Select the table and specify the row ID
  3. Set the columns to update
Table: Orders
Row ID: {{steps.findOrder.output.id}}
Update:
- status: "Shipped"
- shippedAt: {{now}}

Search Rows​

Query rows with filters:

  1. Add action: Tables → Search Rows
  2. Select the table
  3. Add filter conditions
  4. Set sort order and limit

Returns an array of matching rows.

Delete Row​

Remove a row by ID:

  1. Add action: Tables → Delete Row
  2. Select the table
  3. Specify the row ID

Workflow Builder (HTTP Request or Code Node)​

Using HTTP Request Node​

Method: POST
URL: https://app.onflowstack.com/api/v1/tables/{{$env.TABLE_ID}}/rows
Headers:
Authorization: Bearer {{$env.FLOWSTACK_API_KEY}}
Content-Type: application/json
Body:
{
"orderId": "{{$json.orderId}}",
"customer": "{{$json.customerName}}",
"amount": {{$json.total}},
"status": "New"
}

Using Code Node​

const tableId = $env.TABLE_ID;
const apiKey = $env.FLOWSTACK_API_KEY;

// Insert a row
const response = await fetch(
`https://app.onflowstack.com/api/v1/tables/${tableId}/rows`,
{
method: 'POST',
headers: {
'Authorization': `Bearer ${apiKey}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
orderId: $json.orderId,
customer: $json.customerName,
amount: $json.total,
status: 'New',
}),
}
);

return [{ json: await response.json() }];

Common Patterns​

Deduplication​

Check if a record exists before processing:

Trigger → Tables: Search Rows (filter: email = trigger.email)
→ Branch: If rows.length > 0
→ Skip (already processed)
Else
→ Process → Tables: Insert Row

Running Counter​

Maintain a counter that increments with each run:

Trigger → Tables: Search Rows (filter: key = "daily_count")
→ Tables: Update Row (value = currentValue + 1)

Processing Queue​

Use a table as a work queue:

Schedule Trigger (every 5 min)
→ Tables: Search Rows (filter: status = "Pending", limit: 10)
→ Loop Over Items
→ Process Item
→ Tables: Update Row (status = "Completed")