Project with OneSignal push notifications. The goal is to see if OneSignal notifications can be triggered from deltaDNA.
- One Signal and deltaDNA SDK can co-exist on device.
- Messages can be scheduled in OneSignal and Sent by OneSignal
- Messages can be scheduled in deltaDNA and Sent by deltaDNA
The first step is to integrate One Signa and send a simple push notification.
- Created empty Unity 2018.4 project
- Created 'Apple Distribution' Certificate following Unity publishing for IOS Tutorial
- Unity - Switch Build Settings to IOS
- Downloaded P12 key (pwd N0tifyM3!)
- Created seperate Apple Push (Sandox and Production) Certificate followin One Signal Guide
- Downloaded P12 key (pwd N0tifyM3!)
- Imported One Signal SDK into Unity
- Added OneSignal example code and AppID
- Build and Run on device. Did register for IOS Push Notifications
210f4e739b73876b29e7554a358d694897841b902e22ef4e055ba388dcff8dfb
- Created new notification
- Received new notification
- Downloaded and imported deltaDNA Unity SDK v5.0.8
- Configured deltaDNA in Unity Editor, connecting it to OneSignal - Notification Test project
- Minimal code added to Start deltaDNA SDK and nothing more
- Built and run on device, events confirmed in Event Browser Tool for userID
1927ef91-92fd-4555-9095-e86916369f81
- deltaDNA SDK recognises that OneSignal has permission to send notifications and therefore sends a deltaDNA notificationServices event containing the same device token as is sent to OneSignal
- Loaded the push certificate, P12 private key and password into deltaDNA Manage Identity page. This is the same key as uploaded to One Signal
- Created a new notification in the deltaDNA Message Test tool and sent it.
- Confirmed that the notifiation from deltaDNA was received
NB: It is not necessary to call any of the DDNA notification configuration code on the client as One Signal is already registering for notifications
- Added custom event schema to deltaDNA event manager, to record OneSignal userID and Subscription status to deltaDNA at the start of each session
- Added code to fire the new event at the start of each session using the contents of
OneSignal.GetPermissionSubscriptionState().subscriptionStatus
public void RecordOneSignalStatusEvent(OSSubscriptionState subscriptionState)
{
if (subscriptionState != null)
{
GameEvent e = new GameEvent("oneSignalPermissionState")
.AddParam("oneSignalSubscribed", subscriptionState.subscribed)
.AddParam("oneSignalUserID", subscriptionState.userId);
DDNA.Instance.RecordEvent(e);
}
}
- Confirmed the event was being recorded correctly in the deltaDNA Event Browser
- Send deltaDNA userID to OneSignal, for later use as an external_user_id by OneSignal SDK and APIs
Initiate a message on deltaDNA and deliver through OneSignal.
Usecase : DeltaDNA data driven player selection sends WEBHOOK campaign content to OneSignal REST API which delivers message to player.
- Retrieve OneSignal API Key.
- Use REST API Create Notification method to send a test notificaton to player to check API parameters.
- Confirm REST API message delivered successfully
- Create a Webhook campaign action
*I'm running into problems here, due to the more complex objects the API requires
Attempted sends to OneSignal are returning with a communicationState =
FAIL
and communicationDetails ofMissing dynamic field value(s) for placeholder(s) included_player_ids, contents, subtitle