huginn / huginn

Create agents that monitor and act on your behalf. Your agents are standing by!
MIT License
42.8k stars 3.74k forks source link

Make it possible to trigger RSS agent by feeding it an event. #2332

Open virtadpt opened 6 years ago

virtadpt commented 6 years ago

I have an RSS feed from a Shaarli installation for a particular tag:

https://shaarli.example.com/?do=rss&searchtags=huginn

Users of Shaarli can only access the RSS feeds if they are either logged into the instance (which Huginn would not be), or if they authenticate to Shaarli with a JSON Web Token. (I've written and tested a separate piece of code which does this. A Post Agent has demonstrated that it can get a valid JWT from my code.)

Unfortunately, it does not seem possible to send the output of another agent (the Post Agent which acquired the JWT) to the RSS Agent, even though the RSS Agent can include arbitrary headers with its requests.

I've spent most of tonight trying to parse the RSS feed with a Website Agent, but unfortunately I've not been able to get the information I need from it (it's all empty events - not helpful).

Is there some way to pass the output of the Post Agent to the RSS Agent before the JWT expires (it's only valid for nine minutes)? Failing that, how difficult would it be to modify the RSS Agent to accept events from other agents?

dsander commented 6 years ago

You could use a credential (which is updated via a JavascriptAgent) to share the token with the PostAgent. Using a Commander to update the RSSAgents options should also work. If the timing is an issue two SchedulerAgents could ensure that that token is always updated X minutes before the RssAgent runs.

Failing that, how difficult would it be to modify the RSS Agent to accept events from other agents?

Not very, you would like to take the incoming Events, interpolate the options with it and check the feed, right?

virtadpt commented 6 years ago

Not very, you would like to take the incoming Events, interpolate the options with it and check the feed, right?

That is correct.

irfancharania commented 6 years ago

Taking it from another angle: does the REST API get you what you want? http://shaarli.github.io/api-documentation/

virtadpt commented 6 years ago

Yes and no. I'm having difficulty getting Huginn to work with a JWT generating server I wrote. I'll probably take another crack at it tonight. The thing is, if Shaarli is set to private by default you can't pull the RSS feeds without a JWT to authenticate anyway, so I was hoping to generate a JWT, send it to an RSS Agent, and proceed from there.