Flowlib

Triggers

Start flows manually, on a schedule, or from webhooks.

Triggers define how a flow starts. Flowlib includes three built-in trigger types, plus webhook triggers via the Webhooks Plugin.

Manual trigger

The default trigger type. Flows with a manual trigger are started from the UI "Run" button, the REST API, or programmatically.

ParamDescription
defaultInputsJSON object of default key/value pairs used when the flow is run manually. When triggered from code, the caller's inputs take precedence (merged on top of defaults).

Downstream nodes access trigger outputs via {{ manual_trigger.variableName }}.

API execution

curl -X POST http://localhost:3000/flowlib/flows/{flowId}/run \
  -H "Content-Type: application/json" \
  -d '{ "inputs": { "topic": "Machine learning" } }'

Programmatic execution

const core = flowlib.getCore();
const result = await core.runs.start(flowId, {
  topic: 'Machine learning',
});

Cron trigger

Schedule flows to run on a recurring basis using cron expressions.

ParamDescription
expressionCron expression (e.g., 0 9 * * MON-FRI for weekdays at 9am)
timezoneIANA timezone (e.g., America/New_York)
staticInputsFixed input values passed to the flow on each run

Downstream nodes access the scheduled time via {{ cron_trigger.scheduledTime }}.

Common cron expressions

ExpressionSchedule
* * * * *Every minute
0 * * * *Every hour
0 9 * * *Daily at 9:00 AM
0 9 * * MON-FRIWeekdays at 9:00 AM
0 0 1 * *First day of each month

Cron scheduling is enabled by default. Disable it globally by setting triggers.cronEnabled: false in your config.

Next.js deployments on Vercel need one dedicated Flowlib cron route, configured in vercel.json, to drive scheduled work. Use a single Flowlib cron endpoint such as /api/flowlib/cron; it will execute due Flowlib cron triggers and other background maintenance for the app.

Webhook trigger

Trigger flows from external HTTP requests. Requires the Webhooks Plugin.

config
import { webhooks } from '@flowlib/webhooks';

const config = {
  // ...
  triggers: {
    webhookBaseUrl: 'https://your-app.com/flowlib',
  },
  plugins: [webhooks()],
};

Once configured, each flow with a webhook trigger gets a unique URL:

POST https://your-app.com/flowlib/webhooks/{webhookId}

The request body is passed as the trigger output, available to downstream nodes via template expressions.

See Webhooks Plugin for details.

Input node vs trigger

The Input node (core.input) and Manual Trigger node (trigger.manual) serve similar purposes — they define flow inputs. The key differences:

Input NodeManual Trigger
PurposeDefine flow input schema with types and defaultsEntry point that initiates execution
Can be mid-flowYesNo (always first)
UI behaviorShows input form when runningShows input form when running
Reference IDinputmanual_trigger

For most flows, you'll use either one — they're largely interchangeable for simple use cases. Input nodes are more flexible because they can appear anywhere in the graph.

On this page