Webhook to integrate with your gitlab repository to persist data and notify by email
For building and running the application you need:
Firstly you need to change the configuration on the aplication.properties
file to correspond to you database, smtp information and the email to receive the message.
Then, you can either:
-
Execute the
main
method in thebr.com.personal.webhookreceiver.WebhookReceiverApplication.java
class from your IDE. -
Or use the Spring Boot Maven plugin like so:
mvn spring-boot:run
To integrate with a gitlab repository first you need to expose your application to be accessed from outside your network. An easy way to do that is to use ngrok.
Then, in the settings > integrations of you gitlab repository you need to add the url of your server, mark the push event trigger and add webhook.
You can test the webhook by doing a push to the repository or simply by using the test function in the integrations page (your project should have at least one commit).