Giter Site home page Giter Site logo

firebridge's Introduction

FireBridge

FireBridge is a simple JavaScript library that facilitates sending push notifications using Firebase Cloud Messaging (FCM) API. It provides a straightforward API endpoint to send FCM messages with ease.

Installation

To use FireBridge in your project, follow these steps:

  1. Clone the repository or download the source code.
  2. Place your Firebase Admin SDK JSON file in the root directory of the project.
  3. Install dependencies by running npm install or yarn install.

Usage

To send an FCM message, make a POST request to the /api/sendFcmMessage endpoint with the following payload:

{
  "title": "Notification Title",
  "body": "Notification Body",
  "link": "Optional Link URL"
}

Example:

const axios = require('axios');

axios.post('http://localhost:3000/api/sendFcmMessage', {
  title: 'Hello World',
  body: 'This is a test notification',
  link: 'https://example.com'
})
.then(response => {
  console.log(response.data);
})
.catch(error => {
  console.error(error);
});

API

POST /api/sendFcmMessage

Send an FCM message with the provided title, body, and an optional link.

Request Body

  • title (string): Title of the notification.
  • body (string): Body content of the notification.
  • link (string, optional): Link URL to be included in the notification.

Response

  • Status Code: 200 OK
  • Body:
    {
      "message": "FCM message sent successfully!",
      "RetVal": true
    }

Contributing

Contributions are welcome! Feel free to open an issue or submit a pull request.

License

This project is licensed under the MIT License - see the LICENSE file for details.

firebridge's People

Contributors

mohammadtafakori01 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.