# Webhook Cloudron Package

## Description

Webhook is a lightweight configurable tool written in Go that allows you to easily create HTTP endpoints (hooks) on your server, which you can use to execute configured commands.

## Features

- Define HTTP endpoints that execute commands on your server
- Pass data from HTTP requests to your commands
- Specify rules that must be satisfied for hooks to trigger
- Supports JSON and YAML configuration files
- Trigger rules for security (secrets, headers, etc.)
- Hot-reload configuration without restart
- Support for multipart form data
- Template support for request values

## Configuration

The webhook application reads configuration from `/app/data/hooks.json` (or `/app/data/hooks.yaml`).

### Example Configuration

```json
[
  {
    "id": "redeploy-webhook",
    "execute-command": "/var/scripts/redeploy.sh",
    "command-working-directory": "/var/webhook",
    "trigger-rule": {
      "and": [
        {
          "match": {
            "type": "payload-hmac-sha1",
            "secret": "mysecret",
            "parameter": {
              "source": "header",
              "name": "X-Hub-Signature"
            }
          }
        }
      ]
    }
  }
]
```

See [webhook documentation](https://github.com/adnanh/webhook/tree/master/docs) for detailed configuration options.

## Usage

1. Install the webhook app on Cloudron
2. Navigate to the File Manager
3. Create or edit `hooks.json` in the `/app/data` directory
4. Restart the app to apply configuration changes
5. Access your webhook endpoints at `http://your-app.cloudron.app/hooks/{hook-id}`

## Documentation

For more information on configuring webhooks, visit:
- [Hook Definition](https://github.com/adnanh/webhook/blob/master/docs/Hook-Definition.md)
- [Hook Examples](https://github.com/adnanh/webhook/blob/master/docs/Hook-Examples.md)
- [Hook Rules](https://github.com/adnanh/webhook/blob/master/docs/Hook-Rules.md)
- [Webhook Parameters](https://github.com/adnanh/webhook/blob/master/docs/Webhook-Parameters.md)

## Security Considerations

- Always use trigger rules to secure your hooks
- Never expose sensitive commands without proper authentication
- Use HMAC signatures for verifying webhook sources
- Consider IP-based rules for additional security

## Upstream

[GitHub Repository](https://github.com/adnanh/webhook)
