Push notifications

Tell customers on their phone when their video call is booked and when the agent is ready.

Push is optional. Without it, customers are told about their video call by email and SMS as usual. With it, the phone they applied on is told too, and a tap opens the call in your app.

1. Lend your Firebase project

A notification to your app can only be sent through your own Firebase project, so PayMedia sends it with a service account you provide. In the Firebase console, open Project settings › Service accounts and generate a private key. In Institution Admin, under Settings › Mobile SDK › Video call push, upload that file for the environment.

2. Android

Hand the SDK your registration token, and offer it every message first. The SDK shows its own notification for its messages and tells you so; leave those alone.

Kotlin
class BankMessagingService : FirebaseMessagingService() {

    override fun onNewToken(token: String) {
        PayMediaEKYC.registerPushToken(token)
    }

    override fun onMessageReceived(message: RemoteMessage) {
        if (PayMediaEKYC.handlePushMessage(this, message.data)) return
        // Your own messages.
    }
}

// Once at start-up, after initialize:
FirebaseMessaging.getInstance().token.addOnSuccessListener(PayMediaEKYC::registerPushToken)

On Android 13 and later, ask for the notification permission (`POST_NOTIFICATIONS`) as you do for your own notifications; without it the call is still announced by email and SMS.

3. iOS

Set up Firebase Cloud Messaging with your APNs key as for any Firebase app, then hand the SDK the token and the taps.

Swift
func messaging(_ messaging: Messaging, didReceiveRegistrationToken fcmToken: String?) {
    if let fcmToken { PayMediaEKYC.registerPushToken(fcmToken) }
}

func userNotificationCenter(
    _ center: UNUserNotificationCenter,
    willPresent notification: UNNotification,
    withCompletionHandler completionHandler: @escaping (UNNotificationPresentationOptions) -> Void
) {
    let isCall = PayMediaEKYC.isPayMediaNotification(notification.request.content.userInfo)
    completionHandler(isCall ? [.banner, .sound] : [])
}

func userNotificationCenter(
    _ center: UNUserNotificationCenter,
    didReceive response: UNNotificationResponse,
    withCompletionHandler completionHandler: @escaping () -> Void
) {
    let userInfo = response.notification.request.content.userInfo
    if let root = window?.rootViewController {
        PayMediaEKYC.handleNotificationResponse(userInfo, from: root)
    }
    completionHandler()
}

When customers are told

MomentWhat the notification saysA tap
A call is bookedThe booked timeOpens the waiting room
A call is movedThe new timeOpens the waiting room
Before the callA reminder of the timeOpens the waiting room
The agent is readyThat the agent is waitingOpens the call
A call is missed or cancelledWhat happenedOpens your app

A device is registered once the customer's application exists, so a customer is told on the phone they applied on. A notification opens a call only on your journey host.