Hi @john john
According to your requirement, I suggest you create a Remote Event Receiver. The code in an event receiver can be triggered when an item is added/updated/deleted. In SharePoint online, remote event receivers handle events in the SharePoint add-in model. The Remote Event Receivers are a capability introduced with the SharePoint Add-In model, and they target both SharePoint on-premises 2013/2016 and SharePoint Online.
The Remote Event Receivers provide both -ing events, which are notified while something is happening, and -ed events, which are notified after something already happened. As such, a Remote Event Receiver can even cancel an event that is happening. The family of events that can be tracked are related to lists, items, sites, permissions, and many others.
Here is a demo for you to reference
If the answer is helpful, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.