Skip to content

Instantly share code, notes, and snippets.

Created Jun 8, 2021
What would you like to do?
Sample Node script to get response body from webhooks.
// This example uses Express to receive webhooks
const app = require("express");"/my/webhook/url", function(request, response) {
/* It is a good idea to log all events received. Add code *
* here to log the signature and body to db or file */
// retrieve the signature from the header
var hash = req.headers["verif-hash"];
if(!hash) {
// discard the request,only a post with the right Flutterwave signature header gets our attention
// Get signature stored as env variable on your server
const secret_hash = process.env.MY_HASH;
// check if signatures match
if(hash !== secret_hash) {
// silently exit, or check that you are passing the right hash on your server.
// Retrieve the request's body
var request_json = JSON.parse(request.body);
// Give value to your customer but don't give any output
// Remember that this is a call from rave's servers and
// Your customer is not seeing the response here at all
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment