DEV Community

Mat
Mat

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

1

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

Heroku

This site is built on Heroku

Join the ranks of developers at Salesforce, Airbase, DEV, and more who deploy their mission critical applications on Heroku. Sign up today and launch your first app!

Get Started

Top comments (0)

SurveyJS custom survey software

JavaScript Form Builder UI Component

Generate dynamic JSON-driven forms directly in your JavaScript app (Angular, React, Vue.js, jQuery) with a fully customizable drag-and-drop form builder. Easily integrate with any backend system and retain full ownership over your data, with no user or form submission limits.

Learn more

👋 Kindness is contagious

Please leave a ❤️ or a friendly comment on this post if you found it helpful!

Okay