Flow integration

DataJet is able to interact with flow either by sending data or receiving it from Shopify Flow.

Sending data to flow

To send data to Shopify Flow first you would need to create Flow with DataJet trigger.

Next you can proceed with creating a DataJet task that would use flow filter to send data to your flow. Your task can be any of the following:

  • Blank HTTP (useful when you want to process user submitted form from the frontend)

  • Blank Scheduled (when you need to perform any repetitive actions in your store)

  • Blank Input (when task is triggered by uploading CSV file to process)

  • Blank Event (triggered by any of the shops webhooks)

For the purpose of this example we are going to hardcode payload with customer id property.

Task could look like this:

{% json payload %}
	{"customer_id": 5287014039740}
{% endjson %}

{% assign result = payload | flow %}

Now lets add add a tag through flow to that customer. This is how our flow would look like:

When our task code is executed - customer with provided ID would be tagged with: test-flow-tag

Receiving data from flow

Action Trigger

Action Trigger is deprecated. Use Action Trigger V2 instead.

DataJet task can also be triggered by configured flow.

In such case first we need to create Blank HTTP task. This task has task id attached as last part of url.

In our case task id is: 61631513777e665dc57343db

Now we can create trigger in Shopify Flow. For that we are going to use flow we configured in previous example:

In Task ID field we need to provide DataJet task id. The complete flow would work as following:

  • First DataJet triggers Flow with customer id as payload

  • Flow adds customer tag

  • Flow triggers DataJet task

  • DataJet processes HTTP task

Here is sample code for the Blank HTTP task. This code only logs incoming Flow request to console. However we could for example further modify customer here by adding another tags.

{{request.body | log }}

{% json response %}
    "body": {
      "status": "ok"
    "status": 200
{% endjson %}

request is global object in all HTTP tasks. It contains incoming request data.

Action Trigger V2

Action Trigger V2 works the same way as Action Trigger with one significant difference - it can return data to Flow. With data returned you can take appropriate action in flow depending on script execution status. To return response to Flow, set script response object to following value:

{{request.body | log }}

{% json response %}
    "body": {
      "return_value": {
        "status": "SUCCESS",
        "message": "OK"
{% endjson %}

status can be either SUCCESS or ERROR whereas message might be any string value.

Last updated