Webhook - response body

Has anyone got any idea on how to grab the response body from a webhook request?

//Steph

Are you using our Webhooks add-on https://www.gravityforms.com/add-ons/webhooks/ a third party add-on or custom code?

I am using both actually.

I have a form that I have built with the basic license where I use the hook gform_after_submissionand I use wp_remote_post for my POST

     $cdquery = wp_remote_post( $url, array(
                'httpversion' => '1.0',
                'method' => 'POST',
                'timeout' => 45,
                'headers' => array(
                'authorization' => 'xxxxxxxxxxxxxxxxxxxxxxx',
                'Accept' => 'application/json',
                'Content-Type' => 'application/json',
                ),    
                'body' => wp_json_encode($args),
            ));

But the response in $cdquery is empty (The POST is successful)

I upgraded later on to the pro version and my other form has the webhooks add-on enabled. Very convenient as it builds the POST array in a breeze. I would like to be able to parse the results / response of the webhook. I.e.

  [response] => Array
        (
            [code] => 200
            [message] => OK
        )

Hope I make sense :slight_smile:

If $cdquery is empty but there is no error that’s what the 3rd party is returning, right? Have you tried that from a command line just to see what is returned?

After some digging, I found out the API stopped giving a response body…

It would be nice to extend the webhook add-on to read the response from the webhook.

2 Likes