Answers.Body: <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>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-26T15:17:51.573Z
Answers.Text: The check methods is not working. I've done this instead :
   $entry = $event->sender;
   return ($entry->siteId == 1) === $value;
Answers.UserDisplayName: emilie zawadzki
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-26T19:36:19.590Z
Answers.Text: Great, I've updated my answer accordingly.
Answers.UserDisplayName: Ben Croker
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2022-08-12T16:17:35.040Z
Answers.LastActivityDate: 2022-08-26T19:35:28.637Z
Answers.LastEditDate: 2022-08-26T19:35:28.637Z
Answers.UserDisplayName: Ben Croker
Body: <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>
  
Tags: <plugin-development><filter><multi-site><plugin-webhooks>
Title: How to set up webhooks individually for each site in multi-site configuration with many customers?
ThreadText: # 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](https://github.com/craftcms/webhooks), you can create your own additional filter that checks for the site ID you are interested in.
  
  ```php
  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;
      }
  );
  
  ```
  
  ```php
  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.  
  
  ---
  
  