# README
Go Mail Webhook Service
Webhook allowing to pull mails and send requests to an callback url.
Prerequisites
Mail Client
Currently the only supported mail client is GMail.
You will need the client credentials file and set it to name client_secret.json
and request.token
file.
An example on how you can create it is described here.
Once created use the configuration file to set the directory where both files are stored.
Optional Components
Use make
to run the project. Make is typically installed out of the box 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
Configuration Example
Create a file with name config.yaml
in directory config
.
An example of the configuration file is described below.
- mailClientConfig:
mail: "[email protected]" # 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
How to use
After you have fulfilled the prerequisites you can go ahead and start the service.
Start
Either via docker compose
docker compose up
or use make
make