@graphshieldhq/webhooks
v0.0.4
Published
An opinionated webhooks module.
Downloads
7
Readme
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.