Function in functions.php by url

You can check for the presence of a specific query variable, so http://www.example.com?my_listener=test. You check for this on the init hook and if it isn’t there you just quit early and WP goes about it’s business. If it is there, you can then do something, just don’t forget to exit at the end or the full page loads and that can mess up the response you are trying to send to your app.

    function wpa_91930() {
        // if query var is not present just return
        if ( ! isset( $_REQUEST['my_listener'] ) || 'test' != $_REQUEST['my_listener'] )
            return;

        // send response
        echo "it works";

       // don't forget to exit when you are done
       exit;
    }

    add_action( 'init', 'wpa_91930' );