Vai al contenuto principale
POST
/
workflows
Crea un nuovo workflow
curl --request POST \
  --url https://api.altostrat.io/workflows \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '{
  "name": "Onboarding Nuovo Cliente",
  "description": "Invia un'\''email di benvenuto quando viene creato un nuovo sito.",
  "is_active": true,
  "authorization_id": "auth_01H...",
  "schedule_type": "manual",
  "nodes": [
    {
      "id": "n1",
      "type": "manual_trigger",
      "position": {
        "x": 100,
        "y": 100
      },
      "data": {
        "componentId": "manual_trigger",
        "description": "Attiva manualmente questo flusso di onboarding."
      }
    },
    {
      "id": "n2",
      "type": "webhook",
      "position": {
        "x": 400,
        "y": 100
      },
      "data": {
        "componentId": "webhook",
        "method": "POST",
        "url": "https://example.com/api/welcome",
        "body": "{\"message\": \"Benvenuto!\", \"run_id\": \"{{ n1.run_id }}\"}"
      }
    }
  ],
  "edges": [
    {
      "id": "e1-2",
      "source": "n1",
      "target": "n2"
    }
  ]
}'
{
  "id": "fl_01h3j4k5l6m7n8p9q0r1s2t3u4",
  "name": "Onboarding Cliente",
  "description": "Invia un'email di benvenuto e imposta un account.",
  "nodes": [
    {
      "id": "n1",
      "type": "manual_trigger",
      "position": {
        "x": 150,
        "y": 250
      },
      "data": {
        "componentId": "manual_trigger"
      }
    }
  ],
  "edges": [
    {
      "id": "e1-2",
      "source": "n1",
      "target": "n2",
      "sourceHandle": "true"
    }
  ],
  "schedule_type": "manual",
  "schedule_value": "0 9 * * *",
  "next_run_at": "2025-11-01T09:00:00.000000Z",
  "is_active": true,
  "webhook_url": "https://api.altostrat.io/workflows/webhooks/whsec_abc123...",
  "created_at": "2025-10-31T12:00:00.000000Z",
  "updated_at": "2025-10-31T12:30:00.000000Z"
}

Authorizations

Authorization
string
header
required

JWT standard per le sessioni utente ottenuto tramite l'autenticazione Altostrat.

Body

application/json
name
string
required

Il nome per il nuovo workflow.

Example:

"Controllo Quotidiano Integrità Rete"

authorization_id
string
required

L'ID prefissato dell'Autorizzazione (auth_...) da utilizzare per le esecuzioni di questo workflow.

Example:

"auth_01H..."

nodes
object[]
required

L'array di nodi che definiscono la logica del workflow.

Minimum length: 1
edges
object[]
required

L'array di archi che collegano i nodi del workflow.

description
string | null

Una descrizione opzionale per il workflow.

is_active
boolean
default:true

Impostare su false per creare il workflow in uno stato inattivo.

schedule_type
enum<string>
default:manual
Opzioni disponibili:
manual,
interval,
cron,
daily,
weekly,
monthly
schedule_value
string | null

Obbligatorio se schedule_type è interval o cron.

Example:

"0 4 * * *"

Response

Il workflow è stato creato con successo.

id
string

L'identificatore univoco prefissato per il workflow.

Example:

"fl_01h3j4k5l6m7n8p9q0r1s2t3u4"

name
string

Il nome leggibile del workflow.

Example:

"Onboarding Cliente"

description
string | null

Una descrizione dettagliata di ciò che fa il workflow.

Example:

"Invia un'email di benvenuto e imposta un account."

nodes
object[]

Un array di oggetti nodo che compongono il grafo del workflow. Restituito solo quando si recupera un singolo workflow.

edges
object[]

Un array di oggetti arco che collegano i nodi nel grafo del workflow. Restituito solo quando si recupera un singolo workflow.

schedule_type
enum<string> | null

Il tipo di pianificazione che attiva il workflow.

Opzioni disponibili:
manual,
interval,
cron,
daily,
weekly,
monthly
Example:

"manual"

schedule_value
string | null

Il valore per la pianificazione (es. un'espressione cron o una stringa di intervallo come '5 minutes').

Example:

"0 9 * * *"

next_run_at
string<date-time> | null

La prossima data/ora pianificata per l'esecuzione del workflow.

Example:

"2025-11-01T09:00:00.000000Z"

is_active
boolean

Indica se il workflow è attivo e può essere attivato.

Example:

true

webhook_url
string<uri> | null

L'URL univoco e sicuro per attivare questo workflow se utilizza un trigger webhook.

Example:

"https://api.altostrat.io/workflows/webhooks/whsec_abc123..."

created_at
string<date-time>

La data e ora di creazione del workflow.

Example:

"2025-10-31T12:00:00.000000Z"

updated_at
string<date-time>

La data e ora dell'ultimo aggiornamento del workflow.

Example:

"2025-10-31T12:30:00.000000Z"