用Smartsheets替换我们现有的界面非常有用,因为客户端已经使用了Smartsheets,我们的原型有点笨重。为此,我正在构建一个原型,以便学习Smartsheet API,当我尝试设置webhook时,它会中断。
这是我尝试更新/启用webhook时的输出:
{"message": "SUCCESS",
"resultCode": 0,
"result": {
"id": 4253946970695556,
"name": "Webhook_test",
"apiClientId": "3oqnphhimgqzyimk40",
"apiClientName": "ChoiceIP",
"scope": "sheet",
"scopeObjectId": 7055538769946500,
"events": [
"*.*"
],
"callbackUrl": "https://ghwd.net/write_requests_to_log.php",
"sharedSecret": "kpnc4nz7gwy91yjzcah2s6neq",
"enabled": false,
"status": "DISABLED_VERIFICATION_FAILED",
"disabledDetails": "An error occurred during SSL handshake. (ref id: fwhc0949r7km)",
"version": 1,
"createdAt": "2016-07-06T12:04:13Z",
"modifiedAt": "2016-07-07T06:04:20Z"
}
}
以下是应该创建响应的脚本代码:
$headers = getallheaders();
if( isset( $headers['smartsheet-hook-challenge'] ) ) {
header("Smartsheet-Hook-Response: " . $headers['smartsheet-hook-challenge']);
echo $headers['smartsheet-hook-challenge'];
return;
} else if( isset( $_POST['smartsheet-hook-challenge'] ) ) {
header("Smartsheet-Hook-Response: " . $_POST['smartsheet-hook-challenge']);
echo $_POST['smartsheet-hook-challenge'];
return;
} else {
header("Smartsheet-Hook-Response: debug");
}
为什么SSL握手失败?
答案 0 :(得分:2)
您需要为域ghwd.net设置有效的SSL证书,或使用具有有效SSL证书的域。
当您创建webhook时,Smartsheet将首先尝试通过安全连接连接到您的回调URL。如果无法建立安全连接,则会使用您看到的状态DISABLED_VERIFICATION_FAILED
禁用webhook。