# Java libraries for parsing notifications using Spring Boot REST Controller as the WebHook Endpoint

**URL:** <https://devforum.zoom.us/t/java-libraries-for-parsing-notifications-using-spring-boot-rest-controller-as-the-webhook-endpoint/34948>\
**Category:** API and Webhooks\
**Created:** [November 2, 2020, 9:18pm UTC](https://devforum.zoom.us/t/java-libraries-for-parsing-notifications-using-spring-boot-rest-controller-as-the-webhook-endpoint/34948 "2020-11-02T21:18:10Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![davielang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/davielang/32/18125_2.png) [@davielang](https://devforum.zoom.us/u/davielang)\
**Post date:** [November 2, 2020, 9:18pm UTC](https://devforum.zoom.us/t/java-libraries-for-parsing-notifications-using-spring-boot-rest-controller-as-the-webhook-endpoint/34948/1 "2020-11-02T21:18:10Z")

</div>

Are there any Java libraries available for parsing the notifications to events I have subscribed to in my WebHook EndPoint

I am going to use a Spring boot RestController for the WebHook endpoint, has anybody used this for creating an endpoint?

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [November 3, 2020, 6:17pm UTC](https://devforum.zoom.us/t/java-libraries-for-parsing-notifications-using-spring-boot-rest-controller-as-the-webhook-endpoint/34948/2 "2020-11-03T18:17:01Z")

</div>

Hey @davielang,

Thanks for joining our developer community!

While I’ll let our community check out your post as well, I did want to share some 3rd party resources (not Zoom Supported) that you might find helpful—For example:

> **[Top 5 JSON Library Java JEE Developers Should Know](https://javarevisited.blogspot.com/2016/09/top-5-json-library-in-java-JEE.html#axzz6cl04wXs9)**
>
> A blog about Java, Programming, Algorithms, Data Structure, SQL, Linux, Database, Interview questions, and my personal experience.

Thanks,  
Will

---

<div class="post-metadata">

**Author:** ![adam-sercante](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/adam-sercante/32/18354_2.png) [@adam-sercante](https://devforum.zoom.us/u/adam-sercante)\
**Post date:** [November 7, 2020, 5:41pm UTC](https://devforum.zoom.us/t/java-libraries-for-parsing-notifications-using-spring-boot-rest-controller-as-the-webhook-endpoint/34948/3 "2020-11-07T17:41:10Z")

</div>

I’ve just started myself.

I haven’t come across any Spring Boot specific resources.

One gotcha that I’ve come across and started to implement is that all webhooks are sent to a single endpoint. Here are some notes that hopefully help you out (not sure how this will come through in the forum post:

1. You will have a single controller method accepting ALL zoom webhooks as a single `@RequestBody`. This makes the Controller layer pretty basic, but poses challenges for Jackson deserialization as the incoming JSON payloads are different for each event type. There are probably more elegant ways to solve this, I’m still early in my development and am just posting what I have so far.

```auto
@PostMapping
@ResponseBody
public String handleWebhook(@RequestBody WebHookEvent event) {
    switch(event.getEvent()) {
        case WebHookEvent.WEBINAR_CREATED:
            webinarWebhookService.onCreated((WebinarCreated) event.getPayload());
            break;
        case WebHookEvent.WEBINAR_UPDATED:
            webinarWebhookService.onUpdated((WebinarUpdated) event.getPayload());
            break;
        case WebHookEvent.WEBINAR_DELETED:
            webinarWebhookService.onDeleted((WebinarDeleted) event.getPayload());
            break;
        case WebHookEvent.WEBINAR_ENDED:
            webinarWebhookService.onEnded((WebinarEnded) event.getPayload());
            break;
        default:
            log.warn("Unhandled event type: {}", event.getEvent());
            return "unhandled";
    }
    return "success";
}

```

1. The POJO that comes in as an argument to the Controller, I have it with 2 properties.

```auto
@JsonInclude(JsonInclude.Include.NON_EMPTY)
@JsonNaming(PropertyNamingStrategy.SnakeCaseStrategy.class)
public class WebHookEvent {
    public static final String WEBINAR_CREATED = "webinar.created";
    public static final String WEBINAR_UPDATED = "webinar.updated";
    public static final String WEBINAR_DELETED = "webinar.deleted";

    public static final String WEBINAR_ENDED = "webinar.ended";

    private String event;

    @JsonTypeInfo(use = JsonTypeInfo.Id.NAME, 
                              property = "event", 
                              include = JsonTypeInfo.As.EXTERNAL_PROPERTY)
    @JsonSubTypes(value = {
            @JsonSubTypes.Type(value= WebinarCreated.class, name=WEBINAR_CREATED),
            @JsonSubTypes.Type(value= WebinarUpdated.class, name=WEBINAR_UPDATED),
            @JsonSubTypes.Type(value= WebinarDeleted.class, name=WEBINAR_DELETED),
            @JsonSubTypes.Type(value= WebinarEnded.class, name=WEBINAR_ENDED)
    })
    private WebhookPayload payload;
}

```

The payload attribute is heavily annotated. You can adjust this for the event types you are expecting your code to handle.

In my WebinarCreated/Updated/Deleted/Ended classes (or any that you want), those all implement the empty interface WebhookPayload.

```auto
public interface WebhookPayload {

}

```

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [November 9, 2020, 8:06pm UTC](https://devforum.zoom.us/t/java-libraries-for-parsing-notifications-using-spring-boot-rest-controller-as-the-webhook-endpoint/34948/4 "2020-11-09T20:06:07Z")

</div>

Many thanks for sharing with the community, @adam-sercante 💯

---

<div class="post-metadata">

**Author:** ![davielang](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/davielang/32/18125_2.png) [@davielang](https://devforum.zoom.us/u/davielang)\
**Post date:** [November 10, 2020, 7:22am UTC](https://devforum.zoom.us/t/java-libraries-for-parsing-notifications-using-spring-boot-rest-controller-as-the-webhook-endpoint/34948/5 "2020-11-10T07:22:52Z")

</div>

That’s really useful Adam. It’s along the lines of what I thought it might be. I will give it a go. Thanks for that, it gives me a good start.

---

<div class="post-metadata">

**Author:** ![will.zoom](https://sea2.discourse-cdn.com/flex016/user_avatar/devforum.zoom.us/will.zoom/32/14417_2.png) [@will.zoom](https://devforum.zoom.us/u/will.zoom)\
**Post date:** [November 11, 2020, 5:48pm UTC](https://devforum.zoom.us/t/java-libraries-for-parsing-notifications-using-spring-boot-rest-controller-as-the-webhook-endpoint/34948/6 "2020-11-11T17:48:52Z")

</div>

Glad they could help you, @davielang! 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/zoomdeveloper/original/3X/6/1/614bdd549b610bbaa46ff934617683a02bdaa03c.png) [@system](https://devforum.zoom.us/u/system)\
**Post date:** [December 12, 2020, 3:48am UTC](https://devforum.zoom.us/t/java-libraries-for-parsing-notifications-using-spring-boot-rest-controller-as-the-webhook-endpoint/34948/7 "2020-12-12T03:48:52Z")

</div>

Closed on December 12, 2020, 3:48am UTC

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.
