Custom Connector
The Custom Connector sends automatic push notifications to your app users from any platform or backend: your own server, Laravel, Node.js, Magento, or anything that can send an HTTP request.
Your backend sends JSON to the connector's Webhook URL with its secret in the x-webtonative-secret header, and Webtonative turns it into a push notification for the right user.
Where to Find It In Your Dashboard
My Apps ➡️ Edit your app ➡️ Push Notification ➡️ Webhook Connector ➡️ Custom
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 JavaScript library is added to your website (see Add the Webtonative JavaScript Library below).
How It Works
1. Link users to devices
Your website calls WTN.Notification.setExternalUserId() with your user's ID when they log in, and removeExternalUserId() when they log out.
2. Your backend sends a webhook
When the event happens, your server sends JSON to the connector's Webhook URL, with the Secret Code in the x-webtonative-secret header.
3. Webtonative sends the notification
Webtonative reads the user ID from the payload, using the path you set when creating the connector, and sends your notification to every device linked to that user.
Add the Webtonative JavaScript Library
Link Your Users to Their Devices
Link each logged-in user to their device from your website, using the Webtonative Notification functions. For the code examples (Plain JavaScript and npm): View docs (opens in a new tab)
On Login: setExternalUserId
Call setExternalUserId with your user's ID after they sign in, and on page load while they're signed in. Pass the ID as a non-empty string, for example "u123".
| Result | What It Means |
|---|---|
Resolves with success: true | The request completed and the device is linked to this user. |
Resolves with success: false | The request failed or the app couldn't communicate. Nothing was linked. Try again later, for example on the next app open. This also happens if the ID contains only spaces. |
Rejects with "id is required" | No ID or an empty string "" was passed. Nothing is sent. |
Rejects with "This function will work in Native App Powered By Webtonative" | The page isn't running inside your Webtonative app. |
On Logout: removeExternalUserId
Call removeExternalUserId when the user logs out. It takes no parameters and unlinks the user from the device. Handle your own logout and redirect as usual.
It always resolves with success: true, whether or not a user ID was linked.
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 Connector (Step 1 of 2)
-
Click + Connect Webhook (or + Add Connector if you already have connectors).
-
Select Custom and click Continue.
-
Enter a Connector Name, for example
Order created. -
Copy the Webhook URL and the Secret Code. Your backend sends to the URL, with the Secret Code in the
x-webtonative-secretheader. -
Click Verify.

Send One Test Request
The window shows Waiting for the test event. Send one test request from your backend to the Webhook URL, with the x-webtonative-secret header (see Send Webhooks From Your Backend). When the request arrives with the correct secret, the connector is verified.
Add External ID (Step 2 of 2)
Tell Webtonative where the user ID is in your payload, using {{path}} with dots for nested fields.
- In External User ID, enter the path, for example
{{customer.id}}. Or click Pick from test event{ }to choose the field from the test request you sent.

- Check the value shown under the field, then click Save & Create Template. The template window opens next.

| Your Payload | External User ID |
|---|---|
{ "user_id": "42" } | {{user_id}} |
{ "customer": { "id": "42" } } | {{customer.id}} |
{ "order": { "customer": { "id": "42" } } } | {{order.customer.id}} |
Send Webhooks From Your Backend
Request format
| Part | Value |
|---|---|
| Method | POST |
| URL | Your connector's Webhook URL |
| Content-Type | application/json |
x-webtonative-secret | Your connector's Secret Code, copied from the Add Connector page |
x-webtonative-event | Optional. A name for the event, e.g. order.created |
x-webtonative-event-id | Optional. A unique ID for this event. If the same ID is sent again, no duplicate notification is sent. |
| Body | Your JSON payload. It must include the user ID at the path you set. |
Responses
If the x-webtonative-secret header is missing or doesn't match the connector's Secret Code, the request is rejected and nothing is sent:
{
"isSuccess": false,
"error": "Invalid signature"
}When the secret is correct, the webhook is accepted and the notification is sent, or skipped if no linked user matches (see the connector's Analytics).
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 your 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
Use any field from your payload with the same {{path}} syntax. For example, if your payload is {"customer":{"id":"42","first_name":"Asha"},"order":{"number":"#1001","total":"1499.00","status":"paid"}}:
-
Title: Order
{{order.number}}confirmed -
Message: Hi
{{customer.first_name}}, your order total is{{order.total}}.
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.
-
Edit External ID: change the path where the user ID is read from.
-
Delete: remove the connector. Its webhook URL stops working.
Use the Enabled toggle to pause or resume a connector.
Notes
-
Always send the user ID as the same string value you pass to
setExternalUserId(). -
removeExternalUserId()only unlinks the user from the device. It doesn't log the user out or refresh any page; your website handles logout and any redirect. -
To switch to another user, call
setExternalUserId()with the new ID.
Frequently Asked Questions
1. Verification failed or I get "Invalid signature". What should I check?
Send the Secret Code in the x-webtonative-secret header, exactly as copied from the Add Connector page (no extra spaces). Make sure you're sending to this connector's Webhook URL. Each connector has its own URL and secret.
2. Why do I see the "You don't have any users yet" banner?
Call setExternalUserId() on login and open the site inside the app once.
3. Why does Notification Skipped keep increasing?
The user ID path is missing or empty in the payload. Or the user hasn't opened the app while logged in, so their device isn't linked yet. Or the ID in the payload doesn't match the ID passed to setExternalUserId(). Or the connector is Paused, or it has no template.
4. setExternalUserId rejects with "This function will work in Native App Powered By Webtonative". Why?
The page isn't running inside the Webtonative app. Only call it inside the app.
