Java integration

Dear
do you have java app example calling n8n workflows via webhooks ?

No, but it’s a simple http request send to n8n’s webhook URL. So something like this should do:

HttpRequest request = HttpRequest.newBuilder()
    .uri(URI.create("https://yourn8nurl/webhook/foo"))
    .method("GET", HttpRequest.BodyPublishers.noBody())
    .build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());

You could use 3rd party tools such as Postman or Insomnia to build your request if you’re unsure, they come with options to export code for several different programming languages & libraries:

image

Java app start process and complete tasks

n8n would typically run in the background at all times waiting for webhooks (or other trigger events), so no need to start it from Java. Running workflows should work as described via webhooks :slight_smile:

As for management options you could take a look at your REST API using which you can create or edit your workflows for example: n8n public REST API | n8n Docs

There is no n8n SDK for Java, so all communication would have to take place via simple REST requests.

1 Like