首页 > 解决方案 > 适用于 Ruby on Rails 的 Instagram Webhook

问题描述

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 媒体帖子中获得评论。

标签: ruby-on-railsrubyfacebook-graph-apiinstagram-api

解决方案


休息客户端

require 'rest-client'

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

网络::HTTP

require 'net/http'

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

推荐阅读