What you are looking for is the information on how to set up an alert action
When you set up an alert to listen for a value of OK or NG as you describe you choose what Splunk should do once it kicks off or "triggers". Your choices are to Email, create an outputfile, log the events... or the ones you are looking for which are to kick off a script (that does anything you like... ) and or kick off a custom webhook alert action.
check out these two bits of doc and if they answer your questions in detail please do come back and select this as your answer.
With Splunk... the answer is always "YES!". It just might require more regex than you're prepared for!