Skip to content

Commit 98cf31a

Browse files
committed
fmt
1 parent 530f5fd commit 98cf31a

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

docs/handler_plugins.md

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ This document provides in-depth information about handler plugins and how you ca
44

55
## Writing a Handler Plugin
66

7-
Handler plugins are Ruby classes that extend the `Hooks::Plugins::Handlers::Base` class. They are used to process webhook payloads and can do anything you want. They follow a very simple interface that allows you to define a `call` method that takes four parameters: `payload`, `headers`, `env`, and `config`.
7+
Handler plugins are Ruby classes that extend the `Hooks::Plugins::Handlers::Base` class. They are used to process webhook payloads and can do anything you want. They follow a very simple interface that allows you to define a `call` method that takes four parameters: `payload`, `headers`, `env`, and `config`.
88

99
**Important:** The `call` method should return a hash by default. Since the server now defaults to JSON format, any hash returned by the handler will be automatically converted to JSON with the correct `Content-Type: application/json` headers set by Grape. This ensures consistent API responses and proper JSON serialization.
1010

@@ -61,6 +61,7 @@ By default, the Hooks server uses JSON format for both input and output processi
6161
**Best Practice**: Always return a hash from your handler's `call` method. The hash will be automatically serialized to JSON and sent to the webhook sender with proper headers. This ensures consistent API responses and proper JSON formatting.
6262

6363
Example response format:
64+
6465
```json
6566
{
6667
"status": "success",
@@ -242,6 +243,7 @@ end
242243
```
243244

244245
This will return a properly formatted JSON error response:
246+
245247
```json
246248
{
247249
"error": "payload_empty",

0 commit comments

Comments
 (0)