Skip to content
Simple Spring Boot app with Firebase Cloud Messaging push notifications integration
Java
Branch: master
Clone or download
Latest commit 2e2fd1f Jun 6, 2019
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
.mvn/wrapper + Firebase Admin SDK integration Jun 4, 2019
src + Controller response refactor Jun 5, 2019
.gitignore + Firebase Admin SDK integration Jun 4, 2019
README.md Readme file updated Jun 6, 2019
mvnw + Firebase Admin SDK integration Jun 4, 2019
mvnw.cmd + Firebase Admin SDK integration Jun 4, 2019
pom.xml + Push notification service refactor Jun 5, 2019

README.md

Spring Boot + FCM - simple push notifications server-side application

alt text

This is simple Spring Boot application with Firebase Cloud Messaging integration.

Technologies

  • Spring Boot
  • Firebase Cloud Messaging

Configuration

  • Provide your own Firebase Admin SDK, JSON-formatted file (service account credentials) and place it inside the project (for example src/resources/google)
  • Change the path and defaults in application.properties

Endpoints

  • GET /notification – Trigger sample notification with default values sending

curl -H "Content-Type: application/json" -X GET http://localhost:8080/notification

  • POST /notification/topic – Send a message to a specific topic

curl -d '{"title":"Hello", "message":"The message...", "topic":"contactTopic"}' -H "Content-Type: application/json" -X POST http://localhost:8080/notification/topic

  • POST /notification/token – Send a message to a specific device (with token)

curl -d '{"title":"Hey you!", "message":"Watch out!", "token":"cct00ebz8eg:APA91bFcTkFE_0Qafj6nWv5yHxqCLTyxAaqi4QzwsFNLP5M9G78X8Z5UMZTW004q1PUux63Ut-1WMGVToMNTdB3ZfO8lCZlc4lGpxm7LBdWfkhaUxdbpQ5xIO5cAb-w9H2dBLNHT7i-U", "topic": ""}' -H "Content-Type: application/json" -X POST http://localhost:8080/notification/token

  • POST /notification/data – Send a message to a specific topic with additional payload data.

curl -d '{"title":"Hello", "message":"Data message", "topic":"contactTopic"}' -H "Content-Type: application/json" -X POST http://localhost:8080/notification/data

  • Success response

{ "status": 200, "message": "Notification has been sent." }

More information

You can’t perform that action at this time.