initial docs about webhooks

for #18
This commit is contained in:
Alex "mcmonkey" Goodwin
2024-09-14 14:09:13 +09:00
parent d528789b65
commit c69546016a
2 changed files with 28 additions and 0 deletions

View File

@@ -9,3 +9,4 @@ See [The Docs Readme](/docs/README.md) for general listing of documentation and
- [ControlNet](/docs/Features/ControlNet.md) for info about using ControlNets.
- [Video](/docs/Features/Video.md) for info about generating videos.
- [Custom Comfy Workflows](/docs/Features/Comfy-Workflows.md) for info about getting the most out of custom Comfy workflows in SwarmUI.
- [Webhooks](/docs/Features/Webhooks.md) for info about custom defined webhooks triggered by your SwarmUI server.

27
docs/Features/Webhooks.md Normal file
View File

@@ -0,0 +1,27 @@
# Webhooks
SwarmUI can automatically trigger Webhooks in a few different conditions.
Webhooks are a simple common standard way for unrelated processes to trigger interactions with each other, useful for user customization and automation. They work through automatically sending HTTP POST requests with simple JSON content bodies to user-defined URLs, corresponding to some webserver which listens for matching requests and performs an action when received.
Some examples of common webhook handlers are: Discord-Integration webhooks (and other message platforms eg Slack), CI server webhooks, IFTTT (if-this-then-that) automation platforms, ...
### Configuration
Swarm webhooks are configured under the tab `Server` -> `Server Configuration` (considered to be administrative / server management, not for regular users) -> `Webhooks` section.
Webhook configuration comes in two parts: the URL, and the JSON data. For the URL, simply copy in whatever server URL you received externally. For the JSON data, you can either leave it blank (and it will send an empty JSON, ie `{}`), or fill it in with JSON data (eg `{ "somekey": "someval", ... }`).
## Available Hooks
### Queue Start Webhook
This webhook is fired whenever the server was idle, and now is starting to queue new jobs. This webhook, if configured, will block generation until the webhook's HTTP request is completed.
This is useful, for example, to trigger another process to unload separate memory usage before Swarm begins generating. Simply block the HTTP request until memory usage is cleared, then proceed. Be sure that the external memory usage cannot resume until the Queue End webhook is sent.
### Queue End Webhook
This webhook is fired whenever the server was generating images, and has emptied its queue, and thus is now idle. This webhook, if configured, will block and force the server to remain in an idle state until the webhook's HTTP request is completed.
This is useful, for example, to signal to another process that it is now clear to use server memory again.