Create Flow triggers

Connect your app to Flow, so that events that occur in your app can trigger workflows.

The example used in this task creates a customized trigger for Flow that starts when a customer is added to a campaign in your app.

Before you begin

Make sure that you have the following:

  • A test app that you can use to send information to Flow. You can use an existing app. This app needs to be able to POST content to Flow.
  • A test store that has Flow installed. You can install Flow from the Shopify App Store.

Step 1: Create a trigger connector for Flow (Shopify Partner Dashboard)

To create a trigger for Flow, you need to add a trigger connector to your app. In this connector, you describe the properties that your app will send to Flow.

To create a trigger connector for Flow:

  1. In the Partner Dashboard, open Apps and then click your test app.

  2. Click the Extensions tab and Shopify Flow > Add action.

  3. Enter a title and description for your trigger. For example, type Subscribed customer and A new customer has subscribed to the subscription campaign respectively.

  4. Click Add property and choose the data type for the data that your app will send to Flow. For example, choose String to send an email address.

  5. Enter the name and description for the property. For example, enter Customer email and Customer contact email address respectively.

  6. Click Save.

Step 2: Add support for your trigger in your app

In your app, add the functionality that will POST an HTTP request to Flow. This POST needs to be less than 1 MB and it needs to contain the following content in its body:

  • the name of the trigger
  • the property information that you defined when you created the connector for your app
  • the access token for your merchant’s store
  • a hash-based message authentication (HMAC) header that uses the API secret key associated with your app

The POST needs to use this webhook endpoint https://{STORE}/admin/flow/trigger/receive.json, where {STORE} refers to the store that has a workflow that uses your trigger. (This URL is the one that appeared in the Partner Dashboard when you created your trigger connector.)

The following is an example of a POST body: { "trigger_title": "Customer subscribed", "properties": { "Customer email": "myemail@myemaildomain.com" } }

Step 3: Test your trigger by creating a workflow (Flow)

Now that you’ve created a trigger connector and have added support for it in your app, you can test it in Flow.

To test your trigger:

  1. In your test store, install your app.

  2. In your test store, create a workflow that uses the trigger that you created for your app.

  3. In your Shopify admin, open Flow and create a workflow that uses your trigger.

  4. In your app, run the event that sends the trigger information to Flow. In a test environment, you can run a command to send the trigger information to your test store:

  curl -H "content-type: application/json" -H "X-SHOPIFY-ACCESS-TOKEN: 555555555555555555" https://johns-apparel.myshopify.io/admin/flow/trigger/receive.json -d '{ "trigger_title": "Subscribed", "properties": { "Customer email": "myemail@myemaildomain.com" }}'

When Flow receives the POST from your app, workflows that use your trigger start.

Learn more

Sign up for a Partner account to get started.

Sign up