🪝Webhook Integration

Webhooks automatically send real-time event updates happening on Famewall to your other tools & systems

For instance, if you have messaging systems like Slack, Discord which could integrate with APIs, you can use Famewall's webhooks to receive a notification whenever a customer submits you a testimonial

Select the "Automation" tab in the sidebar and click on the "Webhook" button

Enter the Webhook Endpoint URL where you'd like to receive all the webhook events. And then click on the checkboxes of the type of events.

Here are the Event Types:

  1. testimonial_collected: Triggered when a customer submits a text/video testimonial on the testimonial collection page (eg. when a customer sends a testimonial on Famewall's collection page)

  2. testimonial_approved: Triggered when you approve a collected testimonial by clicking "Add to Wall" in Famewall dashboard

Here is the code in Javascript to receive the payload and verify that the incoming event is authentic as coming from Famewall

const crypto = require('crypto');

function verifyFamewallSignature(payload, receivedSignature) {
   
  const hmac = crypto.createHmac('sha256', WEBHOOK_SECRET_KEY);
  const calculatedSignature = hmac.update(payload, 'utf-8').digest('base64');

  const isValid = crypto.timingSafeEqual(
    Buffer.from(calculatedSignature, 'base64'),
    Buffer.from(receivedSignature, 'base64')
  );

  return isValid;
}

app.post('/webhook', function(req,res,next){
    // Verify the payload
    const isPayloadValid = verifyFamewallSignature(JSON.stringify(req.body), req.headers['x-webhook-signature']);

    if (isPayloadValid) {
      console.log('Payload is valid. Process the webhook.');
      //verification valid
      
    } else {
      console.log('Payload is not valid. Discard the webhook.');
      //verification invalid
    }
} )

Last updated