Webhook Relay
Search…
CLI Basics

Overview

Relay CLI provides a variety of ways to configure request routing and also acts as an agent for request forwarding and tunnelling. Main features:
    automatically configure bucket, input and output for webhook forwarding with relay forward command
    automatically configure tunnel with relay connect command
    manage buckets, inputs and outputs for one-way request forwarding
    manage tunnel subdomains, destinations and authentication details
    manage access keys and secrets

Authenticate

In order to start using your CLI, you first have to authenticate. Create your key & secret pair here: https://my.webhookrelay.com/tokens. Then, there are two ways to do it:
    Using login command CLI will take advantage of native secure storage:
1
relay login -k token-key-here -s token-secret-here
Copied!
    Environment variable option is very useful when automating things:
1
export RELAY_KEY=token-key
2
export RELAY_SECRET=token-secret
Copied!

Forward

Forward command automatically creates configuration and starts one-way request forwarding:
1
relay forward --help
2
3
Usage: relay forward [OPTIONS] [DESTINATION | COMMAND ARGS]
4
5
Create forwarding configuration (automatically creates bucket, input endpoint and output destination). If destination and bucket aren't specified - starts a relay for all endpoints
6
7
Options:
8
-b, --bucket string Bucket name (defaults to destination name if not supplied)
9
--command string Command to execute, must be used with '--relayer exec' option
10
--help Print usage
11
--input-mode string Input mode switches between raw request body passed into the exec command through STDIN and a JSON encoded full webhook event (see documentation for
12
format), must be used with '--relayer exec' option (default "body")
13
--no-agent Do not start relay agent after configuration
14
--relayer string Relayer type - 'default' HTTP (forward to HTTP servers) or 'exec' that executes commands on the current machine (default "default")
15
--timeout int Execution timeout in seconds, must be used with '--relayer exec' option. Set to 0 to never timeout (default 300)
16
-t, --type string Output type - internal or public (default "internal")
17
--ws Use WebSocket server as a transport (might evade certain firewalls)
Copied!
Here, to forward webhooks:
    -b –bucket: supply bucket name to reuse existing one. Useful when invoking forward command for the same destination.
    –no-agent: only configure bucket, input and output without starting an agent.
    -t –type: is an output, defaults to internal.
Usage example:
1
$ relay forward --bucket webhook-demo http://localhost:8090/webhook
2
Forwarding:
3
https://my.webhookrelay.com/v1/webhooks/5e722a5e-f3d9-4eec-9e9f-79f1158e4b10 -> http://localhost:8090/webhook
4
Starting webhook relay agent...
Copied!
Another forward mode is to execute commands on your machine, to do that, use:
    -b –bucket: supply bucket name to reuse existing one.
    –relayer: use ‘exec’ relayer type to execute commands.
    –command: command to execute, for example ‘python’, ‘bash’, ‘node’ and pretty much any other executable on your computer.
    –input-mode: by default only request body is passed through stdin into the executed command, use ‘json’ to retrieve body, headers, method, query and additional bucket/input metadata.
All additional arguments passed to the forward command will be passed as arguments to the executed command:
1
relay forward --bucket my-bucket-name --relayer exec --command python my-script.py my-first-arg my-second-arg
Copied!

Connect

Connect command automatically creates tunnel configuration and starts two-way request streaming:
1
$ relay connect -h
2
3
Usage: relay connect [OPTIONS] [DESTINATION]
4
5
Connects supplied destination to the public endpoint
6
7
Options:
8
--auto-generate Auto generate certificates if not supplied
9
--crt string Certificate file for TLS termination (optional)
10
-c, --crypto string To enable HTTPS endpoints for your tunnels use 'flexible', 'full', 'full-strict', 'tls-pass-through' (default "off")
11
--ddns-token string DuckDNS token, retrieve yours at https://www.duckdns.org/
12
-d, --destination string Destination (where the requests should be routed)
13
--help Print usage
14
-H, --host string Preferred host for the tunnel
15
--key string Key file for TLS termination (optional)
16
-m, --minify Minify content
17
-n, --name string Tunnel name
18
--no-agent Do not start relay agent after configuration
19
-p, --password string Password for basic auth (optional)
20
--protocol string Protocol (http, tcp) (default "http")
21
-r, --region string Region to connect tunnel daemon to
22
--rewrite-host-header string Rewrite host header
23
-s, --subdomain string Preferred subdomain for the tunnel
24
-t, --token string Authentication token
25
-u, --username string Username for basic auth (optional)
Copied!
Here:
    -r, --region string : is a tunnel region. Select your region based on your location (example: eu, us-west, au)
    -d, --destination: is a destination to connect to.
    --no-agent: only configures tunnel without starting an agent.
    -p --password: is a password for the basic authentication.
    -u --username: is a username for the basic authentication.
    -t --token: is a token for the token authentication.
    -s --subdomain: is an optional parameter for preferred subdomain. If not supplied - random subdomain will be generated.
Usage example:
1
$ relay connect https://localhost:9400
2
Connecting:
3
http://f7ayb97wmq2fldenbyenxs.webrelay.io <----> https://localhost:9400
4
1.512048961831163e+09 info client starting {"version": "develop"}
5
1.5120489620960093e+09 info adding HTTP tunnel f7ayb97wmq2fldenbyenxs.webrelay.io ---> https://localhost:9400
6
1.512048962096073e+09 info tunnel proxy configuration updated
Copied!

Discovering other commands

To view other command in the CLI, use `--help` flag:
1
relay --help
Copied!
Example output:
1
$ relay --help
2
Usage: relay COMMAND
3
4
Webhook Relay - tunnels for the web.
5
6
By using this product, you are agreeing to the terms of the the AppScension Ltd. Terms of service can be found at: https://webhookrelay.com/tos/
7
8
Don't have an account? Create one here: https://my.webhookrelay.com/register
9
or run:
10
11
relay register -e [email protected] -p password -u username
12
13
Report client related issues here: https://github.com/webrelay/client/issues.
14
15
If you have any questions or security related issues, please contact us via email: [email protected]
16
17
Options:
18
--config string Location of client config files (default "/home/karolis/.webhookrelay")
19
--help Print usage
20
-v, --version Print version information and quit
21
22
Management Commands:
23
bucket Manage buckets - used to group inputs and outputs together
24
domain Manage domain reservations - reserved domains can later be used for bucket inputs or tunnel hostnames
25
function Manage functions - used to transform webhooks and writing custom plugins
26
ingress Manage ingresses - reverse tunnels for Kubernetes
27
input Manage inputs - your personal endpoints to receive webhooks
28
output Manage outputs - destinations where requests are relayed
29
token Manage tokens - required for API (OAuth users) and webhook streaming connections
30
tunnel Manage tunnels - bidirectional connections that expose internal services
31
32
Commands:
33
connect Connects supplied destination to the public endpoint
34
diagnostics Perform relay agent diagnostics
35
forward Create forwarding configuration (automatically creates bucket, input endpoint and output destination). If destination and bucket aren't specified - starts a relay for all endpoints
36
login Log in to a Webhook Relay service. Get your token key & secret pair here: https://my.webhookrelay.com/tokens.
37
logout Log out from a Webhook Relay service
38
register Register a new Webhook Relay account
39
run Run relay agent as a service with a given config file
40
service Install and control relay as a background service, available commands (install, uninstall, start, stop, restart, status)
41
42
Run 'relay COMMAND --help' for more information on a command.
43
Copied!
Last modified 3mo ago