Webhook allows to pull mails and send requests to a callback URL.
Currently, the only supported mail client is GMail.
You will need the client credentials file, which you should set to the name client_secret.json
and the request.token
file.
An example of creating it is described here.
Once created, use the configuration file to set the directory where both files are stored.
Run the project using make
. Make is typically installed by default on Linux and Mac.
If you do not have it and run on Windows, you can directly install it from gnuwin32 or via winget
winget install GnuWin32.Make
If you want to run the project without Docker, you can install Golang
Create a file with the name config.yaml
in directory config
.
An example of the configuration file is described below.
- mailClientConfig:
mail: "example@gmail.com" # mail address to be checked
credentialsPath: "/path/to/client_secrets/file/" # location of the credentials files for the mail client, can also be a location relative to the current directory
runOnce: false # if set to true, the service will run once and exit, default is false
intervalBetweenExecutions: 0s # interval between executions of the service, default is 0 seconds
subjectSelectorRegex: ".*" # regex to match the subject of the mail
bodySelectorRegexList: # regex to match the body of the mail, if no body is needed do not set this
- name: "test" # name json attribute in the callback
regex: "[a-z]{0,6}" # regex which matches the body, is set as value of the json attribute
- name: "test2"
regex: ".*"
callback:
url: "https://example.com/callback" # callback url
method: "POST" # method of the callback, has to be provided as uppercase string
timeout: 24s # timeout for the callback, default is 24 seconds
retries: 0 # number of retries for the callback, default is 0
After you have fulfilled the prerequisites, you can start the service.
Either via docker compose
docker compose up
or use make
make
Project used golangci-lint for linting.
See https://golangci-lint.run/usage/install/
Run the linting locally by executing
golangci-lint run ./...
in the working directory