DID THIS ARTICLE SOLVE YOUR ISSUE?
Let us know so we can improve!
Let us know so we can improve!
Marketing Cloud Personalization supports Push Notification campaigns for iOS apps using:
For Personalization Push Notification campaigns to work on your iOS apps, you need to generate APNs certificates and configure Personalization to use those certificates.
.p12 as the File Format.To upload the APNs certificate and private key .p12 file to Personalization, do the following.
.p12 file (if any) in the appropriate fields.If you’re using Personalization to send push notifications to your app via FCM, you’ll need to provide an FCM private key JSON file. To obtain your FCM private key JSON file and then add it to Personalization, do the following.
Open your Firebase Cloud Messaging console for your app.
Navigate to Project Overview > Project settings > Cloud Messaging.
Click Manage Service Accounts.
Click + CREATE SERVICE ACCOUNT.
The default service account is assigned the Firebase Admin SDK Administrator Service Agent role that provides more access than necessary. To limit access and enhance security, we recommend creating a service account with only the Firebase Cloud Messaging API Admin role.
Note
Provide appropriate values for Service account name, Service account ID, and Service account description.
Click CREATE AND CONTINUE.
Under Select a role, search for and select the Firebase Cloud Messaging API Admin role. This role includes the cloudmessaging.messages.create permission, which is the only “write” permission required.
Click CONTINUE.
Optionally, grant users access to this service account.
Click DONE.
Under the Actions column for the newly-created service account, click Manage keys.
Click ADD KEY > Create new key.
Select JSON as the Key type and click CREATE. The private key JSON file is now saved to our computer. Ensure that you’ve stored the files appropriately and click CLOSE.
Log in to the Personalization UI and select the Dataset.
From the left-hand menu, click Mobile > your app > Mobile Push Setup.
Under Firebase Cloud Messaging (FCM), upload your private key JSON file.
Click Save.
Additionally, you’ll need to provide your APNs certificate to Firebase. For guidance, see Set up a Firebase Cloud Messaging client app on Apple platforms.
If you’ve provided credentials for both APNs and Firebase, you must pick which one to use when the app is next added to any push notification campaign. Personalization will only send notifications through one channel to prevent duplicating notifications.
Important
To set up your app to use APNs and Firebase Cloud Messaging, do the following.
Set up the app to use APNs
Enable the Push Notifications capability and register your app with APNs, as described in Apple’s User Notifications documentation.
Prompt users for desired notification settings using the requestAuthorizationWithOptions:completionHandler: method.
This permission is required for Personalization to accept push tokens via [Evergage(Swizzling) setAPNSToken:] and [Evergage(Swizzling) setFirebaseToken:]. During the first app launch, the user hasn’t yet granted permission. Hence, it’s likely that token callbacks and rejections occur before the user accepts the permissions. Therefore, if obtaining push tokens as soon as possible is critical for you rather than waiting until the next app launch, ensure that token callbacks are retriggered in this completionHandler, or set directly.
[Evergage(Swizzling) setAPNSToken:] via another call to registerForRemoteNotifications on UIApplication.[Evergage(Swizzling) setFirebaseToken:] with the current token obtained from Firebase Cloud Messaging’s FCMToken property.If your app uses Firebase Cloud Messaging, refer to Set up a Firebase Cloud Messaging client app on Apple platforms for set up instructions.
Ensure that you configure Firebase and set the Messaging delegate before starting Personalization. For startup example code, refer to the Evergage class documentation.
Important
To allow the collecting and sending of users’ APNS or Firebase tokens to Personalization, your app must opt-in to Personalization push notification campaigns. For more information, see [EVGClientConfigurationBuilder usePushNotifications]. For example code, refer to the Evergage class documentation.
Your app should define the callbacks that receive tokens so that Personalization can also start listening. For more information, see [Evergage(Swizzling) setAPNSToken:] and [Evergage(Swizzling) setFirebaseToken:].
Your app should also define the callbacks that receive notifications. For more information, see [Evergage(Swizzling) handleNotification:actionIdentifier:].
Additional Details
[Evergage userId].UNNotificationCenterDelegate, and you decide to render custom UI to the user, see [EVGContext trackClickthrough:actionIdentifier:].