If you have already integrated the Chat SDK or planning to add the SDK to your native mobile app, you have the option to have push notifications to notify the visitor when the app is in the background.
The push notifications are handled by us server side, you will need to provide the Firebase Cloud Messaging server key for Android and a combined PEM file for iOS APN support.
To add the server key and PEM file for your app, go to the Account settings section in the Chat Dashboard and select the 'API & SDKs' tab. You should see the 'Mobile SDK' section:
Once you have saved the FCM key/PEM file in the Chat dashboard, you will then need to make some minimal changes to your app code for registering and receiving push notifications.
Note: Push notification support is only available to all paying Chat customers. Customers on the Lite plan will not get push notification support.
To get the FCM server key for your app in Firebase, please follow these instructions:
1. In Firebase, click on the project/app and go to Settings
2. Click on the tab called 'Cloud Messaging'
3. Copy the server key listed or add a server key and paste it in the 'Android' field under the 'Mobile SDK' section in the Chat dashboard.
4. Click the 'Save Changes' button at the bottom of the page
Now that you have added the server key to the account, you can focus on the required app changes to support push notifications. You can learn more about the work required here.
Note: If your app is targeting Android O and above, please ensure the app properly handles the notification channel for these push notifications.
Generating Combined PEM File
To generate the combined PEM file, export the APNS SSL certificate and the private key from Keychain Access on your Mac computer.
Important: When exporting, do not enter a password when asked about protecting the export.
If you do not know how to combine the certificate PEM and server key PEM together, use the following command in Terminal:
cat PushAppCert.pem PushAppKey.pem > PushAppCertAndKey.pem
Then, test the combined PEM file against the sandbox Apple server using the following command:
telnet gateway.sandbox.push.apple.com 2195
Finally, test the connection using the SSL certificate and private key to set up a secure connection:
openssl s_client -connect gateway.sandbox.push.apple.com:2195 -cert PushChatCert.pem -key PushChatKey.pem
Uploading Combined PEM File to Chat Account
If the connection is successful, the combined PEM file is ready to upload to your Chat account by following these instructions:
1. In the Chat Dashboard, go to the Account settings section and click on the 'API & SDK' tab. Under the 'Mobile SDK' section, click on the "Select PEM file' button.
2. Upload the newly created combined PEM file.
3. If the PEM file is validated to be in the correct format, click on the 'Save Changes' button at the bottom of the page.
Note: Please ensure that you use the proper certificate and key in the PEM file for the profile you are using. A mistake some customers have done is use a combined PEM file for staging in the production profile of the app.
Required App Changes
Once the PEM file is uploaded to the account successfully, you will need to make changes to the app codebase itself. To learn more about the changes required, please click here.