A trigger is an event that initiates a published workflow.

Each workflow can only have one trigger, which is selected when a new workflow is created.

The trigger is visible in the workflows table of the dashboard and in the Strada IDE.

The supported trigger types are:

  • Schedule
  • Webhook

Scheduled trigger

Workflows with a scheduled trigger run on a regular interval. They are used for batch processes such as processing orders on a daily basis.

The schedule is set when the new workflow is created. It can be defined using:

  • Dropdown interval options
  • Cron syntax for more granular control

Webhook trigger

Published workflows with a webhook trigger run whenever a POST request is received at the provided webhook URL.

They are used for real-time processes such as parsing emails as soon as they arrive.

Webhook URL

You can get the webhook URL for a workflow when you open it in the Strada IDE. Press on the URL icon to copy it to your clipboard.

Treat your webhook URL as you would any other secret or token. Additional measures for webhook security are coming soon!

Once a workflow is published, you can invoke the workflow by sending a POST request to the webhook URL.

Referencing a webhook payload

When you’re writing your workflow code, you can reference the content via the special variable payload. The payload is a Python dictionary, that represents the incoming body of a webhook request. While you are building your workflow, you can set a test value to represent what the incoming payload would be.

To parse the incoming body of the POST request, the Python utility json.loads is used behind the scenes and the value is stored in the payload variable.

You can access any value from the payload, as you would any other value from a Python dictionary. For example, to save the first_name value from the payload in a variable called name:

name = payload['first_name']

Testing with a webhook payload

To test your workflow using a sample webhook payload, in the IDE press on Set test payload.

Once the dialog opens up, you can either send a POST request to easily configure the payload or enter a value manually. To configure via a POST request, send a request to the webhook URL and ensure that the body is application/json.

Now, when you manually run the workflow by pressing ▶ Run in the Strada IDE, the test payload will be used, whenever referencing the payload variable.

Once the workflow is published and a webhook is received, this test payload will not be used.