Hi,
I am very not skilled with custom integration of APIs, and I am trying to set up a custom webhook for a formit form to connect to their CRM. Would anyone be able to point me in the right direction. This is what I have figured out so far.
<?php
$formit =& $hook->formit;
$allFormFields = $hook->getValues();
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => 'https://sandbox.sherpacrm.com/',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => '',
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 0,
CURLOPT_FOLLOWLOCATION => true,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_POSTFIELDS =>'{
"vendorName": "Village Website",
"sourceCategory": "Company Website",
"sourceName": "Company Website",
"sourceProspectId": "3045",
"sourceCommunityId": 4321,
"referralDateTime": "2019-02-28T18:23:18+0:00",
"advisorFirstName": "Bill",
"advisorLastName": "Mitchell",
"advisorEmail": "advisor@gmail.com",
"advisorReferralNote": "This is the referral note updated",
"advisorWorkPhone": "314-111-1111",
"residentContactFirstName": "Bonnie",
"residentContactLastName": "Smith",
"residentContactAddress1": "200 Main St.",
"residentContactCity": "Townington",
"residentContactState": "MO",
"residentContactPostalCode": "87654",
"residentContactCountry": "US",
"residentContactEmail": "resident40@gmail.com",
"residentAge": 90,
"residentGender": "F",
"residentMaritalStatus": "M",
"primaryContactResidentRelationship": "Daughter",
"primaryContactFirstName": "Test",
"primaryContactLastName": "Atrium Village",
"primaryContactEmail": "primary20@gmail.com",
"primaryContactHomePhone": "314-222-0022",
"referralNote": "Test Comment"
}',
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json',
'Authorization: Bearer API KEY'
),
));
$response = curl_exec($curl);
curl_close($curl);
echo $response;
return true;
Thank you