Can I make Sync Gateway run linux code on every request


I am trying to get Sync Gateway to check if a POSTed JSON document has alert_state:1 and then run a curl request or similar API request to send an SMS alert via the twilio API. Just wondering if this is possible without constantly polling the database every few minutes or so.