How to setup automated new topic based off a Rails model?


#1

So I have my Rails app that has a model such as Article with attributes { :photo, :title, :url }

I want to create a background job that uses this model to come and post these articles onto my Discourse message board (hosted by digital ocean on a separate server and accessed by sub-domain) as new topics… besides using a web crawler… is there some kind of way to hookup my App’s model to Discourse API to automate creating new topics based off the model data?


(Matt Palmer) #2

Sure, you could use an after_create hook to spawn a sidekiq job to do a POST to the Discourse API. Apart from the mechanics of the POST, though, none of that is really Discourse-specific, and while Discourse uses ActiveRecord and Sidekiq, you might get better and more timely help asking about the hooking and sidekiq aspects of your task in fora dedicated to those topics.