Setting up Workflows and Custom triggers

What are Workflows?

Workflows make it possible to create simple automation in your project. Each workflow is a binding between Trigger and Effect. For example you can create a Workflow which generates a Voucher (Effect) whenever customer has birthday (Trigger).

What could be a Trigger?

Vouchery.io team is working on extending the number of built-in triggers you can use. Some of the triggers require an integration with external service. You can check all available integrations under Project Settings.

Apart from pre-defined triggers you can also set custom Triggers. Custom Trigger is an API call from your system with a unique name and optional data. You can deliver any events you want. Once you configure one of them to be a custom Trigger Vouchery will automatically pick it up and execute connected Effect whenever it receives that event. All unconfigured events are simply ignored.

What could be an Effect?

Effects are actions that will happen in Vouchery (in future also in external systems) whenever some Trigger arrives. A typical Effect is to generate new Voucher and optionally deliver it to the customer. Effects are pre-defined so you can't create custom Effects at the moment. Some effects depend on specific trigger_data sent along with a Trigger to be executed correctly. For example customer_identifier and email must be provided inside trigger_data object if you want to use that Trigger to generate and deliver a Voucher to customer. If some required data is missing Workflow execution will fail.

Example Workflow

Let's assume you want to generate a Voucher for customer on his birthday and deliver it via e-mail. First you have to make sure that your system delivers a proper event to Custom Trigger API whenever customer has birthday. Event body should have the following format:

{
  "trigger": "custom",
  "trigger_data": {
    "trigger_name": "customer_birthday",
    "customer_identifier": "123",
    "email": "[email protected]"
  }
}

If your system is already delivering the event to Vouchery you can create a Workflow that uses it as a custom Trigger:

When you save the Workflow your customers will get an e-mail with generated Voucher on their birthday