我尝试使用 webhook 来获取 JSON,我读到我应该安装 ngrok,因为 webhooks 在本地不起作用,所以我安装了 ngrok,并尝试遵循这个小教程:https ://medium.com/@derek_dyer/ rails-webhooks-local-development-7b7c755d85e3
我创建了我的路线:
get 'invoice/webhooks'
post 'invoice/webhooks' =>'invoice#webhooks'
Run Code Online (Sandbox Code Playgroud)
而我的控制器:
def webhooks
render json: response.body, status: 200
end
Run Code Online (Sandbox Code Playgroud)
我还在我的服务中插入了我的 URL:https : //ce0d99f7.ngrok.io/invoice/webhooks 以接收 webhook
我在终端中运行 ./ngrok http 3000 并收到一条消息
POST /invoice/webhooks 403 Forbidden
Run Code Online (Sandbox Code Playgroud)
有谁知道如何解决这个问题?
有人可以帮助我访问"value"
此深度嵌套的哈希:
hash = {
"data" => {},
"content" => [
{
"data" => {},
"content" => [
{
"data" => {},
"marks" => [],
"value" => "est ce que j'arrive à te choper",
"nodeType" => "text"
}
],
"nodeType" => "paragraph"
}
],
"nodeType" => "document"
}
Run Code Online (Sandbox Code Playgroud)