Shopify Connector

Shopify Connector

The Shopify Connector sends automatic push notifications to your app users when something happens in your Shopify store, like a new order, a payment or a shipment.

It connects your Shopify store to Webtonative with a webhook, and links each logged-in customer to their device so every notification reaches the right person.

💡
This connector is available for both Android and iOS apps.

Where to Find It In Your Dashboard

My Apps ➡️ Edit your app ➡️ Push Notification ➡️ Webhook Connector ➡️ Shopify

Before You Start

  • Your plan must include Webtonative Push.

  • Push must be configured for your app (Android and/or iOS) in the Webtonative dashboard.

  • You need access to your Shopify admin (Settings and Online Store ➡️ Themes).

How It Works

1. Link customers to devices

A small script in your theme calls WTN.Notification.setExternalUserId() with the Shopify customer ID when a customer is logged in, and removeExternalUserId() when they log out.

2. Shopify sends a webhook

When the event happens (for example, an order is created), Shopify sends the order data to your connector's Webhook URL.

3. Webtonative sends the notification

Webtonative reads the customer ID from the webhook (customer.id) and sends your notification to every device linked to that customer.

Add the User Sync Script to Your Theme

Open the Theme Code

  • In Shopify admin, go to Online Store ➡️ Themes.

  • Click ⋯ next to your current theme and choose Edit code.

  • Open layout/theme.liquid.


Paste the Script

Paste this script on the line just above </head>, then click Save.

<script src="https://unpkg.com/webtonative@1.1.33/webtonative.min.js" defer></script>
<script>
  window.addEventListener('load', function () {
    {% if customer %}
      WTN.Notification.setExternalUserId("{{ customer.id }}");
    {% endif %}
  });
 
  // Remove the external ID when the customer clicks logout
  document.addEventListener('click', function (e) {
    var link = e.target.closest('a[href*="/account/logout"], a[href*="{{ routes.account_logout_url }}"]');
    if (!link || !window.WTN || !WTN.Notification) return;
    e.preventDefault();
    WTN.Notification.removeExternalUserId();
    setTimeout(function () { window.location.href = link.href; }, 300);
  });
</script>
💡
Always use the latest Webtonative script. Check the latest script and use the version shown there in the script URL (currently 1.1.33): View docs (opens in a new tab)

What the script does

WhenAction
A logged-in customer opens any pagesetExternalUserId(customer.id) links them to the device
A guest opens a pageNothing
The customer taps a logout linkremoveExternalUserId() unlinks them, then logs out
💡
Customers who were already logged in are linked the next time they open or refresh a page in the app. They don't need to log in again.
💡
Use SDK version 1.1.23 or later (the latest is recommended). setExternalUserId and removeExternalUserId are not available in older versions. Make sure your theme doesn't load another, older copy of the Webtonative SDK, because it would replace the newer one.
💡
Paste it in theme.liquid only. Liquid doesn't run in Settings ➡️ Customer events or in checkout settings. If you switch themes, add the script to the new theme too.

Create the Connector in Webtonative

Open Webhook Connector

Log in to the Webtonative dashboard, go to My Apps, select your app and open Push Notification ➡️ Webhook Connector in the sidebar.


Add a Shopify Connector

  • Click + Connect Webhook (or + Add Connector if you already have connectors).

  • Select Shopify and click Continue.



  • Enter a Connector Name, for example Order created.

  • Copy the Webhook URL.


💡
Keep this window open. You'll come back to paste the secret and click Verify.

Create the Webhook in Shopify

Open Shopify Webhooks

In Shopify admin, go to Settings ➡️ Notifications, scroll to the bottom and open Webhooks.


Create the Webhook

Click Create webhook and fill in the form:

FieldValue
EventThe event this connector is for, e.g. Order creation
FormatJSON
URLThe Webhook URL from your connector
API versionThe latest version

Click Save.


Copy the Signing Secret

Below the webhook list, Shopify shows "Your webhooks will be signed with …". Copy that secret.

