nodejs-mesosfer-integration

Mobile Push Notification from Embedded using NodeJS in Mesosfer

Mobile Push Notification from Embedded using NodeJS in Mesosfer

1. Introduction

This section will show you about how to send push notification from Embedded using NodeJS in Mesosfer Backend as a Service. Actually, push notification is not only sent from Mesosfer Backend, but you can also send push notification from your environment like Embedded Device or Web Application.

2. Prerequisites

To follow this tutorial, you should set up some prerequisites below:

3. Getting Started

You must have header authorization like AccessToken, ApplicationId, and ApplicationKey before post data to Mesosfer API. Login Mesosfer Backend then go to device, you will get DeviceToken. Use this token for authorization.

mobile-push-notification-from-embedded-using-nodejs-in-mesosfer-device-token

 And go to App Setting to get ApplicationId and ApplicationKey.

mobile-push-notification-from-embedded-using-nodejs-in-mesosfer-appkey

4. Install Node REST Client

You need to install library node-rest-client first in your project directory.

With this library you can use HTTP GET, POST, PUT, and DELETE in Mesosfer API.

5. Let’s Code!

Afer you have node_modules in your project directory. Now, create file with extension .js

mobile-push-notification-from-embedded-using-nodejs-in-mesosfer-create-file

Now, put code below in the file.

Please fill ACCESS_TOKEN, APP_ID, and APP_KEY based on your application in Mesosfer Backend. After that you can send push notification with command node.

If push sent successfully, you will get result below :

Make sure you check your mobile apps after push notification has been sent.

mobile-push-notification-from-embedded-using-nodejs-in-mesosfer-result-mobile

Everything is done! Download full version code here.

6. Conclusion

We have created sample code to send push notification from Mesosfer Bucket. Very simple and quick, isn’t it? You do not have to worry about GCM registration ids, sender ids, or API keys, All of them have been handled by Mesosfer. Mesosfer helps you connect your project to the cloud. Cut off the development process so you can straight into the delivery process instead stumble on the complicated infrastructure.

Having more than 5 years experience in IT Consultant with the last position as Backend as a Service Developer and has an experience in planning, implementing IT Information System.