powered by

Triggers and Scheduling

Updated Mar 19, 2026
Workflows are started by a trigger. There are four trigger types: a schedule, a data event, a manual run, or an HTTP API call. Choosing the right trigger is the first step in designing any workflow.

Timed (Scheduled)

A timed workflow runs automatically on a schedule defined using a cron expression.

Cron expression format

text
  minute (0-59)
  |  hour (0-23)
  |  |  day of month (1-31)
  |  |  |  month (1-12)
  |  |  |  |  day of week (0-6, Sunday=0)
  *  *  *  *  *

Common examples

Expression Runs
0 6 * * * Every day at 6:00am
0 9 * * 1 Every Monday at 9:00am
0 * * * * Every hour
*/15 * * * * Every 15 minutes
0 0 1 * * First day of every month at midnight
30 8 * * 1-5 Weekdays at 8:30am

Use cases

  • Pulling fresh data from an external API each morning
  • Sending a daily or weekly digest
  • Archiving or cleaning up old records on a schedule
  • Generating periodic reports

Event (Entity Changes)

An event workflow fires automatically when a record in a chosen entity is created, updated, or deleted.

Configuration

When creating the workflow, choose:

  • Entity — which entity to watch (e.g. orders, users, articles)
  • Event type — one of:
    • EntityCreated — a new record was added
    • EntityUpdated — an existing record was changed
    • EntityDeleted — a record was removed

Accessing trigger data

The full record that caused the trigger is available in every step:

text
{{ $anythink.trigger.data.id }}
{{ $anythink.trigger.data.email }}
{{ $anythink.trigger.data.status }}

For EntityUpdated, the trigger data contains the record's current values after the update.

Gating on field values

Event workflows fire on every change to the entity. To act only in certain cases, add a Condition step right after the trigger.

For example, to only send a notification when status becomes approved:

  1. Add a Run Script step to extract a flag:
javascript
var status = $anythink.trigger.data.status;
return { is_approved: status === "approved" ? "yes" : "no" };
  1. Add a Condition step that checks $anythink.steps.check.data[0].is_approved equals yes
  2. Connect the matching output to your notification step

Use cases

  • Send a welcome email when a new user signs up
  • Notify a channel when an order changes to shipped
  • Create a related record automatically when a parent is created
  • Sync a record to an external CRM when it is updated

Manual

A manual workflow has no automatic trigger. It runs only when explicitly started.

Running a manual workflow

From the dashboard: Open the workflow and click Run Now.

From the CLI:

bash
anythink workflows trigger 76
anythink workflows trigger 76 --payload '{"userId": 123, "action": "reset-password"}'

Via the API:

http
POST /org/{orgId}/workflows/{workflowId}/trigger

Accessing the payload

Any JSON payload passed when triggering is available as trigger data:

text
{{ $anythink.trigger.data.userId }}
{{ $anythink.trigger.data.action }}

Use cases

  • One-off data migrations
  • On-demand report generation
  • Admin-triggered operations such as a resend invoice button calling the API
  • Testing a workflow before enabling automatic runs

API Endpoint

An API trigger turns your workflow into a custom HTTP endpoint. When an HTTP request arrives at that URL, the workflow runs.

Setup

Select API as the trigger type and enter a custom route, for example: /send-welcome-email

Anythink creates a POST endpoint at:

http
POST https://your-instance.anythink.cloud/org/{orgId}/workflows/endpoint/send-welcome-email

Accessing the request body

Any JSON body sent in the request is available as trigger data:

text
{{ $anythink.trigger.data.email }}
{{ $anythink.trigger.data.userId }}

Calling your endpoint

bash
curl -X POST \
  https://your-instance.anythink.cloud/org/{orgId}/workflows/endpoint/send-welcome-email \
  -H "Content-Type: application/json" \
  -d '{"email": "alice@example.com", "name": "Alice"}'

Use cases

  • Receiving webhooks from Stripe, GitHub, or any external service
  • A serverless-style function for your frontend to call
  • A custom action endpoint for Zapier or n8n to trigger
  • Processing form submissions from a static website