Rails 上 Ruby 的 Instagram Webhook

Instagram Webhook for Ruby on Rails

webhook 的文档在 javascript 中,我正在寻找 rails 代码。

app.post('/instagram', function(req, res) {
  console.log('Instagram request body:');
  console.log(req.body);
  // Process the Instagram updates here
  received_updates.unshift(req.body);
  res.sendStatus(200);
});

'req.body',如何在 rails 控制器中输入?

这是 webhook 的整个示例项目的 link。 https://github.com/fbsamples/graph-api-webhooks-samples/blob/master/heroku/index.js

我正在尝试获取 Instagram 媒体帖子中的评论。

RestClient

require 'rest-client'

response = RestClient.post('/instagram')
response.body

Net::HTTP

require 'net/http'

response = Net::HTTP.post_form(URI('/instagram'))
response.body