For the complete documentation index, see llms.txt. This page is also available as Markdown.

Wordpress Connector

Send automatic push notifications to your app users when something happens in your WooCommerce store, like a new order, an order update or a new coupon.

This guide connects your WooCommerce store to WebToNative with a webhook, and links each logged-in WordPress user to their device so every notification reaches the right person.

Platform support: Android and iOS.

Before you start:

  • Your plan must include WebToNative Push.

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

  • The WebToNative WordPress plugin must be installed on your site. See the WordPress Plugin Guide.


How it works

  1. Link users to devices. The WebToNative plugin calls WTN.Notification.setExternalUserId() with the WordPress user ID when a user is logged in, and removeExternalUserId() when they log out.

  2. WooCommerce sends a webhook. When the event happens (for example, an order is created), WooCommerce sends the order data to your connector's webhook URL.

  3. WebToNative sends the notification. We read the user ID from the webhook (customer_id) and send your notification to every device linked to that user.


1. Enable User Sync in the plugin

Step 1: Open the Push Notification settings

  1. Log in to your WordPress admin dashboard.

  2. Go to webtonative > Push Notification.

Step 2: Turn on User Sync

  1. Tick Enable User Sync.

  2. Click Save Changes.

From now on, the logged-in WordPress user is linked to the device (WTN.Notification.setExternalUserId), and unlinked when they log out.

Users 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.


2. Create the connector in WebToNative

Step 1: Open Webhook Connector

  1. Log in to the WebToNative dashboard.

  2. Go to My Apps and select your app.

  3. In the sidebar, open Push Notification > Webhook Connector.

Step 2: Add a WordPress connector

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

  2. Select WordPress and click Continue.

3. Enter a **Connector Name**, for example `Order created`. 4. Copy the **Webhook URL** and the **Secret Code**. You'll paste both into WooCommerce in the next section.

Keep this window open. You'll come back to click Verify.

Need a new secret? Click Regenerate Secret above the Secret Code, and use the new one in WooCommerce.


3. Add the webhook in WooCommerce

Step 1: Open WooCommerce webhooks

  1. In WordPress admin, go to WooCommerce > Settings > Advanced > Webhooks.

  2. Click Add webhook.

Step 2: Fill in the webhook

Field
Value

Name

Any name, e.g. WebToNative - Order created

Status

Active

Topic

The event this connector is for, e.g. Order created

Delivery URL

The Webhook URL from your connector

Secret

The Secret Code from your connector

API Version

WP REST API Integration v3

Click Save webhook.

Don't leave the Secret field empty. If it's empty, WooCommerce creates its own secret and WebToNative can't verify the webhook.


4. Verify the connector

Step 1: Click Verify

  1. Back in WebToNative, tick Yes, I have saved the webhook in WooCommerce with this URL and secret code.

  2. Click Verify.

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

Step 2: Trigger the event in WooCommerce

WooCommerce has no test button, so trigger the event once. For example, place a test order for an Order created connector.

When WebToNative receives the event 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 event arrives. No notifications are sent until it's Active.

One connector = one webhook. To send notifications for another event (for example, Order updated), add a new connector in WebToNative and a new webhook in WooCommerce with that connector's URL and secret.


5. 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.

  1. Connector Name is filled in and can't be changed here.

  2. Enter a Title for the notification.

  3. Enter the Message. Click Available variables { } to insert values from the webhook.

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

  5. Check the phone preview, then click Save Template.

Using variables

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

Variable
Value from WooCommerce
Example

{{id}}

Order ID

1234

{{number}}

Order number

1234

{{status}}

Order status

processing

{{total}}

Order total

1499.00

{{currency}}

Currency

INR

{{customer_id}}

WordPress user ID

42

{{billing.first_name}}

Customer first name

Asha

Example:

  • Title: Order received

  • Message: Hi {{billing.first_name}}, your order #{{number}} of {{currency}} {{total}} is confirmed.


6. Manage your connectors

Connector status

Status
Meaning

Pending verification

Created, but no valid webhook received 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 WooCommerce.

Use the Enabled toggle to pause or resume a connector.


7. Troubleshooting

  • Connector stays Pending verification

    • Make sure the webhook's Status is Active in WooCommerce.

    • Check that the Delivery URL and Secret are exactly the ones from your connector.

    • Trigger the event once (for example, place a test order).

  • "You don't have any users yet" banner

    • Turn on Enable User Sync in webtonative > Push Notification.

    • Log in on the app once so the user is linked to the device.

  • Notification Skipped increases

    • The order was placed by a guest (customer_id is 0), so there is no user to send it to.

    • The user hasn't opened the app while logged in, so their device isn't linked yet.

    • The connector is Paused, or it has no template.

  • Users are not linked

    • Open the site inside the WebToNative app, not in a browser.

    • Check the browser console for errors related to WTN.Notification.


Notes:

  • Notifications are sent only to users who are logged in on the app at least once with Enable User Sync turned on.

  • The user ID in the webhook (customer_id) must match the WordPress user ID linked by the plugin. This works automatically when you use the plugin.

Last updated