You can paste your webhooks.json
at jsonlint.com to validate the JSON syntax.
[
{
"method": ["GET", "POST"],
"path": "/list-tmp-directory-content",
"command": "ls -la",
"cwd": "/tmp"
},
{
"method": "POST",
"path": "/greet-second-user",
"command": "echo $GREETING $NAME",
"parseJson": [
{
"query": "payload.users.1.greeting",
"variable": "GREETING"
},
{
"query": "payload.users.1.name",
"variable": "NAME"
}
]
},
{
"method": "POST",
"path": "/github",
"command": "echo hello github",
"validate": [
{
"source": "header",
"find": "X-Hub-Signature",
"match": "hmac-sha1",
"value": "MySuperSecret"
}
]
}
]
* = required
HTTP method. String.
"method": "POST"
HTTP methods. Array of strings.
"method": ["GET", "POST"]
Endpoint at which requests can be made. String.
"path": "/example"
Command that should be executed when the endpoint is triggered. String.
"command": "ls -l"
Command working directory. String.
"cwd": "/tmp"
Map JSON values to environment variables. Array of objects. Object schema:
query
: JSON path in dot-notatation. String.variable
: Environment variable name. String.
"parseJson": [
{
"query": "payload.users.1.greeting",
"variable": "GREETING"
}
]
The variable can then be accessed in the "command"
field:
"command": "echo $GREETING"
If set, the webhook will only be triggered if all validation rules match. Array of objects. Object schema:
source
: HTTP request part. String.jsonBody
: HTTP body application/jsonurlencodedBody
: HTTP body x-www-form-urlencodedheader
: HTTP header
find
: Depends onsource
jsonBody
=> JSON path in dot-notatation. String.urlencodedBody
=> x-www-form-urlencoded key. String.header
=> HTTP header field. String.
match
: Match type. String.exactly
: Match value exactly (strict equal). String.regexp
: Match regular expresssion. String.hmac-sha1
: Match computed HMAC SHA1. String
value
: Depends onmatch
exactly
=> Expected value. Any.regexp
=> Regular expression. String.hmac-sha1
=> Secret key. String.
"validate": [
{
"source": "jsonBody",
"find": "payload.users.1.name",
"match": "exactly",
"value": "Bob"
},
{
"source": "urlencodedBody",
"find": "foo",
"match": "regexp",
"value": "ar$"
},
{
"source": "header",
"find": "X-My-Header",
"match": "hmac-sha1",
"value": "MySecretToken"
}
]