Hi everyone
I want to know parameter of HTTP callback Alert for configure php file to Line alert.
This is my php code.
<?php
$message=$_POST['check_result'];
$sendmsg ="\nMessage=".$message;
$accessToken = $_GET['token'];
$ch=curl_init();
curl_setopt($ch,CURLOPT_URL,"https://notify-api.line.me/api/notify");
curl_setopt($ch,CURLOPT_SSL_VERIFYHOST, 0);
curl_setopt($ch,CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch,CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch,CURLOPT_POST,1);
curl_setopt($ch,CURLOPT_POSTFIELDS, "message=".urlencode($sendmsg));
curl_setopt($ch,CURLOPT_FOLLOWLOCATION, 1);
$headers = array(
'Content-type: application/x-www-form-urlencoded',
'Authorization: Bearer '.$accessToken, );
curl_setopt($ch, CURLOPT_HTTPHEADER, $headers);
$status = curl_exec($ch);
$error = curl_error($ch);
curl_close($ch);
if($error) {
echo 'error: '.curl_error($ch);
}
else {
$result_ = json_decode($status, true);
echo "status : ".$result_['status'];
echo "message : ". $result_['message'];
}
?>
jochen
(Jochen)
2
Hi Jochen
I see already but I don’t understand.
jochen
(Jochen)
4
It’s an example of the JSON payload sent via HTTP POST by the Graylog HTTP alarm callback.
You can get the information you need out of that JSON structure.
Hi Jochen
I have a bit question.
How to get value “matching_messages” such as $dataJson[‘check_result’][‘matching_messages’][‘source’] ?
Please tell me.
jochen
(Jochen)
7
matching_messages
is an array and you have to iterate over it to access individual messages.
Please tell me for example.
$dataJson[‘check_result’][‘matching_messages’][0]?
jochen
(Jochen)
9
Hi Jochen
Thank you for your information.
if i would like to get title name of alert, Do you have how to?

jochen
(Jochen)
11
That’s part of the JSON structure you receive from the Graylog HTTP Alarm Callback (“check_result” → “triggered_condition” → “description”).
system
(system)
Closed
13
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.