I don't know AppleScript. So I can only guide you to the right RingCentral APIs for getting incoming call alerts. The rest will be you to investigate how to implement an http server with AppleScript for listening to incoming webhook post requests.
You need to call the subscription API and subscribe for presence events to get push notification of presence events. When your app receives an event via webhook, check the telephonyStatus and if it is in 'Ringing' status, it is an incoming call alert.