The Java sample code provides a simple application server implemented using the Spark framework . The app server consumes incoming webhook events from Helpshift, and processes them to simulate the following work flows -
- Update issue in Helpshift using Helpshift API on create issue event.
- Send Slack alert on create issue and update issue event.
- Create Jira ticket on issue create event and update Jira ticket on update issue event.
-
Update the properties file to replace the placeholder values with real values. Read Slack Setup , JIRA Setup and Managing your API keys for api keys for how to retrieve real values.
-
Run mvn package. This will generate a self-contained jar with all dependencies included.
mvn package
-
Start the server.
java -jar target/webhook-examples-1.0.0-jar-with-dependencies.jar
This will start a test server listening on port 4567.
-
To test the server locally, we have provided some sample webhook events in the sample-payloads directory. You can directly feed these sample events to the server using curl. Note that since these are dummy payloads, the Helpshift handler will not work, and so should be commented out before running the server (see Server.java ). Sample payloads can be found here
cd ../sample-payloads
curl -X POST --data @create_issue_events.json http://localhost:4567/webhook
curl -X POST --data @update_status_event.json http://localhost:4567/webhook