# 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

<figure><img src="/files/sqcHJJjBTvwiOx6KLTxT" alt=""><figcaption></figcaption></figure>

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](https://page.famewall.io/famewall))
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
    }
} )


```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.famewall.io/webhook-integration.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
