How to Trigger off coreaudio message for mic inputs?

Hi guys, I'm a newbie and I'm stuck trying to create a script to trigger when audio mic inputs are switched within an video conferencing app. I want to know when the secondary input is selected.
I have an applescript that can tell me which input is chosen: Internal Microphone or the secondary mic. However, I found out that input selection on the Mac audio remains the same even if I choose a different audio input for the app.

I reviewed the consoles and discovered the messages showing when the mic is active in the video conf zoom tool. Is there a way to tackle this and trigger on the changes?
coreaudiod default 20:57:38.859198 -0500 HALS_IOContextDescription.cpp:1128:PushStreamUsageToEngines_block_invoke: IOContext 111: pushing 1 input stream(s) to 'AppleHDAEngineInput:1F,3,0,1,0:1' coreaudiod
coreaudiod default 20:57:38.859235 -0500 HALS_IOContextDescription.cpp:1132:PushStreamUsageToEngines_block_invoke: IOContext 111: input stream[0] => Disabled: 'AppleHDAEngineInput:1F,3,0,1,0:1' coreaudiod
coreaudiod default 20:57:38.865985 -0500 HALS_IOContextDescription.cpp:1128:PushStreamUsageToEngines_block_invoke: IOContext 121: pushing 1 input stream(s) to 'AppleUSBAudioEngine:RNK Products:PCP-USB:14310000:1' coreaudiod
coreaudiod default 20:57:38.866029 -0500 HALS_IOContextDescription.cpp:1132:PushStreamUsageToEngines_block_invoke: IOContext 121: input stream[0] => Enabled: 'AppleUSBAudioEngine:RNK Products:PCP-USB:14310000:1' coreaudiod

It sounds like you want to use AppleScript within KM to resolve this. That's a better approach than my approach, which would be to use Find Image to view the app you are using. There are plenty of AppleScript experts on here that can help with using AppleScript.

Another possible approach is using an Execute Shell Script action to use a macOS command to fetch the devices that macOS sees. This is actually a pretty decent idea. But I have very little experience with the macOS commands that list hardware devices (the "system_profiler" macOS command). But this could be an idea for further consideration.

I just discovered another macOS command which is 100x faster than system_profiler called "ioreg" which lists lots of audio devices on my computer. That might contain the information you need too. Check it out. You can also trim the output of that command to audio data only using the -p option.

Thanks @Sleepy. You've given me some good pointers to get me moving in a direction. The ioreg is loaded with some information so I'm parsing through output and looking for patterns that could be useful.