Payload Interpolation
Using webhook payload data in commands and HTTP requests.
Use values from the incoming webhook payload in shell commands, scripts, and HTTP executor bodies.
Syntax
Wrap field names in double braces:
[hooks.executor]
type = "shell"
command = "deploy --repo={{repo}} --branch={{branch}}"
Nested fields
Use dot notation for nested JSON objects:
command = "echo {{repository.owner.login}}"
Given the payload:
{
"repository": {
"owner": {
"login": "octocat"
}
}
}
This resolves to echo octocat.
Shell escaping
All interpolated values are automatically shell-escaped to prevent injection attacks. A payload value of ; rm -rf / would be escaped to '; rm -rf /'.
Type handling
| JSON Type | Interpolated As |
|---|---|
| String | Raw string value |
| Number | Numeric string |
| Boolean | true or false |
| Object | JSON string |
| Array | JSON string |
| Null | Empty string |
HTTP executor
Interpolation also works in the HTTP executor's URL, headers, and body:
[hooks.executor]
type = "http"
method = "POST"
url = "https://api.example.com/deploy?repo={{repo}}"
body = '{"ref": "{{branch}}", "environment": "production"}'