# How to Set Up Shopify Workflows Using Mercuri API

### Use case: Set Up Cart Abandonment WhatsApp Reminder Workflow in Shopify Using Mercuri API

Cart abandonment reminders help re-engage customers who added items to their cart but didn’t complete their purchase. Follow the steps below to automate a WhatsApp reminder using **Shopify Flow** and the **Mercuri API**.

***

#### Steps to Create the Workflow

{% embed url="<https://youtu.be/D-U1pPcS358>" %}

1. Go to your **Shopify Admin Dashboard**.
2. From the left-hand side panel, click on **Apps**, then select **Flow**, or search for *Flow* using the app search bar.
3. Once the Flow dashboard opens, click on **Create Workflow** in the top-right corner of the screen.
4. You’ll be prompted to either **Select a Trigger** or **Browse Templates** — click on **Select a Trigger**.
5. You’ll now see the **workflow dashboard**. To start building your automation, select a trigger.
6. In the search bar, type **“Customer abandoned checkout”** and choose it from the list.
7. This trigger activates the workflow whenever a customer adds items to their cart but doesn’t complete the checkout process.
8. After setting the trigger, click the **“+”** button to add the next step.
9. Select **Action → Wait** (under Flow). Set the waiting time to **1 hour**.This ensures the WhatsApp reminder will be sent one hour after the cart is abandoned.
10. Click the **“+”** icon again below the wait step.
11. Select **Action → Send HTTP Request**.
12. In the flow action, configure:

* **HTTP Method:** `POST`
* **URL:** `https://api.mercuri.cx/v1/send_message`
* **Headers:**&#x20;

<figure><img src="/files/GXf53qPWUNhqRx0hAs2C" alt="" width="329"><figcaption></figcaption></figure>

|       Key       |                                                                   Value                                                                   |
| :-------------: | :---------------------------------------------------------------------------------------------------------------------------------------: |
| `Authorization` | <p> <code>Bearer Bearer ${bearerToken}</code> . </p><p></p><p><em>Replace the <code>${bearerToken}</code>  with the secret key.</em> </p> |
|  `content-type` |                                                             `application/json`                                                            |

* **Body:** Paste the JSON payload for your WhatsApp reminder message (example below).

{% code title="Request (Payload)" overflow="wrap" lineNumbers="true" %}

```json
{
   "phoneNumberId":"xxxxxxxxxxx",
    "channel":"whatsapp",
    "recipient":"+918971476855",
    "message":{
        "type":"template",
        "template":{
            // "templateId":"1777667316490397",
            "templateId":"xxxxxxxxxxxxx",
            "parameters":[
                {
                    "otpCode":"xxxxxxxxxxx",
                    "businessPhoneNumber":"xxxxxxxxxxx"
                    "firstName" : "xxxxxxxxxxx",
                    "lastName" : "xxxxxxxxxxx",
                    "businessName" : "xxxxxxxxxxx",
                    "orderNumber" : "xxxxxxxxxxx",
                    "orderTotal" : "xxxxxxxxxxx",
                    "expirationTime":"xxxxxxxxxxx",
                    "couponCode":"xxxxxxxxxxx"
                }
            ]
        }
    },
    "country":"US",
    "saveToInbox":true
}
}
```

{% endcode %}

{% hint style="info" %}
**Note:🔧 Changes to Make After Copy-Pasting the Code**

1. **Add Your Phone Number ID**

* Replace `"xxxxxxxxxxxxxxxxxxx"` corresponding to **phoneNumberId** in the code with the **Phone Number ID** you copied from the Mercuri Dashboard.

2. **Add Your Template ID**

* Replace `"xxxxxxxxxxxxxxxxxxx"` corresponding to **templateId** with the **Template ID** you copied from the Mercuri Dashboard.

[***Please click on this link to view the instructions for locating the Phone Number ID and Template ID.***](https://docs.mercuri.cx/features/introduction-mercuri-api/faqs)

3. **Add recipient :**

* Click the **Add Variable** button at the bottom-right of the body box, search for **phone number**, and select it.&#x20;
* This variable automatically fetches the customer’s phone number to send the cart abandonment message.

4. **Add Template Variables :**&#x20;

Based on your message template:

* Add the corresponding parameters and values so they dynamically populate for each customer.
* For this tutorial, we’ve included a single variable — the **customer’s first name**.\
  To add it:
* Click **Add Variable** at the bottom of the text box and search for **First Name**.
  {% endhint %}

13. You’ve now successfully set up the **Cart Abandonment Reminder Workflow**.
14. Click **Turn On Workflow** at the top-right corner to activate it.
15. When prompted for confirmation, click **Turn On** again.


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.mercuri.cx/features/introduction-mercuri-api/how-to-set-up-shopify-workflows-using-mercuri-api.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
