# Shopify Flow

## Connection

If you don't already have a Shopify Flow connection created, enter your Shopify Store ID and click Authorize in Shopify.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2F3HgY3mWBcLOpZnWtnNXs%2Fimage.png?alt=media&#x26;token=440e48ca-7dd4-4ba1-866e-f8ca877dc5d9" alt=""><figcaption></figcaption></figure>

## Configure <a href="#flow" id="flow"></a>

### Start a MESA Workflow From Shopify Flow <a href="#flow" id="flow"></a>

MESA can receive Customer, Order, and Product data from Shopify Flow.

1\. In MESA, create a new workflow using a **Shopify Flow** trigger.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2Fx8KkVEvl8PLgzYibTmrt%2Fimage.png?alt=media&#x26;token=2797f383-014b-40e5-9963-bbf87516d55c" alt=""><figcaption></figcaption></figure>

2\. In Shopify Flow, create a workflow with the **Add action** button. Then, select the corresponding MESA action from Step 1.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FQKmyKqVqI4FHFIWrs6hO%2Fimage.png?alt=media&#x26;token=af63fcf3-62e7-4f81-8030-46a9154b02f9" alt=""><figcaption></figcaption></figure>

If you select the **Send to Mesa** action in Shopify Flow, you can copy the **Workflow Key** from your MESA workflow's **Dashboard** tab.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FAPmU6P2ai6avOLTfOzZG%2Fcopy_key.png?alt=media&#x26;token=a99b7d8b-9964-4480-a279-5ad8d0722dc1" alt=""><figcaption></figcaption></figure>

### Start a Shopify Flow Workflow From MESA <a href="#flow" id="flow"></a>

1\. Add a Shopify Flow action in MESA.

2\. Complete any required fields referencing an ID. In most cases, you want to use [MESA's Variables feature](https://docs.getmesa.com/workflow-builder/fields/variables) and locate the variable that represents the entity's ID (e.g. Product ID, Customer ID, Order ID).

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FeBU8HR4w9xMbxtOtA54z%2Fimage.png?alt=media&#x26;token=669a09e8-ab1f-461c-9a74-f65a5c6af206" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
To send custom data to your Shopify Flow, select the [**Send Custom Data to Shopify Flow**](#send-custom-data-to-shopify-flow-step) step.
{% endhint %}

3\. Create a new workflow in Shopify Flow.

4\. Within Shopify Flow's "**Start When**" block, select a **MESA Action**.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FfJowlSYKelZrHIrOaUBm%2Fimage.png?alt=media&#x26;token=b82974ca-0770-4e0f-86e0-b9463155e65d" alt=""><figcaption></figcaption></figure>

## Technical Notes

### **Send Custom Data to Shopify Flow step**

Use this step to send unstructured or custom data to your Shopify Flow. This will allow you to define a key-value pair array (similar to the Line Items properties), and you can read this in your Shopify Flow.

For example, we want to send a Shopify Order's Name and ID to our Flow. We can set this up by doing the following.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FbOU67O9dsGQXC4AtADDY%2Fimage.png?alt=media&#x26;token=c745c620-cf1b-4b91-8396-83cda37251eb" alt=""><figcaption></figcaption></figure>

In Shopify Flow, we can reference the data as `{{ custom_data.data[0].value }}` and this will represent the Order's Name.

### Send Custom Data from Shopify Flow to MESA

To send custom data from Shopify Flow to MESA, create a workflow in Shopify Flow with a **Send to Mesa** action.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FZLVBoolbsgAK90673CdP%2Fcustom-data-to-mesa.png?alt=media&#x26;token=b756b537-116e-41e5-b03e-3eec48f933b2" alt=""><figcaption></figcaption></figure>

Next, open the Send to Mesa action, enter the desired key, then select **Add a variable** to see the available data.

For example, this Send to Mesa action will send the contact email from Shopify Flow to MESA.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2F52PYfSVCydDqFOWajh0h%2Fcustom-data-payload.png?alt=media&#x26;token=5199b007-4945-4aaa-90c3-36c1b71685ce" alt=""><figcaption></figcaption></figure>

Your payload should follow a similar structure to the one shown above.

### How to use Data from Shopify Flow

When sending Orders, Customers, and Products from Shopify Flow, there must be a previous step to designate the object's ID.

This Shopify Flow workflow will send the Order ID to MESA when an order is created.

<figure><img src="https://3425906282-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F1H6u1HQc3Iew7ATmmiCi%2Fuploads%2FOognWiItWSlNT3Wf9M8w%2Forder-id-flow.png?alt=media&#x26;token=e9d10000-6ebf-4710-8392-76fa15e6c9b3" alt=""><figcaption></figcaption></figure>

{% hint style="info" %}
View Shopify Flow templates and tutorials [here](https://www.getmesa.com/apps/shopify-flow/integrate)!
{% endhint %}
