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.
Download the IOS App.
Go to cronusmonitoring.com and create a free account.
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.
Go the API page and create an api key. We’ll use this to authenticate our requests to Cronus.
Create a new folder and add an index.js file.
Import the cronus-alert package
npm i cronus-alert
- 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()
- Run the file and you’ll see the alert appear on your device.
bun run index.ts
- Congrats. You have the integration configured. You can send up to 1000 alerts a month for free.
Top comments (0)