Hello,
I am new to this community!
I am setting up a hook that allows me to pass new client data to Zapier in order to update our Marketing automation software.
This is the code I have been testing now:
add_hook('ClientAdd', 1, function ($vars)
{
$userid = $vars['userid'];
$firstname = $vars['firstname'];
$lastname = $vars['lastname'];
$email = $vars['email'];
$phone = $vars['phonenumber'];
$city = $vars['city'];
$country = $vars['country'];
$postcode = $vars['postcode'];
$company = $vars['companyname'];
$state = $vars['state'];
$params = '?userid='.$userid.'&firstname='.$firstname.'&lastname='.$lastname.'&email='.$email.'&phonenumber='.$phone.'&city='.$city.'&country='.$country.'&postcode='.$postcode.'&companyname='.$company.'&state='.$state.'&source=WHMCS';
$url = 'https://hooks.zapier.com/hooks/catch/zzz/rrrr/'.$params;
$options = array( 'CURLOPT_POST' => 0 );
$response = curlCall($url,$postfields,$options);
logActivity('logged addClient with params: ' . $params . 'following is the result: ' . $request, $userid);
});
I also tried to send this via file_get_contents but it does not seem to work, by composing the url together with real world values gotten from the LOG in the admin area the request works on Zapier's end, I suppose that the problem lies within WHMCS and the request. The Zapier request has been altered for privacy reasons.
Can anyone point me in the right direction?