Default [Q] How to run action/script in Linux when I recive sms/call on Android phone?

I have a Nexus 5 phone and a Raspberry Pi.
On RPi I have a script I want to run every time I recive a SMS or Call on my phone. Everything should work over wifi (or BT) but without cables.

I was trying my best to find any possible solution but I failed to do so.

Do you have any hints for me? Maybe some link? Or is it even possible...?