Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

simplert

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

simplert

Simple way to send alerts via Slack, Email, Discord, SMS, etc.

  • 0.2.2
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

Simplert

Simple way to send alerts via Slack, Email, Discord, SMS, etc. Simplert is currently geared towards personal and smaller apps where you just want a simple way to alert on some event like when a new user signs up. The idea is that you can just drop your simplert config file in any of your projects and quickly start alerting on events. I would advise against using this in any critical production apps as of now.

Getting Started

  1. Install simplert: npm install simplert
  2. Generate simplert configuration file: npx generate-config

Simplert Configuration File

{
  "discord": {
    "enabled": false,
    "token": "",
    "send_to": ""
  },
  "email": {
    "gmail": {
      "enabled": false,
      "send_to": "",
      "send_from": "",
      "subject": "",
      "token": {},
      "credentials": {}
    }
  }
}

enabled - whether you want this type of alerting enabled or not
discord:token - the token of your discord bot
discord:send_to - the name of the discord channel you want to send your alerts too. Make sure your bot has permission on the server to send messages
email:gmail:send_to - the default receipient email you want to send to, otherwise passed into the email function
email:gmail:send_from - The default email you want to send from. You may have a Gsuite account with multiple aliases that you can specifiy here which one you want to send from. Otherwise passed into the email function
email:gmail:subject - A default email subject for every alert, otherwise passed into the email function
email:gmail:token - Used for authorization, can be generated with npx generate-gmail assuming you have your email:gmail:credentials populated correctly.
email:gmail:credentials - Credentials provided by Google when setting up your project in the Google Cloud Console usually downloaded as gmail-credentials.json. Set this key as the contents of that file.

Usage

Note: Make sure you have setup your configuration file


simplert.discord(message,[send_to])

Send a message to a discord channel. send_to can be optional if it is specified in the configuration file underdiscord:send_to as the default, otherwise it needs to be passed in as the second argument

const simplert = require("simplert");
simplert.configure("simplert.json");

simplert.discord("some event"); //assuming discord:send_to is set in config file
simplert.discord("some other event", "general"); // send to a different channel

simplert.email(body,[send_to, subject, send_from])

Send an email message send_to, subject, send_from can be optional if defaults are set under email:gmail:* in the configuration file. Otherwise, they need to be passed as arguments to the function.

const simplert = require("simplert");
simplert.configure("simplert.json");

simplert.email("some event"); //assuming discord:send_to is set in config file
simplert.email("some other event", "email@example.com"); // send to a specific email
simplert.email("another event", "email@example.com", "Some Email Subject"); // set an email subject
simplert.email("and another event", "email@example.com", "Some Email Subject", "alias@example.com"); // set a send from alias if you use Gsuite

Scripts

generate-config

npx generate-config

Generates a simplert configuration file. By default, all alert will be set to disabled, you will need to manually configure the necessary values in this file before using simplert.

generate-gmail

npx generate-gmail

This will generate an auth token and automatically populate the email:gmail:token value in your configuration file. This assumes that you have email:gmail:credentials set in your configuration file which should be set to the content in your gmail-credentials.json file that was download from Google Cloud Console when setting up a project.

Supported Alerts

Discord
Gmail

Slack and SMS coming eventually

Bugs and Improvements

Please open an issue on the repo to report any bugs or improvements as I am sure there are. I would consider this still in beta and not to be used in any critical production apps rather used for personal projects that you just want some simple alerting on.

Keywords

FAQs

Package last updated on 24 Nov 2019

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc