LogHive-Javascript-push-notifications-1536x878

Send push notifications from your JavaScript or Typescript Module

In this article, we’ll explain how to integrate push notifications and event logs in your JavaScript project. The LogHive REST API can be used to push events and errors to the LogHive service.

The LogHive npm package simplifies integration with the service. After downloading and installing the package via npm, you can use a few lines of code to push events to LogHive. For instance, to push a new event, you may use the following code:

Useage

Installation

npm install --save loghive

Import Libary

import { LogHive } from 'loghive';

Initialize Client

You can receive your API-Key here: API-Key.

const logging = new LogHive({ 
  key: 'your-personal-api-key',
  project: 'yourprojectname'
});

Publish Event

logging.addEvent({
    group: "yourgroupname",
    event: "your-event-name",
    description: "descripton",
    notify: true
});

By using the boolean value notification, you can activate push notifications for your mobile devices.

With just a few lines of code, you can begin receiving notifications for your application’s events and errors. Simply install the LogHive Android app or use the web application and enable notifications to receive push notifications.

Latest Posts