💡
Shopify uses one signing secret for all webhooks in your store. Every Shopify connector uses the same secret.

Verify the Connector

Paste the Secret and Click Verify

  • Back in Webtonative, paste the signing secret into Secret Code.

  • Tick Yes, I have created the webhook in Shopify and pasted its secret code here.

  • Click Verify. The connector is saved and the window shows Waiting for the test event.



Send a Test Webhook From Shopify

  • In Shopify admin, go back to Settings ➡️ Notifications ➡️ Webhooks.

  • Click ⋯ next to your webhook and choose Send test notification.

  • When Webtonative receives the test and the secret matches, the connector status changes to Active.

💡
You can close this window. The connector stays in the list as Pending verification and verifies automatically once the test event arrives. No notifications are sent until it's Active.


💡
One connector = one webhook. To send notifications for another event (for example, Order fulfillment), add a new connector and create another Shopify webhook with that connector's URL. Use the same signing secret.

Create the Notification Template

After the connector is verified, the Create a Template window opens. You can also open it later from the ⋯ menu on the connector row ➡️ Edit Template.

Connector Name

This is filled in for you and can't be changed here.


Title

Enter a title for the notification.


Message

Enter the message. Click Available variables { } to insert values from the Shopify webhook.


Launch URL

(Optional) The page that opens when the user taps the notification. It can be a fixed URL, like https://yourstore.com/orders, or a variable.


Preview & Save

Check the phone preview, then click Save Template.


Using variables

Insert values from the Shopify webhook with {{field}}. Open Available variables in the template to pick one.

VariableValue From ShopifyExample
{{id}}Order ID5501234567890
{{name}}Order number#1001
{{total_price}}Order total1499.00
{{currency}}CurrencyINR
{{financial_status}}Payment statuspaid
{{customer.id}}Customer ID7012345678901
{{customer.first_name}}Customer first nameAsha
{{order_status_url}}Customer order status pagehttps://…

Example

  • Title: Order received

  • Message: Hi {{customer.first_name}}, your order {{name}} of {{currency}} {{total_price}} is confirmed.

  • Launch URL: {{order_status_url}}

Manage Your Connectors

Connector status


Pending verification

Created but not verified yet. No notifications are sent.

Active

Verified and sending notifications.

Paused

Turned off with the Enabled toggle. Webhooks are received, but nothing is sent.


Row actions

Open the ⋯ menu on a connector row:

  • Analytics: Events Received, Notification Sent, Notification Skipped and CTR for this connector.

  • Edit Template: change the title, message or Launch URL.

  • Delete: remove the connector. Also delete its webhook in Shopify.

Use the Enabled toggle to pause or resume a connector.

Notes

  • Notifications are sent only to customers who are logged in on the app at least once with the script installed.

  • The customer ID in the webhook (customer.id) must match the ID linked by the script. This works automatically with the script above.

Frequently Asked Questions

1. My connector stays in Pending verification. What should I do?

Click Verify first, then send the test notification from Shopify (⋯ ➡️ Send test notification). Copy the signing secret again from Settings ➡️ Notifications ➡️ Webhooks and paste it without extra spaces. Make sure the webhook URL in Shopify is exactly the one from your connector.

2. Why do I see the "You don't have any users yet" banner?

Add the user sync script to layout/theme.liquid, then log in on the app once so the customer is linked to the device.

3. I see "setExternalUserId is not a function". What does it mean?

An older Webtonative SDK is loaded on the page. Use version 1.1.23 or later and remove older script tags.

4. Why does Notification Skipped keep increasing?

The order was a guest checkout, so there is no customer to send it to. Or the customer hasn't opened the app while logged in, so their device isn't linked yet. Or the connector is Paused, or it has no template.

5. Why does a customer still receive notifications after logging out?

The customer logged out from Shopify's hosted account page, where the theme script doesn't run. They're unlinked the next time they tap the store's logout link, or replaced when another customer logs in on the device.