Skip to main content

Sending Grapevine Surveys responses to Triple Whale via Shopify Flow

Written by Steve Jones

If you use Triple Whale for attribution, you can send your Grapevine Surveys post-purchase answers straight into Triple Whale's Post-Purchase Survey table using Shopify Flow.

Once it's set up, every answered question is posted to Triple Whale automatically, and it shows up alongside your other attribution data.

This guide walks you through a simple, working setup based on Triple Whale's default post-purchase question: "Which of the following led you to purchase today?"

Please note: this is a do-it-yourself integration using Triple Whale's public API.
​
It isn't an official Grapevine Surveys and Triple Whale integration, so Triple Whale's own support team is best placed to help with anything on their side.

Before you start

You'll need:

  • A paid Grapevine Surveys plan. The Grapevine "Question answered" Flow trigger is only available on paid plans.

  • The Shopify Flow app installed on your store.

  • A way to send an HTTP request from Flow. Shopify Flow's own Send HTTP request action may not be available on every Shopify plan. If you don't see it, the React Flow app from the Shopify App Store adds the ability to send HTTP requests from your workflows.

  • A Triple Whale account with access to create an API key.

Make sure that the Grapevine Surveys checkout blocks are added

Your survey can only collect answers if the Grapevine Surveys app block has been added to your post-purchase pages. If you already show Grapevine surveys on your thank you page, you can skip this section.

  1. In Shopify admin, go to Settings > Checkout and click the Edit button within the Configurations section.

  2. Use the page selector at the top of the editor to open the Thank you page.

  3. Click Add app block and choose the Grapevine Surveys block.

  4. Move the block to where you'd like the survey to appear, then click Save.

  5. Switch to the Order status page and repeat steps 3 and 4.

Create your survey in Grapevine

Recreate Triple Whale's default post-purchase question as a Grapevine survey, so the answers line up with Triple Whale's own categories.

  1. In Grapevine Surveys, click Create survey and add a single choice question: "Which of the following led you to purchase today?"

  2. Add answer options that match Triple Whale's default survey, for example Facebook, Instagram, Google, Pinterest, TikTok, Snapchat, Youtube, Email, Text, and Referred by a friend. It's important that they are types exactly as they appear within Triple Whale, including case sensitivtiy.

  3. Under Manage Visibility within the Grapevine Surveys survey editor, select Checkout app block so the survey can appear on your thank you and order status pages. You can add display rules too, for example showing it to new customers only.

  4. Save the survey, then make a note of its Survey Code. You'll find this under the survey name on the Your Surveys page.

  5. You'll also need the Question Code for the question. The easiest way to find this is from the survey report view, where you will see the question code at the bottom of the stats for that question.

Tip: you can add your own answer options too. Any answer that doesn't match one of Triple Whale's default options will still appear in Triple Whale, but it will be grouped under Other.

Create a Triple Whale API key

  1. In your Triple Whale account, go to Data → APIs and click on the Generate API Key button.

  2. Give it a description so that you will remember what it is for

  3. Give it access to the PPS: Write scope.

  4. Copy the key and keep it somewhere safe. You'll paste it into Shopify Flow in the next step:

Treat this key like a password. Don't share it in screenshots, emails, or support chats.

Build the workflow in Shopify Flow

The workflow has three parts: a Grapevine Surveys trigger, a condition, and an HTTP request to Triple Whale.

  1. Add the trigger. In Shopify Flow, create a new workflow and choose the Grapevine Surveys Question answered trigger. This fires each time a Grapevine question is answered, around 5 minutes after the customer submits it.
    ​

  2. Add a condition. Add a Condition step with three checks, joined with AND:

    • Surveycode is equal to your Survey Code

    • Questioncode is equal to your Question Code

    • Orderid exists


    This makes sure only answers to your Triple Whale mapped question, linked to a real order, are sent to Triple Whale.
    ​

  3. Add the Send HTTP request action. On the True branch of the Condition, add a Send HTTP request action (or the React Flow equivalent) and set it up as follows:
    ​

    • HTTP method: POST

    • URL: https://api.triplewhale.com/api/v2/data-in/pps

    • Headers:
      ​Content-Type set to application/json
      ​ x-api-key set to your Triple Whale API key
      ​
      If your Flow action offers Add secret, use it to store the key rather than pasting it in as plain text.
      ​

    • Body: paste in the code below.
      ​
      Copy the body exactly as it is, including where the quote marks sit. total_price has no quotes because it's a number, and question_text and response use the json filter so that answers containing quote marks or special characters don't break the request:
      ​

      {
      "shop": "{{shop.myshopifyDomain}}",
      "platform": "Grapevine Surveys",
      "order_id": "{{ orderid }}",
      "created_at": "{{ responsedate }}",
      "total_price": {{ ordertotal }},
      "question_id": "{{ questioncode }}",
      "question_text": {{ question | json }},
      "response_id": "{{ surveycode }}-{{ orderid }}-{{ questioncode }}",
      "response": {{ answer | json }},
      "include_in_attribution": true
      }

  4. Turn on the workflow

Shopify Flow Send HTTP Request action

Shopify Flow Condition

What each field does

Field

Value sent

Notes

shop

Your myshopify.com domain

Tells Triple Whale which store the answer belongs to

platform

Grapevine Surveys

Labels the source of the survey data

order_id

The Shopify order ID

Links the answer to the order for attribution

created_at

Date the answer was submitted

total_price

Order total

A number, so no quote marks

question_id

Grapevine Question Code

question_text

The survey question wording

response_id

Survey Code, Order ID, and Question Code combined

A unique ID for each answer, so the same answer isn't counted twice

response

The customer's answer

Matched to Triple Whale's categories, or grouped under Other

include_in_attribution

true

Includes the answer in Triple Whale's attribution

Testing and what to expect

  1. Place a real order on your store and answer the survey on the thank you page.

  2. After around 5 minutes, check the workflow's Recent runs in Shopify Flow to confirm it ran and the HTTP request succeeded.

  3. In Triple Whale, open the Post-Purchase Survey table and look for the order.

A few things worth knowing:

  • It can take a while. Answers don't always appear in Triple Whale straight away, so give it some time before assuming something's wrong.

  • Test orders may not appear. Orders placed with Shopify's Bogus Gateway didn't show up in Triple Whale during our testing, so use a real order to check the full journey.

  • Custom answers show as Other. Any answer that doesn't match one of Triple Whale's default options is still recorded, but it's grouped under Other.

Troubleshooting

The workflow didn't run. Check that the survey was answered on an order, and that the Survey Code and Question Code in your Shopify Flow condition match exactly.

The workflow ran but the HTTP request failed. Open the run in Flow and check the response. A 401 or 403 usually means the API key is wrong or missing. A 400 usually means the body has a typo, such as a missing comma or quote mark.

I can't find the Send HTTP request action. It may not be available on your Shopify plan. Consider installing another app like React Flow to use its HTTP request action instead.

I want to send more than one question. Duplicate the workflow and change the Question Code in the condition for each question.

If you get stuck on the Grapevine side, we're here to help. For questions about Triple Whale's API or how answers appear in Triple Whale, please contact Triple Whale's support team.

Did this answer your question?