"undefined array key" error with webhook plugin

Hi,

I am using the following webhook plugin in my headless kirby: Issues · errnesto/kirby-plugin-webhooks · GitHub

It seems to be simple: Just adding Webhooks:

-
  url: >
    https://...
  payload: '{"secret":"123"}'
  triggers: page.create:after

to site.txt should do the job. However, this produces an Undefined array key "page.create:after" error. I am probably overseeing something so I’d be grateful for any tips! Thank you!

Did you add this bit manually in site.txt or is that an excerpt from a structure field? I’m missing some context here. Were is the field key?

Sorry for the incomplete information. I did add it manually but with the actual deploy trigger url of course. This is also what it says in the documentation.

The error is thrown when i log into the panel and happens at
…/site/plugins/kirby-plugin-webhooks/index.php

so it is an error specific to the plugin.

It happens in the second line here:

   return array_reduce($currentTriggers, function ($hooks, $trigger) use ($webhook) {
      if (!$hooks[$trigger]) $hooks[$trigger] = array();
      $hooks[$trigger][] = array(
        'trigger' => $trigger,
        'data' => $webhook->toArray()
      );
 
      return $hooks;
    }, $hooks);

I need to ask again, what exactly is in your site.txt, please post complete information.

It needs to look exactly as described in the plugin docs.

In my site.txt I have

Webhooks:

-
  url: >
    https://....
  payload: '{"secret":"123"}'
  triggers: page.create:after

Ok, that looks fine. Then I don’t know. The plugin is pretty old and maybe not compatible with Kirby 4.