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 an SFCC object
First, you need to create an 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
💡 In case the steps described above do not apply for you, here is a link where you can find other options: https://help.salesforce.com/s/articleView?id=000391650&type=1.
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?
This article belongs to Batch's FAQ. Need more help? Find insightful articles, documentation, case & market studies, guides, and even more in our website's Resources section on batch.com and our blog.