How to add Push Notifications to a Webflow Site
Webflow (as you probably know) is an amazing solution that can help you build a website without coding skills. While navigating through their blog one day, we noticed that a lot of people were looking for a way to integrate web push notifications into their Webflow site.
Most push notifications solutions require that you upload a Javascript (.JS) file — this file serves as the service worker, which is essential for push notifications to work. The free Webflow plan doesn't currently allow custom code uploads of this kind, so you'll need a Webflow Site plan, Account plan, or Enterprise plan in order to get started.
In this how-to guide, we’ll show you how to add push notifications into your Webflow site using OneSignal. The good news is, you can create a OneSignal account and send unlimited push notifications for free.
Guide Overview:
- Step 1: Set up Your Webflow Site
- Step 2: Set up Your OneSignal Account
- Web Push Configuration
- Step 3: Integrate OneSignal into Webflow
- Step 4: Testing Time!
- Recap
Step 1: Set up Your Webflow Site
If you haven’t done so already, create your Webflow site and choose your preferred plan type. If you currently have a free Webflow account, upgrade to the plan that best fits your budget and goals in order to unlock custom coding options.
After you’ve created your site in Webflow, copy your site URL. In our example, our site URL is: https://signalaiml-webpush-devrel.webflow.io/
Step 2: Set up Your OneSignal Account
- If you don't have on already, create a free OneSignal account. When you first log in, you will be prompted to set up a new app or website.
- To get started, insert the name of your website and select Web Push as your chosen platform.
Web Push Configuration
- In section 1. Choose Integration, select Typical Site.
- Under 2. Site Setup, enter your web configuration. Our configuration is shown in the image below. Paste the Webflow URL you previously copied into the section entitled SITE URL.
- Make sure you select My site is not fully HTTPS and input a custom label. This is the main trick to get push notifications from OneSignal to work on a Webflow site.
- In section 3. Permission Prompt Setup, you should see a blue button to configure the HTTP Pop-up setup. This pop-up is an iFrame that will act as a mirror of your page that will allow you to receive notifications on your Webflow website.
- After clicking on the blue button, a window will appear where you can modify the configuration of your pop-up. For this example, we left the automatic placeholder text in place, but you can change the text of your pop-up to better fit your website UX. Click Done in the bottom right corner of the window when you’ve finished making changes.
- Finally, scroll down to the bottom of the page and click Save.
- In the final setup step, you will see a grey COPY CODE button — click this button to copy the code.
Step 3: Integrate OneSignal into Webflow
Now it’s time to integrate OneSignal into your Webflow site.
- Return to your Webflow dashboard. You should see all the projects you’ve created under your Webflow account. Select the site you’d like to add push notifications to by clicking on the three dots next to the project name, then select Settings from the drop-down menu that appears.
- In the settings menu for this Webflow project, click on Custom Code on the far right of the navigation bar.
- Under the Add Custom HTML & CSS > Head Code section in this tab, paste the code you previously copied from your OneSignal account. If you haven’t copied anything else since completing the Web Push Configuration step, the code snippet should be in your clipboard. If you need to, you can go back to your OneSignal project settings and re-copy the code.
- After pasting the code into the appropriate box, click on the green Save Changes button.
Step 4: Testing Time!
Push notifications require user opt-in permission. In order to preview your notifications, you’ll first need to subscribe to notification on your site.
- Navigate to your Webflow site in your browser and click allow in the permission prompt that appears.
You’ve successfully integrated OneSignal with your Webflow account! Now, you can create and send custom messages from your OneSignal account and they will appear to subscribers on your website. As you build your subscriber list, you can hone your messaging strategy by sending custom notifications to specific audience segments.
If you don’t know how to send a push notification using OneSignal, follow these instructions to send your first notification.
Recap
This setup process is a breeze as long as you remember two key things:
- You must have a paid Webflow account in order to add notifications to your website.
- As you complete Web Push Configuration on your OneSignal account, make sure you select the option My site is not fully HTTPS and add a custom label. This is the main trick to get push notifications from OneSignal to work inside of a Webflow site.
Still have questions? We've got answers. Reach out to us at support@signalaiml.com.
Want to share your feedback and test out new features before they're released? Join our developer community to take advantage of these benefits and more.
Join our Developer Community