Apple Safari
If you want to configure Web Push to Safari browser, you must have the Developer extension in your Apple account. |
All actions are performed on a macOS X device:
Sending push notifications to PWA
In iOS 16.4+ versions, Apple has introduced support for push notifications from PWA.
PWA (Progressive Web App) is a technology that allows you to install a website on smartphones or computers as an application. Unlike traditional app downloads from app stores, users can simply visit the website and add an icon to their device's home screen. PWA applications offer native-like functionality, including offline mode, data caching, and the ability to receive push notifications.
To send push notifications to PWA's users, you need to configure the APNS provider for Safari within the resource settings. Once the settings are saved, the PWA provider will be automatically enabled.
Please note that the subscription ID for PWA push notifications is attached to a specific resource. If you transfer subscriptions from one resource to another, they will stop working.
Step 1. Register a new identifier
1.Open Certificates, Identifiers & Profiles and log into your Apple developer account.
2. On the left navigation bar, select the "Identifiers" tab and click + next to the "Identifiers" heading.
3. In the new window choose **Website Push IDs.**It lets you send push notifications from your website to macOS.
4. Enter Description and Identifier.
ID
should be entered in such a format: web.com.domainname.appname
.
Important! The first part is always web
, there can be as many parts as you like. It is welcomed to use the reverse domain style: "web.org.example.push"
.
5. Click Continue, then Register.
So, you have created and registered a Website Push ID. Now you can check information about this ID on the Identifiers tab at any time.
To see identifiers for sending push notifications from websites, do not forget to open the drop-down list in the right corner by clicking on App IDs and select Website Push IDs.
Step 2. Create Certificate
1. Each identifier need a certificate. To create it, in the list find Web Push ID you've just created and click it.
2. Pay attention to the Identifier field. The information in it will be needed to configure the resource for sending Web push notifications on the Altcraft platform — when you'll be filling in the Website Push ID field.
3. Click Create Certificate .
4. Now it's time to generate the certificate. You need Certificate Signing Request (CSR) (the request format is ".certSigningRequest").
To make the request, click Learn more.
5. You'll be taken to a new page. Follow the instructions on it.
6. When you create the Certificate Signing Request, go back to the previous page. Click Choose File and in the new window select the CSR you created.
Then click Continue.
Step 3. Save the certificate
1. On the next tab, download the Certificate to your Mac by clicking the Download button. The file will be saved in ".cer" format.
2. Find it on your device and double-click it. This will install the**.cer file** into KeyChains.
3. Now find the installed certificate in KeyChains, right-click on it and export it to disk in .p12 format.
4. During the export process, you will be asked to enter a Password. The same password will later be required to set up push notifications on the Altcraft platform. Remember it!
Step 4. Configure our resource in the Altcraft platform
Let's go back to the Altcraft platform — to the settings of the resource for sending Web push notifications.
1. Choose Safari platform. Activate Apple Safari service.
2. Fill in fields:
-
Website Push ID — identifier in your Apple Developer account. You can find this value in the "Identifier" field of your Apple Developer account.
-
Website Client SSL Certificate — the .p12 certificate file. This certificate is exported from Keychain Access on your Mac device.
-
Website Client SSL Certificate пароль — the password used when exporting the .p12 certificate.
-
API token — a platform token that enables APNS to send subscription requests to the platform. You can generate this token in the Settings → Tokens section. If the token is deleted, the platform will no longer accept subscription requests from Safari for this resource.
-
Icon — an image that will be displayed in the push notification. It helps users identify the source of the notification. The format is png, The recommended size is 256x256 or larger. Note that Safari supports only one icon per resource (website).
The next step is Implementing Web push.