New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

keep-me-posted

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

keep-me-posted

Keep yourself posted for website updates

  • 0.1.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5
increased by150%
Maintainers
1
Weekly downloads
 
Created
Source

keep-me-posted

Execute code on a web page, send yourself a telegram message.

Install

npm install keep-me-posted

Usage

Import the keepMePosted function from 'keep-me-posted' Available params:

  • URL (String) Webpage URL on which the callback will be executed.
  • callback (function(...args)) Function to execute on the Webpage. Should return a message or an object containing a 'message' property.
  • [settings] (Object - Optional) Settings for telegram bot usage.
    • [settings.telegramBotToken] (string) Telegram Bot API Token (from BotFather).
    • [settings.chatId] (string | number | string[] | number[]) Your telegram chat ID or IDs.
    • [settings.browser] (Object - Optional) Your Puppeteer browser instance.
  • [...args] (any[] - Optional) Parameters for the callback function.

NOTE: The callback function is executed in the webpage scop and not in your application scop, you will be able to access the window object and the DOM but will not be able to access any of you variables. You can pass extra arguments and catch them as arguments in your callback function.

Examples

const keepMePosted = require('keep-me-posted');

const URL = "https://github.com";
const settings = {
  telegramBotToken: 'my-bot-api-token' // Get it from BotFather
  chatId: 123456 // Send a message to your bot, then getUpdates
};

// Returning a String
keepMePosted(URL, () => window.location.href, settings);
// This will return a Promise that will resolve with "https://github.com"
// The bot will send a message "https://github.com"

// Returning an Object
function exec(foo) {
  return {
    message: 'Hi...',
    a: foo.a + 10
  };
}
keepMePosted(URL, exec, settings, {a: 1});
// This will return a Promise that will resolve with the object:
// { message: 'Hi...', a: 11 }
// The bot will send a message "Hi..."

// Avoiding a message
// return any non string value that does not contain a "message" property
keepMePosted(URL, () => ({a: 1}), settings);
// This will return a Promise that will resolve with the object:
// { a: 1 }
// The bot will not send a message

Keywords

FAQs

Package last updated on 06 Oct 2020

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