hook.notifier

1.0.12 • Public • Published

Receive push notifications from your app to your phone.

  • Lightweight ~8kB
  • No dependencies
  • Node & browser support

divider hook notifier

Installation

npm install --save hook.notifier

or

yarn add hook.notifier

Before your continue

Hook.Notifier is an online service that allow you to receive push notifications on your phone and on your browser from any sources that can handle code or webhooks. You'll need an account to continue.

Check Hook.Notifier official website

You can also check our Getting start guide to learn everything about Hook.Notifier.

Warning

We have made this library work on a nodeJS server as well as on a browser. Using it on a browser can be interesting and convenient, but you have to keep in mind that your identifiers will not be safe anymore and that you expose them publicly. If ever your credentials are stolen, don't panic, your Hook.Notifier account remains safe, note that you can reset them in your Hook.Notifier account.

Simple start

import HookNotifier from 'hook.notifier';

const hn = new HookNotifier({ 
  identifier: 1671532023880, // Replace with your identifier
  key: 'long-frost', // Replace with your key
});

hn.sendNotification({ 
  object: 'My first notification', 
  body: 'The body of my first notification.' 
});

divider hook notifier

Parameters

divider hook notifier

Name Type Description Default Value
identifier String Required — This is your identifier you can find it in your Hook.Notifier account.
key String Required — This is your key you can find it in your Hook.Notifier account.
object String Required — The object of your notification.
body String Required — The content of your notification.
tags String (separated by ",") Separated by commas — Tags are splitted to be filtered and grouped in categories. "general"
color String (#FFFFFF) The color of your notification. "#FFC107"
redirectUrl String (Url) Link to follow on click on the notification.
image String (Url) Image to display inside the notification.
sendToTeam Boolean The notification is sent to your team. false
sound Boolean The notification have sound. true
innerData JSON Datas stored inside the notification.
preventData Boolean This can be use to prevent the save of all inner datas. false

HookNotifier constructor

HookNotifier settings parameters can be passed to the constructor to use these in each of your requests.

const hn = new HookNotifier({ 
  identifier: 1671532023880, // Replace with your identifier
  key: 'long-frost', // Replace with your key
  
  tags: 'newDefaultTag', 
  color: '#000000', 
  sendToTeam: true, 
  preventData: false, 
  sound: false,
});

Full exemple

hn.sendNotification({
  object: `You've sell something`,
  body: '143.00€ from ...@gmail.com',
  tags: 'ecommerce,online sell', 
  color: '#0097a7', 
  sendToTeam: false, 
  preventData: false,
  sound: true,
  redirectUrl: 'https://myonlineecommerce.com/order/123456789',
  innerData: {
    customer: '...@gmail.com',
    items: [
      { name: 'item-1', price: '143.00€' }
    ]
  },
});

Versions

Current Tags

  • Version
    Downloads (Last 7 Days)
    • Tag
  • 1.0.12
    1
    • latest

Version History

Package Sidebar

Install

npm i hook.notifier

Weekly Downloads

1

Version

1.0.12

License

MIT

Unpacked Size

9.11 kB

Total Files

4

Last publish

Collaborators

  • illuday