Scripts or tools that listen to game events and notify the player somehow/somewhere are not legal.
Scripts can not listen to game events, such as receiving an attack for example.
Tools, can't get that info from outside the game since such info is not public and tools are only allowed to fetch the public data files.
So a Discord bot that automatically notifies a player/players on Discord whenever a new incoming is added is not okay.
There was in the past a method, utilizing the email notification that the game sent, however since then that email has been updated to include less information, so it could not be utilized for this.