rss feed integration with rocket.chat ?

865 views
Skip to first unread message

Stf Cand

unread,
Sep 7, 2016, 9:03:24 AM9/7/16
to sandst...@googlegroups.com
Hi all, 

I'm using sandstorm for work with a larger group of aprox 60 people and growing and I'd like to integrate an RSS feed of annotations into a dedicated rocket.chat channel. 

Tiny Tiny RSS works great as a sandstorm grain, but I'm looking at something that can be integrated into chat rooms/channels, similar to what I can do in Slack. 

The user scenario is that more people in the group work on a web-based data collection and annotate discoveries; annotations feed an RSS stream based on the url, the user, tags or sub-groups. Would be great if such "discoveries" would flow into the group chat. 

Did anybody work on something like that ?

cheers, 
Stefan


akim...@gmail.com

unread,
Sep 7, 2016, 1:48:13 PM9/7/16
to Sandstorm Development
Hi everyone,

I am helping the op (Stefan) work on this project. I can easily extract the annotations he talks about via the app's API or via a RSS feed. So getting them is not a problem. I am hitting a wall when trying to post those annotations' links and text to a Rocket chat channel that living in a Rocket chat Sandstorm grain.

I am trying to use Rocket chat's REST API as documented here: https://rocket.chat/docs/developer-guides/rest-api/ and following the Sandstorm docs (https://docs.sandstorm.io/en/latest/developing/http-apis/) to get the API requests through Sandstorm to the Rocket chat grain.

Using curl to test, I manage to get the API version and to do an initial login into Rocket chat, which tells me the API calls work, they get through to the right grain:

Request:
curl -H "Authorization: Bearer <my_api_token_from_the_sandstorm_grain" https://api-<my_unique_sandstorm_endpoint>.my.domain/api/login -d "user=rocket.cat&password=secretpassword"

Reply:
{
"status": "success",
"data": {
"authToken": "my_rocket_chat_token",
"userId": "rocket.cat"
}

Then when I try to do any other authenticated api request with the above username and token, it fails:

Request:
curl -H "Authorization: Bearer <my_api_token_from_the_sandstorm_grain>" -H "X-Auth-Token: <my_rocket_chat_token>" -H "X-User-Id: rocket.cat" https://api-<my_unique_sandstorm_endpoint>.my.domain/api/publicRooms

Reply:
{
"status": "error",
"message": "You must be logged in to do this."
}

Any ideas? What am I missing?

Thanks,
Dan

David Renshaw

unread,
Sep 7, 2016, 2:15:33 PM9/7/16
to akim...@gmail.com, Sandstorm Development
I tried playing around with this just now, and I successfully set up
the ability to post messages through the HTTP API.

In the Rocket.Chat UI, I navigated to: administration -> integrations
-> new intregration -> incoming webhook

This ended up giving me the URL:
http://127.0.0.1:8000/hooks/4hbzKH6Tx59HryqaS/eWAPxSQGQH4svuMTK6TnQJJf3rKvvQXjCAeEzHxeogusv76x

Using the path component from that, I was able to send a message like this:

curl -H "Authorization: Bearer
fTMxM3sljRSFiyhvNvydb5pKyvSJmnH9ixW-jZM1V6995b28f6b123dc2744f16d4461cb0b.sandstorm-radon.dwrensha.ws:6080/hooks/4hbzKH6Tx59HryqaS/eWAPxSQGQH4svuMTK6TnQJJf3rKvvQXjCAeEzHxeogusv76x
--data-urlencode 'payload={"text":"Example
message","attachments":[{"title":"Rocket.Chat","title_link":"https://rocket.chat","text":"Rocket.Chat,
the best open source
chat","image_url":"https://rocket.chat/images/mockup.png","color":"#764FA5"}]}'




- David
> --
> You received this message because you are subscribed to the Google Groups "Sandstorm Development" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sandstorm-de...@googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

Kenton Varda

unread,
Sep 7, 2016, 4:16:52 PM9/7/16
to David Renshaw, akim...@gmail.com, Sandstorm Development
Looks like we should adjust Rocket.Chat's incoming webhook UI to display an offer template!

We should also hide a lot of the stuff in Rocket.Chat's admin UI that isn't applicable to Sandstorm (e.g. all the login providers...).

-Kenton

> To unsubscribe from this group and stop receiving emails from it, send an email to sandstorm-dev+unsubscribe@googlegroups.com.

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Sandstorm Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sandstorm-dev+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/sandstorm-dev/CACejzEAJXzghVd67sCzaJGZm645HUiH85rQJuS6ZuQRgNStGAA%40mail.gmail.com.

Stefan Candea

unread,
Sep 8, 2016, 6:17:07 AM9/8/16
to Sandstorm Development, da...@sandstorm.io, akim...@gmail.com
Grat, thanks for your replies, really helpful and fast as usual!

I know Dan is working on this and we'll report back, maybe useful for others as well.  

and yes, Kenton, would be great to know what's not possible in Sandstorm from the Rocket.Chat UI, especially for non-tech users like me [I fancy having an API integration with the GitLab Issues for instance, and now I don't think that's possible, but that's another issue]

cheers, 
Stefan 

> To unsubscribe from this group and stop receiving emails from it, send an email to sandstorm-de...@googlegroups.com.

> For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "Sandstorm Development" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sandstorm-de...@googlegroups.com.

akim...@gmail.com

unread,
Sep 8, 2016, 1:02:58 PM9/8/16
to Sandstorm Development, akim...@gmail.com, da...@sandstorm.io
Hi David,

Thanks for the quick reply! So that was how I was supposed to do it, use the webhooks! I have tried initially, but I thought the '/webhooks' URI wasn't forwarded by Sandstorm to the grain. I was missing the authorization header.

It worked, I can easily post messages now. Thanks a lot!
Reply all
Reply to author
Forward
0 new messages