Basic web push integration relies on two parts: adding a JavaScript tag to the pages of your website, and uploading Batch's Service Worker to the root of your website.

If you are using SalesForce Commerce Cloud (SFCC) as a CRM for your website, you won't have access to the root of your website to upload Batch's Service Worker.

Here are the necessary steps to complete the web push integration with SFCC:

1. Add the Service Worker

Step 1. Create a SFCC object

First, you need to create a SFCC object with the type « Content Asset » (for example "ServiceWorker-GetFile").

Then add the JavaScript content of the service worker (batchsdk-worker-loader.js) to the body of this object.

Step 2. Create an alias of the route to the Service Worker

Create an entry in "Business Manager" → "Merchant Tools" → "SEO" → "Aliases".

This entry must route "/batchsdk-worker-loader.js" to the Content Asset created in Step 1 (e.g. "ServiceWorker-GetFile"):

{   ...
"your-host" : \[
...,
{
"if-site-path": "/batchsdk-worker-loader.js",
"pipeline": "ServiceWorker-GetFile"
}
\]
}

The service worker should now be available here: https://mywebsite.com/batchsdk-worker-loader.js

2. Add the JavaScript tag and test your integration

Once the Service Worker is added, you can complete the integration by following this guide: How can I integrate web push into my website.

Did this answer your question?