Created FCM Push for Tester in Heroku

by Start Bootstrap

Posted on Nov 01, 2017

While testing the FCM for Hybrid apps, i depend on some 3rd party to testing it, I thought to create it on my own, and here's it on Heroku !

If you need the code, go get here on Github

I am saving a bit of code here in order to save !

var serverKey = req.body.key;
        var fcm = new FCM(serverKey);
        var message = {
            collapse_key: 'your_collapse_key',
            data: {
                key: req.body.title
            notification: {
                title: req.body.title,
                body: req.body.body

        //callback style
        fcm.send(message, function(err, response) {
            if (err) {
                    "success": "0",
                    "message": err
            } else {
                    "success": "1",
                    "message": response

And the client part will be 


$(document).ready(function() {
$("#sendPush").click(function() {
var url = window.location.href + '/';
var key = $("#key").val();
var to = $("#fcm_token").val();
var title = $("#title").val();
var body = $("#body").val();
$.post("sendPush", { key: key, to: to, title: title, body: body })
.done(function(data) {
alert("Pls check console for now !!");

There you go ! 

Side Widget
You can put anything you want inside of these side widgets. They are easy to use, and feature the new Bootstrap 4 card containers!