With webhooks, you can only map one {Project} event to one API call. For advanced integrations, where a single shell script can contain multiple commands, you can install a {SmartProxy} shellhooks plugin that exposes executables using a REST HTTP API.
You can then configure a webhook to reach out to a {SmartProxy} API to run a predefined shellhook. A shellhook is an executable script that can be written in any language as long as it can be executed. The shellhook can for example contain commands or edit files.
You must place your executable scripts in /var/lib/foreman-proxy/shellhooks
with only alphanumeric characters and underscores in their name.
You can pass input to shellhook script through the webhook payload.
This input is redirected to standard input of the shellhook script.
You can pass arguments to shellhook script using HTTP headers in format X-Shellhook-Arg-1
to X-Shellhook-Arg-99
.
For more information on passing arguments to shellhook script, see:
The HTTP method must be POST.
An example URL would be: https://{smartproxy-example-com}:{smartproxy_port}/shellhook/My_Script
.
Note
|
Unlike the |
You must enable {SmartProxy} Authorization for each webhook connected to a shellhook to enable it to authorize a call.
Standard output and standard error output are redirected to the {SmartProxy} logs as messages with debug or warning levels respectively.
The shellhook HTTPS calls do not return a value.
For an example on creating a shellhook script, see [creating-a-shellhook-to-print-arguments_{context}].