EngineeringProduct

Approach on building the notification

Notification Bar

Context:

For our product iseenowlive.com we had an requirement to send notification to the person who has raised a Streaming request once the request has been acknowledged and accepted. Now the problem is we don’t want to bother the requestor with too much information. He need to just know the following 5 things:

a. Whether my request is accepted ?
b. Which request was accepted ?
c. When it was accepted ?
d. Who has accepted it ?
e. What is the current status of the request ?

So we framed it like “Your video streaming request ID#123 has been accepted by Mr. John on 12th November 2020 at 10:00 AM (JOB#123). Streaming is yet to start, we will notify you when its live”.

All is well, how do we achieve this technically. Our architecture landscape is built on AWS Serverless Backend and Android Native Mobile Client.

Key challenges:
1. Whenever the user changes devices the device token has to be obtained so that specific messages to the specific device can be sent.
2. Notification is to be sent through Firebase Cloud Messaging using HTTPS interface
3. We don’t want the mobile client to send the FCM message as it could be unreliable and could be erroneous depending on connectivity.
4. We wanted to send the notification only after the Job has been created after the request is accepted.
5. Need to send the notification as soon as the Job is created chained after the Create Job Mutation through GraphQL.

Solution:
We adopted the AWS AppSync Pipeline resolver where in the First Job Function would be is to complete the Job creation mutation. Once its done based on the response context obtained from the mutation that would be passed on to the Notification Topic. The Notification topic is subscribed with the help of Lambda function which would get triggered upon any message.

Once the event is recognized in the lambda function it fetches the appropriate requestor device token and the adopts appropriate messaging template based on the action and then forms the JSON body for injection to HTTPS. HTTPS securely called with API key with FCM to send the message to the device as Notification appropriately.

Finally the outcome:

www.iseenowlive.com

Leave a Reply

Your email address will not be published. Required fields are marked *