Swirls

SWIRLS_

  • How it works
  • Pricing

56 matches

OverviewDeliver client operations10Win and grow accounts8Resolve customer issues6Create and distribute content9Run people and operations5Review money and agreements3Monitor systems and data9Compose dependable work6

56 matches

OverviewDeliver client operations10Win and grow accounts8Resolve customer issues6Create and distribute content9Run people and operations5Review money and agreements3Monitor systems and data9Compose dependable work6
← PatternsFormView on GitHub

Multi-Trigger Workflow

One workflow, three trigger sources (form, webhook, schedule).

ai

Source

/**
 * A single workflow triggered by multiple sources:
 * a form, a webhook, and a schedule.
 */

form manual_entry {
  label: "Manual Entry"
  schema: @json {
    {
      "type": "object",
      "required": ["message"],
      "properties": {
        "message": { "type": "string", "title": "Message" }
      }
    }
  }
}

webhook api_entry {
  label: "API Entry"
  schema: @json {
    {
      "type": "object",
      "properties": {
        "message": { "type": "string" }
      }
    }
  }
}

schedule periodic_entry {
  label: "Periodic Entry"
  cron: "0 12 * * *"
}

workflow process_message {
  label: "Process Message"

  root {
    type: code
    label: "Normalize input"
    code: @ts {
      const input = context.nodes.root.input || {}
      const triggerType = context.meta.triggerType
      return {
        message: input.message || "Scheduled run at " + new Date().toISOString(),
        source: triggerType,
        received_at: new Date().toISOString()
      }
    }
    outputSchema: @json {
      {
        "type": "object",
        "properties": {
          "message": { "type": "string" },
          "source": { "type": "string" },
          "received_at": { "type": "string" }
        }
      }
    }
  }

  node process {
    type: ai
    label: "Process message"
    kind: object
    model: "google/gemini-2.5-flash"
    prompt: @ts {
      return "Analyze this message and extract key information.\n\nSource: " + context.nodes.root.output.source + "\nMessage: " + context.nodes.root.output.message
    }
    schema: @json {
      {
        "type": "object",
        "required": ["summary", "intent"],
        "properties": {
          "summary": { "type": "string" },
          "intent": { "type": "string" },
          "entities": { "type": "array", "items": { "type": "string" } }
        }
      }
    }
  }

  node result {
    type: code
    label: "Format result"
    code: @ts {
      return {
        source: context.nodes.root.output.source,
        message: context.nodes.root.output.message,
        summary: context.nodes.process.output.summary,
        intent: context.nodes.process.output.intent
      }
    }
  }

  flow {
    root -> process
    process -> result
  }
}

trigger from_form {
  form:manual_entry -> process_message
  enabled: true
}

trigger from_webhook {
  webhook:api_entry -> process_message
  enabled: true
}

trigger from_schedule {
  schedule:periodic_entry -> process_message
  enabled: true
}

Flow

Trigger to workflow

manual_entryform
api_entrywebhook
periodic_entryschedule
process_message
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.

Workflow nodes

CODE
Code Node
Normalize input
AI
AI Node
Process message
CODE
Code Node
Format result
Press enter or space to select a node. You can then use the arrow keys to move the node around. Press delete to remove it and escape to cancel.
Press enter or space to select an edge. You can then press delete to remove it or escape to cancel.