0.0.4 â€ĸ Published 1 year ago

@graphshieldhq/webhooks v0.0.4

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

Versioning Twitter Follow

Webhooks Module

An opinionated webhooks module.

The webhooks module manages the whole process of sending a request to a distant server.

More specifically, it provides configurable safe defaults to handle:

  • Various HTTP methods / content types
  • Timeout
  • Retry
  • Payload signature / validation
  • Asynchronous events

💡 Features

🚀 Get Started

Installation

npm install --save @graphshieldhq/webhooks

Initialization

import Webhooks from '@graphshieldhq/webhooks'
const webhook = new Webhooks({
  user_agent: 'Webhooks',
  headers_extension_key: 'webhooks',
  retry_interval: 100,
  max_retry: 3,
  timeout: 5000,
  logging: console.log,
})
webhook.on('success', (result) => {
  console.debug(result)
})
webhook.send({
  event: 'test',
  url: 'http://fake.com/webhooks',
  data: {
    test: 'test'
  },
  secret: 'test'
})

The initialization options must be an object with properties as specified in the options schema.

Additional resources

0.0.4

1 year ago

0.0.3

1 year ago