-
Notifications
You must be signed in to change notification settings - Fork 101
Add documentation for webhook triggers #3307
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Draft
mik-ky
wants to merge
4
commits into
main
Choose a base branch
from
ck/webhook-triggers-doc
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
+112
−1
Draft
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
101 changes: 101 additions & 0 deletions
101
src/pages/docs/runbooks/webhook-runbook-trigger/index.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,101 @@ | ||
| --- | ||
| layout: src/layouts/Default.astro | ||
| pubDate: 2026-08-06 | ||
| modDate: 2026-08-06 | ||
| title: Webhook runbook triggers | ||
| description: Webhook runbook triggers let an external system run a runbook by sending an HTTP request to Octopus. | ||
| navOrder: 45 | ||
| --- | ||
|
|
||
| Webhook runbook triggers let an external system run a [runbook](/docs/runbooks) by sending an HTTP request to Octopus. This is useful when the runbook needs to run in response to something happening outside Octopus, for instance: | ||
|
|
||
| - Run a diagnostic runbook when your monitoring tool raises an alert. | ||
| - Restart a service when your incident management tool creates an incident. | ||
|
|
||
| :::div{.warning} | ||
| Webhook runbook triggers are available from Octopus version **2026.3**. This feature can be disabled for your instance under **Configuration ➜ Features**. | ||
| ::: | ||
|
|
||
| :::div{.hint} | ||
| Only published snapshots can be used by a webhook runbook trigger, draft snapshots cannot. For config-as-code runbooks, webhook runbook triggers will always run the runbook from the latest commit on your default branch. | ||
| ::: | ||
|
|
||
| ## Add a webhook runbook trigger | ||
|
|
||
| 1. In a project, select **Runbook Triggers**, then **Create trigger** and select **Webhook**. | ||
| 2. Give the trigger a name. | ||
| 3. Select a runbook. | ||
| 4. Specify the target environments the runbook will run against. | ||
|
|
||
| If you are using [tenants](/docs/tenants) you can select the tenants that the runbook will run against. For each tenant, the published runbook will run against the tenant's environment. | ||
|
|
||
| 5. Choose how callers [authenticate](#authentication) with the webhook. | ||
| 6. Save the trigger. | ||
|
|
||
| Once the trigger is saved, the **Endpoint** section shows the URL to call. Select the copy icon to copy it. | ||
|
|
||
| ## Endpoint | ||
|
|
||
| Octopus generates a unique endpoint for each webhook trigger: | ||
|
|
||
| ```plaintext | ||
| POST https://your-octopus-url/api/{spaceId}/webhook/{webhookId} | ||
| ``` | ||
|
|
||
| The endpoint only accepts `POST` requests. A request body is optional, and can be up to **5 MB**. | ||
|
|
||
| A successful request returns `200 OK` with an empty body. This means Octopus accepted the request and queued the runbook run, not that the run has finished. Use the trigger's run history, or the task log for the runbook run, to see the outcome. | ||
|
|
||
| ## Authentication {#authentication} | ||
|
|
||
| Every request to the endpoint must be authenticated. Each webhook trigger uses one of two methods, chosen in the **Authentication** section when you create or edit the trigger. | ||
|
|
||
| ### Shared secret | ||
|
|
||
| With **Shared secret**, callers send a secret that only the trigger knows in the `X-Octopus-Webhook-Secret` header: | ||
|
|
||
| ```bash | ||
| curl -X POST https://your-octopus-url/api/Spaces-1/webhook/{trigger-guid} \ | ||
| -H "X-Octopus-Webhook-Secret: your-secret" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ "reason": "Disk usage above threshold" }' | ||
| ``` | ||
|
|
||
| Requests with a missing or incorrect secret are rejected with `401 Unauthorized`, and Octopus records an audit event including the caller's IP address. | ||
|
|
||
| Runbook runs created this way are not attributed to an Octopus user, so no permission checks are applied to the run. Anyone who holds the secret can run the runbook against the environments and tenants configured on the trigger. | ||
|
|
||
| ### Octopus API key | ||
|
|
||
| With **Octopus API key**, callers authenticate as an Octopus user by sending an [API key](/docs/octopus-rest-api/how-to-create-an-api-key) in the `X-Octopus-ApiKey` header: | ||
|
|
||
| ```bash | ||
| curl -X POST https://your-octopus-url/api/Spaces-1/webhook/00000000-0000-0000-0000-000000000000 \ | ||
| -H "X-Octopus-ApiKey: API-YOUR-KEY" \ | ||
| -H "Content-Type: application/json" \ | ||
| -d '{ "reason": "Disk usage above threshold" }' | ||
| ``` | ||
|
Comment on lines
+72
to
+77
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. love the examples |
||
|
|
||
| The runbook run is created as the owner of the API key, which means: | ||
|
|
||
| - The key's owner needs the `RunbookRunCreate` [permission](/docs/runbooks/runbook-permissions) for the project, and for every environment and tenant the trigger targets. | ||
| - The run appears in the audit log and task list as being run by that user, rather than by the Octopus system user. | ||
|
|
||
| We recommend using a [service account](/docs/security/users-and-teams/service-accounts) scoped to only what the runbook needs, rather than a key belonging to a person. | ||
|
|
||
| :::div{.warning} | ||
| **Payload signature verification is not supported.** Webhook runbook triggers are generic, and signing schemes are specific to the system sending the request so Octopus ignores signed payload headers. | ||
| ::: | ||
|
|
||
| ## Rate limiting | ||
|
|
||
| The webhook endpoint is rate limited. The limit applies to all webhook triggers on the instance: | ||
|
|
||
| - Up to **60** requests can be made in a burst. | ||
| - The bucket replenishes at **1 request per second**. | ||
|
|
||
| :::div{.hint} | ||
| This limit is separate from the [rate limiting](/docs/administration/managing-infrastructure/rate-limiting) policies you configure under **Configuration ➜ Settings ➜ Rate Limiting**, and is always active. | ||
|
|
||
| As with those policies, the count is not shared across nodes when Octopus Server is configured for [high availability](/docs/administration/high-availability). Each node counts requests independently. | ||
| ::: | ||
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
before we merge this we should change the default state of the feature toggle