# Send invites automatically from Shopify

Ask each Shopify customer for a testimonial once their order is paid or fulfilled, with a Smart Invites webhook your store signs.

Connect your Shopify store so that each paid order adds its customer to your invite emails. You create a Shopify webhook in ReTestimonial, then add its URL in your Shopify admin. Smart Invites are on Premium and Business, and you need to own the workspace or be an **Admin** on the project.

This page covers what's particular to Shopify. Every setting of a webhook is explained in [Send invites automatically with a webhook](/help/collect/send-invites-automatically-with-a-webhook).

1. **Create a Shopify webhook in ReTestimonial**

   In your project, open **Invites** under **Collect**, go to the **Webhooks** tab and click **New webhook**. Under **Where do your customers buy?**, choose **Shopify**.

   The field paths come filled in for a Shopify order (see [What we read from a Shopify order](#what-we-read-from-a-shopify-order)), and **Only invite when (optional)** stays empty. Click **Continue**, choose the **Form**, the **Email sequence** and the timing, then click **Create webhook**.

2. **Add the webhook in Shopify**

   Click **Copy** next to **Your webhook URL**. Then, in your Shopify admin:

   1. Go to **Settings** > **Notifications**, click **Webhooks**, then **Create webhook**.
   2. For **Event**, choose **Order payment**, or **Order fulfillment** to ask once the order ships.
   3. For **Format**, choose **JSON**.
   4. Paste the URL into **URL** and click **Save**.

   Shopify's own steps are in [Creating webhooks](https://help.shopify.com/en/manual/fulfillment/setup/notifications/webhooks) in the Shopify Help Center.

3. **Paste your store's signing key**

   On the same **Webhooks** page, Shopify shows the key your webhooks are signed with ("Your webhooks are signed with …"), a string of letters and numbers unique to your store. Copy it, paste it into **Shopify webhook signing secret (recommended)** in ReTestimonial and click **Save**.

   The field then reads **Signature verification is on — unsigned events are rejected.** From now on, only events signed by your store are accepted.

4. **Wait for the first order**

   The page shows **Listening for the first event…** until Shopify sends an order, then **Event received — it works**, or why the event was skipped or failed. You can leave the page; the webhook is already live.

## Shopify's test doesn't use an invite

Shopify's **Send test notification**, in the webhook's row on its **Webhooks** page, sends a sample order to the URL. ReTestimonial recognizes it as a test: the event shows up as skipped, with the reason "A test event from the platform, so nobody was invited and no invite was used". Orders placed with Shopify's test payment gateway are skipped the same way. That confirms the connection without emailing anyone.

To check how the webhook reads an order, use its **Test** tab. It runs a sample Shopify order, or an order you paste, through the webhook; nothing is saved and no email is sent. See [Test a Smart Invites webhook](/help/collect/test-a-smart-invites-webhook).

## Order payment or Order fulfillment

- **Order payment** arrives when an order is paid, usually right after checkout and before the customer has the product. To give it time to arrive, set **Wait before the first email** on the webhook.
- **Order fulfillment** arrives once the order ships.

Both events carry the same order, so the paths work for either. ReTestimonial doesn't check which event Shopify sends: every order that reaches the URL invites its customer. Choose the event carefully. **Order creation**, for example, could invite customers before they've paid.

Shopify can't change a webhook's event after it's created. To switch, create a new webhook in Shopify with the same URL and delete the old one.

## What we read from a Shopify order

| Field            | Default path              | What it holds                      |
| ---------------- | ------------------------- | ---------------------------------- |
| **Email path**   | `email`                   | The order's email address          |
| **Name path**    | `customer.first_name`     | The customer's first name          |
| **Company path** | `billing_address.company` | The company on the billing address |

The email comes from the order itself, not from its customer record: point-of-sale and some guest orders have no customer record. Those customers are still invited, just without a name.

There's no default **Only invite when (optional)** filter. Shopify names the event in the request's headers, not in the order, so you choose it in Shopify instead.

## When a Shopify order isn't invited

The webhook's **Activity** tab shows each event as **Invited**, **Skipped** or **Failed**, with the reason.

| Reason shown                                                                                                               | Why, and what to do                                                                                                                                                                           |
| -------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| **Failed**: "No email was found at the mapped path"                                                                        | The order has no email address, so there's nobody to invite.                                                                                                                                  |
| **Failed**: "The platform sent a body that is neither JSON nor form data (XML isn't read). Set the platform to send JSON." | The Shopify webhook's **Format** is **XML**. Edit the webhook in Shopify and set it to **JSON**.                                                                                              |
| **Failed**: "The signature didn't match"                                                                                   | The key you saved isn't your store's, and every order from Shopify is refused until it is. On the **Setup** tab, click **Replace secret** and paste the key from Shopify's **Webhooks** page. |
| **Skipped**: "Customer was already invited within the cooldown window"                                                     | A repeat customer who was invited recently. Nothing to do.                                                                                                                                    |

If Shopify delivers the same event twice, for example when it retries a delivery, the customer is invited once.

## Next steps

- [Customize invite emails](/help/collect/customize-invite-emails)
- [Track invite campaigns](/help/collect/track-invite-campaigns)
- [Manage the do-not-email list](/help/collect/manage-the-do-not-email-list)
- [Invite emails not sending](/help/troubleshooting/invite-emails-not-sending)
