0

我正在尝试创建一个 GotoWebinar webhook,但每次都会收到 400 个错误请求

这是我的 callBackUrl 函数

Route::get('g2w/webhook', function(Request $request) {
  return response()->json([
        'success'=>true
  ],200);
});

这是我发布的 webhook 创建请求https://api.getgo.com/G2W/rest/v2/webhooks

[
    {
     "callbackUrl":"https://website.com/g2w/webhook/",
     "eventName":"webinar.created",
     "eventVersion":"1.0.0",
     "product":"g2w"
    }
]

我总是收到这个错误

{
    "timestamp": 1609341614915,
    "status": 400,
    "error": "Bad Request",
    "exception": "com.logmein.webhooks.exceptions.InvalidRequestException",
    "message": "Invalid callbackUrl. callbackUrl not returning 200 OK as response. Please retry after sometime",
    "path": "/v1/webhooks"
}

GotoWebinar 网络钩子文档

感谢您的帮助

4

1 回答 1

1

您的回调端点需要同时接受 GET 和 POST 请求。将“g2w/webhook”路由更改为:

Route:match(['get', 'post'], 'g2w/webhook', function(Request $request) {
  return response()->json([
        'success'=>true
  ],200);
});
于 2021-08-02T10:21:50.807 回答