5 Desember 2024
Integrasi sitejet form dengan whacenter
kirim pesan WA setelah isi form di site builder
Script PHP contoh
<?php
$data_raw = file_get_contents('php://input');
$data_array = [];
parse_str($data_raw, $data_array);
$decoded_data = json_decode($data_array['data'], true);
$first_name = $decoded_data['First Name'] ?? 'N/A';
$last_name = $decoded_data['Last Name'] ?? 'N/A';
$email = $decoded_data['Email'] ?? 'N/A';
$company = $decoded_data['Company Name'] ?? 'N/A';
//$website = $decoded_data['Website'] ?? 'N/A';
$nohp = '085640206067';
$pesan= 'Ada input form baru
First name :'.$first_name.'
last name :'.$last_name.'
Email :'.$email.'
No WA :'.$nohp.'
company :'.$company.'
ini dikirim dari webhook';
$deviceid = 'xxx'; // ganti dengan device id anda
$url = 'https://app.whacenter.com/api/send';
$ch = curl_init($url);
$data = array(
'device_id' => $deviceid,
'number' => $nohp,
'message' => $pesan,
);
$payload = $data;
curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$result = curl_exec($ch);
curl_close($ch);
echo $result;
?>
Komentar terbaru