<p>First of all, using multi-site for 10 different customers doesn't sound like what it is intended to be used for. But regardless, assuming you are using the <a href="https://github.com/craftcms/webhooks" rel="nofollow noreferrer">Webhooks plugin</a>, you can create your own additional filter that checks for the site ID you are interested in.</p>
<pre class="lang-php prettyprint-override"><code>use yii\base\Event;
use craft\webhooks\Plugin as Webhooks;
use craft\events\RegisterComponentTypesEvent;

Event::on(
    Webhooks::class, 
    Webhooks::EVENT_REGISTER_FILTER_TYPES, 
    function(RegisterComponentTypesEvent $event) {
        $event-&gt;types[] = SiteFilter::class;
    }
);
</code></pre>
<pre class="lang-php prettyprint-override"><code>use Craft;
use craft\webhooks\filters\FilterInterface;
use craft\elements\Entry;
use yii\base\Event;

class SiteFilter implements FilterInterface
{
    public static function displayName(): string
    {
        return 'Entry is in site with ID 1';
    }

    public static function show(string $class, string $event): bool
    {
        return $class === Entry::class;
    }

    public static function check(Event $event, bool $value): bool
    {
        $entry = $event-&gt;sender;

        return ($entry-&gt;siteId == 1) === $value;
    }
}
</code></pre>

CC BY-SA 4.0
2022-08-26T15:17:51.573Z
The check methods is not working. I've done this instead :
 $entry = $event->sender;
 return ($entry->siteId == 1) === $value;
emilie zawadzki
CC BY-SA 4.0
2022-08-26T19:36:19.590Z
Great, I've updated my answer accordingly.
Ben Croker
CC BY-SA 4.0
2022-08-12T16:17:35.040Z
2022-08-26T19:35:28.637Z
2022-08-26T19:35:28.637Z
Ben Croker
<p>The current issue is that I have multi-site setup, where are many different sites in a single Craft instance, e.g., I have 10 websites from 10 customers, when one customer updates his website I want Webhook to be triggered only for his website, not all 10 sites at once. How could I achieve this, is there a filter where I can do it like <code>{{event.site.name == &quot;someSite2Handle&quot;}}</code> in a debouncer or anything like that?</p>

<plugin-development><filter><multi-site><plugin-webhooks>
How to set up webhooks individually for each site in multi-site configuration with many customers?
# How to set up webhooks individually for each site in multi-site configuration with many customers?

(Asked by: username_0 on 2022-08-08)

The current issue is that I have multi-site setup, where are many different sites in a single Craft instance, e.g., I have 10 websites from 10 customers, when one customer updates his website I want Webhook to be triggered only for his website, not all 10 sites at once. How could I achieve this, is there a filter where I can do it like `{{event.site.name == "someSite2Handle"}}` in a debouncer or anything like that?

**Tags:** plugin-development, filter, multi-site, plugin-webhooks

---

## 1 answers

### Answer by username_1 on 2022-08-12. Score: 1

First of all, using multi-site for 10 different customers doesn't sound like what it is intended to be used for. But regardless, assuming you are using the Webhooks plugin, you can create your own additional filter that checks for the site ID you are interested in.
use yii\base\Event;
use craft\webhooks\Plugin as Webhooks;
use craft\events\RegisterComponentTypesEvent;

Event::on(
    Webhooks::class, 
    Webhooks::EVENT_REGISTER_FILTER_TYPES, 
    function(RegisterComponentTypesEvent $event) {
        $event->types[] = SiteFilter::class;
    }
);

use Craft;
use craft\webhooks\filters\FilterInterface;
use craft\elements\Entry;
use yii\base\Event;

class SiteFilter implements FilterInterface
{
    public static function displayName(): string
    {
        return 'Entry is in site with ID 1';
    }

    public static function show(string $class, string $event): bool
    {
        return $class === Entry::class;
    }

    public static function check(Event $event, bool $value): bool
    {
        $entry = $event->sender;

        return ($entry->siteId == 1) === $value;
    }
}

> **Comments:**
> **username_2**: The check methods is not working. I've done this instead :  $entry = $event->sender;  return ($entry->siteId == 1) === $value;  
> **username_1**: Great, I've updated my answer accordingly.  

---

