Webhooks in the Email Manager plugin allow you to connect your forms to external systems by triggering specific actions based on events like form.success or form.error. This provides developers with the flexibility to integrate third-party tools or custom workflows seamlessly.
To set up webhooks for a specific form, add the configuration to your blueprintfile. Multiple webhooks can be defined for each form:
webhooks:
- handler: yourHandler
events:
- form.success
- form.error
This allows you to trigger different handlers for various events like successful submissions or errors.
| Name | Type | Default | Description |
|---|---|---|---|
| events |
array
|
– |
An array of events that trigger the handler. Common events include |
| handler |
string
|
– |
The name of the handler function defined in the site configuration. This function processes the triggered events and executes custom logic. |
Define webhook handlers globally in your site/config.php file. A handler listens for the defined events and executes the custom logic:
<?php
return [
'philippoehrlein.kirby-email-manager' => [
'webhooks' => [
'handlers' => [
'yourHandler' => function($event, $data) {
// Custom logic for handling webhook events
}
]
]
]
];
This structure ensures flexibility by separating form-specific settings from global logic.