Java Sample to demonstrate how to integrate your app using webhooks
SampleApp-Webhooks-Java
Welcome to the Intuit Developer's Webhooks Java Sample App.
This sample app is meant to provide working examples of how to integrate your app with the Intuit Small Business ecosystem. Specifically, this sample application demonstrates the following:
Please note that while these examples work, features not called out above are not intended to be taken and used in production business applications. In other words, this is not a seed project to be taken cart blanche and deployed to your production environment.
For example, certain concerns are not addressed at all in our samples (e.g. security, privacy, scalability). In our sample apps, we strive to strike a balance between clarity, maintainability, and performance where we can. However, clarity is ultimately the most important quality in a sample app.
Therefore there are certain instances where we might forgo a more complicated implementation (e.g. caching a frequently used value, robust error handling, more generic domain model structure) in favor of code that is easier to read. In that light, we welcome any feedback that makes our samples apps easier to learn from.
In order to successfully run this sample app you need a few things:
lib
folder)config.properties
, set oauth.type as 1 or 2 depending on type of app you have. For OAuth2 apps set value as 2.config.properties
file values (companyid, oauth2.accessToken).config.properties
file values (companyid, app token, consumer key, consumer secret, access token key, access token secret).Once the sample app code is on your computer, you can do the following steps to run the app:
./gradlew bootRun
(Mac OS) or gradlew.bat bootRun
(Windows)Webhooks requires your enpoint to be exposed over the internet. The easiest way to do that while you are still developing your code locally is to use ngrok. Here are the steps to configure ngrok
Standard Java coding structure is used for the sample app
Java code is located in the src.main.java
directory
Property files are located in the src.main.resources
directory
JUnit test files are located in the src.test.java
directory
This app uses an in-memory temporary H2 database. The tables are loaded during startup with realmId and oauth tokens. The table is read and updated when webhooks notification is processed. Stopping the server will delete the records. The oauth tokens are encrypted and stored in the database. There is a sample encryption implementation provided using fake keys. For production use real keys, this can be updated in application.properties