Inspiration

We all use mobiles everyday for our day-to-day activities. We almost get notified by every application that is available in our mobile. The interesting thing is, some applications will send images too along with text message in notifications. After spending all these days watching every notification from every application in our mobiles, we thought it will be great to have this feature for Pega Mobile applications too. In Pega, we know that there is a feature that provide us the flexibility to push notifications to Mobile users. But the major drawback was, there is no option to send a notification with an image in it. That is where this component steps in.

Problem Statement

When it comes to Push notifications PEGA PLATFORM has a restriction that we can only send text messages to mobile users. But we usually see most of the mobile applications like Flipkart, Amazon, Twitter will send text messages with images as notifications. This will be an Enhanced version of the existing PEGA PLATFORM push notification with payload as image along with the text.

What it does

With the help of this enhancement, the system can notify mobile users in real-time with images as per the configuration. Let us consider, you have an item ordered from the mobile application. You will be very excited to know the state of the order and keeps on checking your mobile. Instead of just sending a text message like "Your order is shipped". User will be more connected if we send an image that highlights the state it is in along with the pending stages it has to go through before getting delivered. This can also be used when we submit a request in Pega and waiting for the series of approvals to be completed before getting resolved. Here we can show the stages of the request that got processed in a color highlighted, by leaving pending stages.

How we built it

We have used the Firebase service for sending notifications to the users of mobile applications. In order to use this Integration, we need to have the device token of the user for sending notifications to the respective device. This token will be refreshed based on our configuration in the Mobile interface.

The token can be found in the PEGA Platform since this application is developed in Pega. But, In general, we need to get that from android studio if our app was built on android studio by running a snippet of code in java/kotlin.

This token is stored in a property of class "Data-Mobile-GCMToken". We have accessed it by creating a report in the respective class.

After getting all the required values, we created a CONNECT-REST integration for sending the notification.

Design and Architecture

We have used Firebase, which is providing the REST integration for android users to send the custom payload as a push notification.

Method POST End Point https://fcm.googleapis.com/v1/projects/myproject-b5ae1/messages:send HTTP/1.1

JSON PAYLOAD

Content-Type: "application/json"

Authorization: "key=Your FCM Token from Firebase"

Request JSON
{
  "notification": {
    "body": "Body of Your Notification",
    "title": "Title of Your Notification",
    "image": "https://firebase.google.com/docs/cloud-messaging/images/Image_Notification_v2.png"
  },
  "to": "Device Token"
}

Alt text

Challenges we ran into

We have searched a long way to find where the device token is stored and there is no proper reference to access it in Pega. Also tried to customize the OOTB functions which are used to send the notification. But we were unable to do that.

Since apple is not an open source to work upon, there were few constraints for IOS devices. So, we have implemented this only for Android mobile applications.

Accomplishments that we're proud of

We were able to successfully send a notification with an image and a text message to Pega Mobile users.

What we learned

As this is implemented in mobile, we have gone through all the features related to Pega Mobile starting from generating a certificate to designing a fully functional Mobile application with online and offline capabilities well balanced. We also learned that we can do many things which we never thought that can be implemented using the Pega Platform.

What's next for Notify..!

We will be primarily focusing on the implementation of this component for IOS devices. And we will try to enhance this furthermore to fit for all the domains. We wish to release this as a component in Pega Marketplace after further enhancements.

RESEARCH & ACKNOWLEGMENT

https://firebase.google.com/docs/cloud-messaging/android/send-image https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages/send https://firebase.google.com/docs/cloud-messaging/http-server-ref https://firebase.google.com/docs/reference/fcm/rest/v1/projects.messages#Notification

Built With

Share this project:

Updates