Skip to main content

Triggering a WhatsApp message from a survey response

via Quickreply.io

S
Written by Steve Jones
Updated over a month ago

Grapevine Surveys can trigger actions in Shopify Flow when a customer answers a survey question. This makes it possible to respond automatically to customer feedback in real time, for example by sending a WhatsApp message when a specific answer is given.

This article shows a practical example of how our Question Answered Shopify Flow trigger can be used to send to send a WhatsApp message via QuickReply based on a customer’s response.

If you’re not familiar with how Grapevine triggers work in Shopify Flow, please see our guide on sending survey data into Shopify Flow first.

When to use this approach

This works best when you want to:

  • Respond quickly to specific customer sentiment

  • Move conversations into WhatsApp automatically

  • Reduce manual monitoring of survey responses

  • Create personalised follow-ups based on customer intent

Please note:

This guide does not cover how to use QuickReply. You will need a valid QuickReply account and a template ready to send out your WhatsApp message.

You will also need to ask the QuickReply team for the correct API endpoint to use, as this will be required as the destination URL for the Send HTTP Request action in Shopify Flow.

The customer will need to have provided their mobile phone number during checkout for a WhatsApp message to be sent.

Example use case

A common example for a Grapevine Surveys post-purchase follow-up question would be something like:

“Did you find everything you were looking for today?”

The possible answers for our example survey would be:

  • Yes

  • No, some items weren't available

If a customer selects “No, some items weren't available”, Shopify Flow can immediately send a request to QuickReply, which would then send a WhatsApp message to the customer, such as:


“Hi, we noticed there were some items you couldn't purchase today. Just reply here and our team will let you know when it will be available again or suggest an alternative.”


This allows merchants to proactively follow-up with customers who may not have been able to find what they needed before checking out.

How it works

For our example scenario, we're going to use a post-purchase survey that was answered on the Thank You page, immediately after a customer places an order.

Here is an overview of what happens:

  1. The customer places an order on your store and is presented with your post-purchase survey

  2. The customer answers a question within your Grapevine Surveys survey.

  3. The Question Answered trigger runs in Shopify Flow.

  4. Flow then checks the conditions that you have configured in your workflow e.g.

    1. If the survey code equals xxxxxxxxxxx

    2. If the question code equals xxxxxxxxxxx

    3. If the answer equals “No, some items weren't available”

  5. If all of these conditions are true, Flow will use the Send HTTP request action to send the following payload to the QuickReply endpoint:

    • Customer phone number

    • QuickReply message template or campaign ID

    • Shopify Order name

    • The survey question answer

  6. QuickReply will receive that data and will send the WhatsApp message to the customer.

The key idea is that the survey answer provided by the respondent becomes the decision point for the automation to complete.

Flow Structure

You can download our flow template for this example at the end of this article.

Here is an overview of our example flow:

Get order data

The Grapevine Surveys Question Answered trigger contains information about the survey response itself such as the question, selected answer, and associated order ID, however, it does not include the customer’s phone number.

This is intentional as the trigger is designed to pass survey data into Shopify Flow without exposing the full order object, however, we will need the customer phone number to deliver the WhatsApp message.

To make this available inside the workflow, we need to add a Get order data action to our flow. This action retrieves the full order details from Shopify using the {{orderid}} variable contained within the Question Answered trigger.

The Get order data action uses the order ID to load the associated order details into the workflow. Here is how that action is configured:

Sort data by: ID

This setting controls how Shopify sorts results if multiple orders match the query.

Because we are requesting a specific order by ID, sorting has no practical effect here. Leaving this set to ID is recommended, as is leaving the sorting direction parameter as Ascending.

Maximum number of orders: 1

This limits how many orders Shopify returns. In this workflow, we only need the single order associated with the survey response, so this should always be set to 1.

Query (Advanced)

id:{{orderid}}

This is the most important setting. The query tells Shopify which order to retrieve.

The {{orderid}} variable comes from the Grapevine Surveys trigger and represents the order linked to the survey response.

For each loop (iterate) action

The Get order data action returns a list of orders (even when you’ve limited it to just 1).

Because of this, Shopify Flow treats the result as a collection, not a single order object.

To access fields on the returned order (like the customer’s phone number) inside later steps, you need to add a For each loop (iterate) step after the Get order data action.

Add the For each (iterate) action and then choose the list to iterate over. It should appear as getOrderData in the variable picker:

Send HTTP request

You can now trigger the WhatsApp message by sending a request to QuickReply using the Send HTTP request action.

This action posts the customer’s phone number (pulled from the order data) plus any additional survey details you want to include as QuickReply template variables.

Add the action to the Repeat for each item node of the For each loop (iterate) action.

This is how the Send HTTP Request will be configured:

Method

POST

URL

Your QuickReply endpoint (as provided by QuickReply)

BODY

Some Flow editors and webhook endpoints are sensitive to line breaks in JSON. For best results, do not include any line returns in the request body, keep the entire JSON payload on one line:

{"channel":"whatsapp","to":"{% for getOrderData_item in getOrderData %}{{getOrderData_item.phone}}{% endfor %}","template_id":"my_post-purchase_survey","language":"en","variables":{"order_number":"{{ordername}}","survey_answer":"{{answer | replace: ",", ";"}}"}}

This is how the action should look once configured:

That's it!

Once everything is in place, the only thing left to do is run a quick end-to-end test.

Place a test order (or use a recent order), complete the Grapevine survey and select the answer that should trigger the WhatsApp message.

Then head to Shopify Flow → Runs to review the latest run.

Open the run to confirm it completed successfully and that the Send HTTP request step executed (you’ll see the request details and response), which confirms the payload was sent through to QuickReply.

Then head over to QuickReply to confirm the message was received and sent (you should see it logged against the customer’s WhatsApp conversation or message activity).

Need any help?

If you have any questions about the content of this article or any other Grapevine Surveys related question, then please do just get in touch.

Did this answer your question?