DEV Community

Mat
Mat

Posted on • Updated on • Originally published at cronusmonitoring.com

The easiest way to send mobile push notifications for developers

Today i will be showing the easiest way to send push notifications to yourself using Cronus Monitoring and Alerting.

We’ll be using the npm package cronus-alert to send an alert for an event. We’ll then receive this alert on our mobile device by using the Cronus Mobile App.

  1. Download the IOS App.

  2. Go to cronusmonitoring.com and create a free account.

  3. Go to the Devices page. Choose a device name and then click generate. This will produce a QR code that you can scan with your camera app. Ensure that once you have added your device, you enable alerts for it.

QR Code Description

  1. Go the API page and create an api key. We’ll use this to authenticate our requests to Cronus.

  2. Create a new folder and add an index.js file.

  3. Import the cronus-alert package

npm i cronus-alert
Enter fullscreen mode Exit fullscreen mode
  1. Lets create a simple function that when called will send an alert
import { CronusAlert, Status } from "cronus-alert"

function main() {
    console.log("Starting up test.")

    const APIKEY = "COPY FROM STEP 4."
    const cronusAlert = new CronusAlert(APIKEY);

    cronusAlert
    .FireAlert(
      "The system is down", // Summary
      "Someone forgot to lock the gate", // Description
      Status.Firing // Optional status
    )
    .then((resp) => {
      console.log(resp.data); // API response
    })
    .catch((err) => {
      console.error(err); // network error
    });
}

main()
Enter fullscreen mode Exit fullscreen mode
  1. Run the file and you’ll see the alert appear on your device.
bun run index.ts
Enter fullscreen mode Exit fullscreen mode
  1. Congrats. You have the integration configured. You can send up to 1000 alerts a month for free.

Alert screenshot

Top comments (0)