Skip to main content

Connections

webhook

Commentary

added in 0.0.5

Sends events to a webhook using a JSON encoded body.

To increase the concurrency of outstanding HTTP requests, you may want to increase the maximum number of open files in the Docker container, otherwise known as the ulimit, and increase the corresponding maxRequests. 1


Examples

Configuring the connection

This connection takes no further configuration. All parameterization takes place in the generator.

{
"connections": {
"saas-webhook": {
"kind": "webhook"
}
}
}

Generating data

Minimally, use url to specify the route to send data to.

{
"generators": [
{
"url": "http://my-url.com/route",
"data": {
"latency": {
"_gen": "normalDistribution",
"mean": 100,
"sd": 10,
"decimals": 1
}
}
}
],
"connections": {
"saas-webhook": {
"kind": "webhook"
}
}
}

Set the method

Use method to set the HTTP method of the request. If left unset, it defaults to POST.

{
"generators": [
{
"url": "http://my-url.com/route",
"method": "PUT",
"data": {
"_gen": "boolean"
}
}
],
"connections": {
"saas-webhook": {
"kind": "webhook"
}
}
}

Set headers

Set headers to an object of values to control the HTTP request headers. Because body data is serialized with JSON, content-type is always set to application/json.

{
"generators": [
{
"url": "http://my-url.com/route",
"headers": {
"X-API_KEY": {
"_gen": "env",
"var": "MY_API_KEY"
}
},
"data": {
"_gen": "oneOf",
"choices": [
"a",
"b",
"c"
]
}
}
],
"connections": {
"saas-webhook": {
"kind": "webhook"
}
}
}

Set query parameters

Set queryParams to an object of key/value pairs to set the query string on the URL.

{
"generators": [
{
"url": "http://my-url.com/route",
"queryParams": {
"foo": "bar",
"baz": "bip"
},
"data": {
"_gen": "oneOf",
"choices": [
1,
2
]
}
}
],
"connections": {
"saas-webhook": {
"kind": "webhook"
}
}
}

Increase the concurrency

Use maxRequests to increase the number of concurrent, outstanding HTTP requests pending at any given time. The default is 20000. Make sure this value is lower than the soft ulimit of your Docker container, otherwise you may encounter errors.

{
"generators": [
{
"url": "http://my-url.com/route",
"data": {
"latency": {
"_gen": "uniformDistribution",
"bounds": [
5,
10
]
}
}
}
],
"connections": {
"saas-webhook": {
"kind": "webhook",
"connectionConfigs": {
"maxRequests": 50000
}
}
}
}

Specification

Connection JSON schema

{
"type": "object",
"properties": {
"kind": {
"type": "string",
"const": "webhook"
},
"connectionConfigs": {
"type": "object",
"properties": {
"maxRequests": {
"type": "number",
"minimum": 1
}
}
}
}
}