【问题标题】:Instagram Webhook for Ruby on Rails [duplicate]Ruby on Rails 的 Instagram Webhook [重复]
【发布时间】:2019-01-27 07:31:29
【问题描述】:

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 媒体帖子中获取 cmets。

【问题讨论】:

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


    【解决方案1】:

    RestClient

    require 'rest-client'
    
    response = RestClient.post('/instagram')
    response.body
    

    Net::HTTP

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

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2011-09-30
      • 2012-11-23
      • 1970-01-01
      • 2012-04-04
      • 2012-07-05
      • 1970-01-01
      • 1970-01-01
      • 2011-06-17
      相关资源
      最近更新 更多