1.0.12 • Published 1 year ago

hook.notifier v1.0.12

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

NameTypeDescriptionDefault Value
identifierStringRequired — This is your identifier you can find it in your Hook.Notifier account.
keyStringRequired — This is your key you can find it in your Hook.Notifier account.
objectStringRequired — The object of your notification.
bodyStringRequired — The content of your notification.
tagsString (separated by ",")Separated by commas — Tags are splitted to be filtered and grouped in categories."general"
colorString (#FFFFFF)The color of your notification."#FFC107"
redirectUrlString (Url)Link to follow on click on the notification.
imageString (Url)Image to display inside the notification.
sendToTeamBooleanThe notification is sent to your team.false
soundBooleanThe notification have sound.true
innerDataJSONDatas stored inside the notification.
preventDataBooleanThis 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€' }
    ]
  },
});
1.0.9

1 year ago

1.0.11

1 year ago

1.0.10

1 year ago

1.0.12

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago