I am trying to set up a webhook from callrails platform. According to CallRail documentation it appears that my endpoint should response with a HTTP status code of 200? I've done webhooks before but never seen this one before. I am not getting anything after a call is made.
From call rails docs
"Your endpoint should respond with a HTTP status code of 2xx to indicate that the data was received properly. In general, a response status code other than 2xx indicates that the webhook was unable to complete the requested action."
This is the php code I am using. I just want to see the data being posted. Is there something I need to add to properly respond with 200 status code?
include('common.php');
if(!empty($_POST))
{
foreach($_POST as $key => $value)
{
$msg .= 'Key: ' . $key . ' => ' . $value . '<br>';
}
$ret = runner_mail(array('to' => 'xxxx', 'subject' => 'Callrail Call POST', 'htmlbody' => $msg));
$data = json_decode($_POST['body'], true);
if(!empty($data))
{
foreach($data as $key => $value)
{
$message .= 'Key: ' . $key . ' => ' . $value . '<br>';
}
$ret = runner_mail(array('to' => 'xxxxxx', 'subject' => 'Callrail Body Data', 'htmlbody' => $message));
}
}
Thanks for your feedback
question from:
https://stackoverflow.com/questions/66055566/callrail-webhook 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…