Export Using Shopify Flow

Here is how to push your post-purchase survey data to your data warehouse using Shopify Flow and StitchData.

📘

Shopify Plus Only

Shopify Flow is only available for those on Shopify Plus.

Shopify Flow Setup

For initial Shopify Flow setup, follow our Shopify Flow integration instructions here.

Export Using HTTP Post

Webhook functionality and a queryable API are both currently on our roadmap for 2021. Until then, if you need to push your EnquireLabs post-purchase survey data into your database, you can use the below method.

Getting Started:

  • Create a StitchData account and set your database as your destination.
  • Install Shopify Flow. We’ll be using Flow’s send http request functionality.
    Add “Incoming Webhook” as an integration in StitchData
580

In StitchData, click “Add Integration” and then click “Webhooks” (it’s alphabetical, so you’ll have to scroll to the bottom). You’ll be presented with a screen to input an Integration Name and Primary Key. You can enter whatever you’d like to call your new table that will contain Enquire data. As a Primary Key, we suggest using “order_id”. Click “Save.”

1468

On the following screen, you’ll be presented with a Webhooks URL. Copy the URL as you’ll need it in the next step.

1430

Create a new workflow

In Shopify Flow, create a new workflow with Enquire - New Survey Response as your trigger. Next, add External - Send http request as your action.

Next, fill in the available fields with the below information:

  • HTTP Method: Post
  • URL: paste the webhooks URL you copied from StitchData
  • Headers: Key: Content-Type, Value: application/json
  • Body: this is where you’ll input what attributes you want to pass from Enquire and Shopify to your database. If you used “order_id” as your primary key, make sure you include that. The below JSON can be copied into the body section and will pass your order id, order name, survey question, and survey response.
// The EnquireLabs trigger offers the following fields:

{
	"coupon_amount": {{trigger.couponAmount}},
	"count_code": "{{trigger.couponCode}}",
	"coupon_type": "{{trigger.couponType}}",
	"customer_name": "{{trigger.customerName}}",
	"customer_email": "{{trigger.email}}",
	"order_number": "{{trigger.orderNumber}}",
	"order_total": {{trigger.orderTotal}},
	"question": "{{trigger.question}}",
	"question_id": "{{trigger.questionId}}",
	"referring_site": "{{trigger.referringSite}}",
	"response": "{{trigger.response}}",
	"response_was_other": "{{trigger.responseWasOther}}",
	"utm_campaign": "{{trigger.utmCampaign}}",
	"utm_content": "{{trigger.utmContent}}",
	"utm_medium": "{{trigger.utmMedium}}",
	"utm_source": "{{trigger.utmSource}}",
	"utm_term": "{{trigger.utmTerm}}"
}

// Relevant Shopify Fields:
{
	"customer_id": {{customer.id}},
	"order_id": {{order.id}},
  "lifetime_duration": {{customer.lifetimeDuration}},
  "lifetime_spend": {{customer.totalSpentV2.amount}},
  "order_created_at": "{{order.createdAt}}"
}

// Combine fields to create desired payload. For example:
{
	"customer_id": {{customer.id}},
	"order_id": {{order.id}},
	"question_id": "{{trigger.questionId}}",
	"question": "{{trigger.question}}",
	"response": "{{trigger.response}}",
	"response_was_other": "{{trigger.responseWasOther}}",
}
892

After you’ve filled in all the fields, click “Save” located in the upper right-hand corner and name your new workflow. To set your workflow live, simply click the on/off toggle next to the save button.

You’re all set. Enquire survey data will now start feeding into your database. If you have any questions, don’t hesitate to reach out to us at [email protected].

Export To Google Sheet

Shopify Flow has a native Google Sheet integration that allows you to export push your EnquireLabs survey data directly to a Google Sheet in real-time.

Response Was Other

To put Other responses into their own column, create an If condition in your Shopify Flow setup on response was other. You can then hardcode "Other" into the response column and create a new column for Other responses.

2450