I didnāt even use Gravity Forms Webhook Add on as I believe it has a fee.
I went into wp-content/themes/salient/fuctions.php. I use salient but use whatever is your current theme in WP.
Then I entered this:
add_action('gform_after_submission','post_to_third_party', 10, 2);
function post_to_third_party($entry, $form){
//Log In
$url = 'https://WEBSITE.COM/service/v4_1/rest.php';
$curl = curl_init($url);
curl_setopt($curl, CURLOPT_POST, true);
curl_setopt($curl, CURLOPT_HEADER, false);
curl_setopt($curl, CURLOPT_RETURNTRANSFER, true);
// Set the POST arguments to pass to the Sugar server
$parameters = array(
'user_auth' => array(
'user_name' => 'USERNAME',
'password' => md5('PASSWORD'),
),
);
$json = json_encode($parameters);
$postArgs = array(
'method' => 'login',
'input_type' => 'JSON',
'response_type' => 'JSON',
'rest_data' => $json,
);
curl_setopt($curl, CURLOPT_POSTFIELDS, $postArgs);
$response = curl_exec($curl);
// Convert the result from JSON format to a PHP array
$result = json_decode($response);
if ( !is_object($result) ) {
die("Error handling result.\n");
}
$session = $result->id;
//Get data
$parameters = array(
'session' => $session,
'module' => 'Leads',
'name_value_list' => array (
array('name' => 'survey_id_c', 'value' => 'XXXXX'),
array('name' => 'primary_address_street', 'value' => rgar($entry,'3.1')),
array('name' => 'primary_address_city', 'value' => rgar($entry,'3.3')),
array('name' => 'primary_address_state', 'value' => rgar($entry,'3.4')),
array('name' => 'primary_address_postalcode', 'value' => rgar($entry,'3.5')),
array('name' => 'first_name', 'value' => rgar($entry,'1.3')),
array('name' => 'last_name', 'value' => rgar($entry,'1.6')),
array('name' => 'phone_work', 'value' => rgar($entry,'2')),
array('name' => 'email1', 'value' => rgar($entry,'4')),
array('name' => 'qweb_01_c', 'value' => rgar($entry,'9')),
array('name' => 'qweb_02_c', 'value' => rgar($entry,'7')),
array('name' => 'qweb_03_c', 'value' => rgar($entry,'10')),
array('name' => 'qweb_04_c', 'value' => rgar($entry,'6')),
),
);
$json = json_encode($parameters);
$postArgs = 'method=set_entry&input_type=JSON&response_type=JSON&rest_data=' . $json;
curl_setopt($curl, CURLOPT_POSTFIELDS, $postArgs);
$response = curl_exec($curl);
$result = json_decode($response,true);
$recordId = $result['id'];