const express = require( 'express' ); const app = express(); const API_SECRET = 'secret'; app.use( express.json( { verify: ( req, res, buffer ) => { req.rawBody = buffer; } } ) ); app.post( '/', ( req, res ) => { const signature = _generateSignature( req.method, req.url, req.headers[ 'x-cp-signature' ], req.rawBody ); const ret = 200; if ( signature !== req.headers[ 'x-cp-signature' ] ) { ret = 403; } else { ret = 200; } res.sendStatus(ret); } ); app.listen( 9000, () => console.log( 'Node.js server started on port 9000.' ) ); function _generateSignature( method, url, timestamp, body ) { const hmac = crypto.createHmac( 'SHA256', API_SECRET ); hmac.update( `${ method.toUpperCase() }${ url }${ timestamp }` ); if ( body ) { hmac.update( body ); } return hmac.digest( 'hex' ); }
Push Alert States
The following list contains the potential states a Push alerts can be in during the push process to your destination URL.
active: the push process to the destination URL is successful and alerts continue to stream to the destination URL as they are generated.
unreachable: pushing to the destination URL fails and the server is making automatic retry attempts.
suspended: pushing to the destination URL is turned off by the server when it could not re-establish a connection to the destination URL.
disabled: push alerts have been disabled manually by a user via NetCloud Manager or the API.