Problem solved!
Solution:
In order to call the beta API, you must install the Microsoft Graph Beta Java SDK
https://learn.microsoft.com/en-us/graph/sdks/use-beta?tabs=Java
Add the dependency in dependencies in pom.xml
<dependency>
<!-- Include the sdk as a dependency -->
<groupId>com.microsoft.graph</groupId>
<artifactId>microsoft-graph-beta</artifactId>
<version>0.73.0-SNAPSHOT</version>
</dependency>
<dependency>
<!-- This dependency is only needed if you are using the TokenCrendentialAuthProvider -->
<groupId>com.azure</groupId>
<artifactId>azure-identity</artifactId>
<version>1.2.5</version>
</dependency>
Add the repository in repositories in pom.xml
<repository>
<id>sonatype-snapshot</id>
<name>Sonatype Snapshot</name>
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
</repository>
More details:
The current version of Graph 1.0 does not support rich notification for Messages. See link below:
https://learn.microsoft.com/en-us/graph/webhooks-with-resource-data
Available in only the beta endpoint:
New or changed personal contacts in a user's mailbox: /users/{id}/contacts
New or changed personal contacts in a user's contactFolder: /users/{id}/contactFolders/{id}/contacts
New or changed events in a user's mailbox: /users/{id}/events
New or changed messages in a user's mailbox: /users/{id}/messages
New or changed messages in a user's mailFolder: /users/{id}/mailFolders/{id}/messages
Teams Meeting status information updates: /communications/onlineMeetings/?$filter=JoinWebUrl eq '{joinWebUrl}
New or changed members in all channels across the entire tenant: /teams/getAllChannels/getAllMembers