I have code for a webhook pull on my website. Here is the code:
$curl = curl_init();
curl_setopt_array($curl, array(
CURLOPT_URL => '
https://hooks.zapier.com/hooks/catch/8750787/2huuqpb/',
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 => json_encode(array(
array(
"Attribute" => "EmailAddress",
"Value" => $emailid
),
array(
"Attribute" => "FirstName",
"Value" => $firstname
),
array(
"Attribute" => "LastName",
"Value" => $lastname
),
array(
"Attribute" => "Phone",
"Value" => $mobileno
),
array(
"Attribute" => "mx_Best_Time_to_Call",
"Value" => $timetocall
),
array(
"Attribute" => "Source",
"Value" => "Website"
),
array(
"Attribute" => "Debt Value",
"Value" => $currentdebtlevel
),
array(
"Attribute" => "Debt Category",
"Value" => $debt_product
),
array(
"Attribute" => "Source of Income",
"Value" => $sourceofincome
),
array(
"Attribute" => "Payment Status",
"Value" => $payment_status
)
)),
CURLOPT_HTTPHEADER => array(
'Content-Type: application/json'
),
));
$response = curl_exec($curl);
curl_close($curl);
// Output response or handle it as needed
echo $response;
When i use the catch hook - it will only find 1 attribute and 1 value, and it splits up the requests.
In this example it has put firstname as request H, lastname as request I and emailid as request J. It doesn’t pick up any other attributes.
I tried switching to “catch raw hook” and all of the data goes into “raw body”. So i tried using “code by zapier” to parse it out via javascript:
var obj = JSON.parse(inputData.payload);
return obj;
When i test this, it again only returns the first attribute emailid.
Please help! I feel like this should be easy.