Ruby on Rails的Instagram Webhook

时间:2018-08-21 06:51:00

标签: ruby-on-rails ruby facebook-graph-api instagram-api

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整个示例项目的链接。 https://github.com/fbsamples/graph-api-webhooks-samples/blob/master/heroku/index.js

我正试图在Instagram媒体帖子中获得评论。

1 个答案:

答案 0 :(得分:0)

RestClient

require 'rest-client'

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

Net::HTTP

require 'net/http'

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