Skip to content

Commit

Permalink
docs: webhook post data
Browse files Browse the repository at this point in the history
  • Loading branch information
adityathebe committed Jun 25, 2024
1 parent 97d53c7 commit 9f954d7
Showing 1 changed file with 50 additions and 8 deletions.
58 changes: 50 additions & 8 deletions mission-control/docs/playbooks/webhooks.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,9 @@ sidebar_position: 4
---

Playbooks can also be triggered via webhooks. When a webhook is configured, mission-control listens on the specified endpoint and any calls to the endpoint triggers the playbook.
By default, the webhook calls are not protected via authentication. However, there are various authentication methods available.

```
/webhook/<webhook-path>
POST /webhook/<webhook-path>
```

```yaml title="webhook-trigger.yaml"
Expand All @@ -17,23 +16,66 @@ metadata:
name: create-file-on-webhook
spec:
description: Create a file specified by the webhook
components:
- type: KubernetesCluster
'on':
webhook:
// highlight-next-line
path: my-webhook
authentication:
basic:
username:
value: my-username
password:
value: my-password
parameters:
- name: path
label: Absolute path of the file to create
actions:
- name: Create the file
exec:
script: touch {{.params.path}}
script: echo '{{.request.content}}' > '{{.request.params.path}}'
```
:::note
A webhook playbook doesn't accept any parameters and resources unlike a regular playbook.
:::
## Authentication
By default, the webhook calls are not protected via authentication. However, there are various authentication methods available as listed below.
- [Basic Auth](../reference/playbooks/webhooks.md#basic)
- [GitHub](../reference/playbooks/webhooks.md#github)
- [Svix](../reference/playbooks/webhooks.md#svix)
- [JWT](../reference/playbooks/webhooks.md#jwt)
## Webhook Data
The following details of a webhook request is available on the playbook under `request`.

<Fields
rows={[
{
field: 'url',
description: `Endpoint of the webhook. Example \`/playbook/webhook/my-webhook\``,
scheme: 'string'
},
{
field: 'headers',
description: `Headers sent on the webhook request`,
scheme: '`map[string]string`'
},
{
field: 'params',
description: `Query parameters sent on the webhook request`,
scheme: '`map[string]string`'
},
{
field: 'content',
description: `Content sent on the webhook request`,
scheme: 'string'
},
{
field: 'json',
description: `JSON content if the webhook content is JSON`,
scheme: '`map[string]any`',
}
]}
/>

0 comments on commit 9f954d7

Please sign in to comment.