Skip to content

Commit dff4df0

Browse files
authored
Pembaruan proses.php
Menambahkan pesan notifikasi terakhir
1 parent 8c31003 commit dff4df0

File tree

1 file changed

+32
-0
lines changed

1 file changed

+32
-0
lines changed

proses.php

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -232,6 +232,26 @@ function prosesPesanTeks($message)
232232
$response = curl_exec($curl);
233233
curl_close($curl);
234234
$json2 = json_decode($response,true);
235+
236+
$curl = curl_init();
237+
curl_setopt_array($curl, array(
238+
CURLOPT_URL => "https://api.byu.id/api/inbox",
239+
CURLOPT_RETURNTRANSFER => true,
240+
CURLOPT_ENCODING => "",
241+
CURLOPT_MAXREDIRS => 10,
242+
CURLOPT_TIMEOUT => 0,
243+
CURLOPT_FOLLOWLOCATION => true,
244+
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
245+
CURLOPT_CUSTOMREQUEST => "GET",
246+
CURLOPT_HTTPHEADER => array(
247+
"msisdn: 61815xxxxxxx",
248+
"Content-Type: application/json",
249+
"Authorization: Bearer ISIKAN_BEARER_TOKEN_DISINI"
250+
),
251+
));
252+
$response = curl_exec($curl);
253+
curl_close($curl);
254+
$json3 = json_decode($response,true);
235255

236256

237257
//INI SEKAT BIAR GAPUSHINK
@@ -281,6 +301,18 @@ function prosesPesanTeks($message)
281301
$text .= " minute`\n\n";
282302
}
283303
}
304+
305+
$text .= "\n\n📩 *Last Inbox*\n";
306+
if ($json3['data'][0]['hasRead'] == 1) {
307+
$wisurung = "Already read";
308+
} else {
309+
$wisurung = "Unread";
310+
}
311+
$text .= "Message ID: `".$json3['data'][0]['id']."`\n";
312+
$text .= "Title: *".$json3['data'][0]['title']."*\n";
313+
$text .= "Message: ".$json3['data'][0]['content']."\n";
314+
$text .= "Time received: `".$json3['data'][0]['timestamp']."`\n";
315+
284316
$text .= "`Processed in ".$hitung." seconds`";
285317
sendApiMsg($chatid, $text);
286318
} else {

0 commit comments

Comments
 (0)