You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Webhook Relay Server is a sever in which webhooks can be redirected to websockets for monitoring. The server's goal was to be able to expose web services without exposing LAN networks in a secure fashion
Features
Create webhooks for monitoring
Create bundles of webhooks to monitor
Subscribe to webhooks or bundles
Support for HTTP and HTTPS with custom ports
Limit max subscriptions per hook or bundle
Config
{hooksPath: '/hooks',//Path to post WebhookshooksSubscriptionPath: '/subscribe/hooks',//Path to subscribe to HooksbundleSubscriptionPath: '/subscribe/bundle',//Path to subscribe to BundlesmaxSubscriptions: 10,//Default Max Number of Subscriptions for Hooks/BundleswebhookPort: 80,//Port to Listen for WebhookssubscriptionPort: 80,//Port to Listen for SubscriptionsuseHttps: true,//Enable HTTPScredentials: {//Required for HTTPSkey: 'secure key',//Key for HTTPSkeyFile: 'credentials.key',//Alternatively can load from filecert: 'certificate',//Certificate for HTTPScertFile: 'cerdentials.cert'//Alternatively can load from file},webhookPortSecure: 443,//Port to Listen for Webhooks on HTTPSsubscriptionPortSecure: 443,//Port to Listen for Subscriptions on HTTPShttpsOnly: false,//Only use HTTPS,debug: false//Enables debug mode}
Methods
addWebhook({// Config and all fields are optionalendpoint: '/location/:data/:id',//Custom path for webhook. Fields that start with a colon can be parsed using the BasicProcessor as 'rest_data' in the subscription response.id: 'my-hook',//ID of webhook. UUID is created when blankhookProcessor: processor,//Processor that handles webhook request. Default is BasicProcessor.hookAuthentication: atuhentication,//Webhook Authenticator. Default is NoAuthenticationsubscriptionAuthentication: atuhentication,//Subscription Authenticator. Default is NoAuthenticationmaxSubscriptions: 10,//Max number of subscriptions for hookbundleId: ''//ID of bundle to put webhook in. Leaving blank does not put webhook in a bundle});returnsPromise({id: 'my-hook',hookPath: '/hooks/location/:data/:id'subscriptionPath: '/subscribe/hook/my-hook',hookAuthenticationToken: 'token',//If Hook Authentication reutrns tokensubscriptionAuthenticationToken: 'token',//If Subscription Authentication reutrns token})deleteWebhook(id);//Deletes WebhookreturnsPromise()addBundle({// Config and all fields are optionalid: 'my-bundle',//ID of bundle. UUID is created when blanksubscriptionAuthentication: atuhentication,//Subscription Authenticator. Default is NoAuthenticationmaxSubscriptions: 10,//Max number of subscriptions for bundlesubscriptionAuthenticationToken: 'token',//If Subscription Authentication reutrns tokenwebhooks: [],//Array of webhooks to create});returnsPromise({id: 'my-bundle',subscriptionPath: '/subscribe/bundle/my-bundle',webhooks: []})deleteBundle(id);//Deletes BundlereturnsPromise()listen();//Starts Server
Processors
Processors.Basic();//Default Processor which can turn endpoints with colons into rest_data. POST data is automatically returned as 'body'.returnsPromise(JSON.stringify({source: req.ip,body: req.body,rest_data: {}//processed endpoint data}));//Custom processors can be created with this formatclassCustomProcessorextendsProcessors.Base{process(req,webhook){returnPromise((res,rej)=>{vardataToSendToWebsockSubscription='Webhook Data';res(dataToSendToWebsockSubscription)});}}
Authentication
Authentication.None();//Default AuthenticationAuthentication.Basic('username','password');//Basic Username and Password authentication//Custom authenticators can be created with this format from BaseAuhenticationclassCustomAuthenticationextendsAuthentication.Base{constructor(token=null){super(token);}verify(req,relay){returnPromise.resolve({verified: false,id: 0});}hasToken(){returntrue;}getToken(){returnthis.token;}}