I wonder if anyone already succeeded to integrate The Blue Alliance with Slack (http://slack.com/). Our team 3130 is using Slack for all teamwork communications as well as for keeping in touch with parents and all other fans of the team. I’d expect some other teams might do the same. So my thinking is it would be great if there was a way to have a channel for TBA updates into Slack that everyone on the team could monitor and didn’t have to poll the TBA servers individually.
I can see TBA provides an API for push notifications via webhooks. The Slack can receive webhook POST requests as well. The only problem is how to reshape TBA’s payload into Slack’s format (https://api.slack.com/incoming-webhooks). Technically it should be possible to do either on TBA side or Slack side or on an intermediate http server. Have anyone tried any of these opportunities yet? Thank you.
If nobody has done this already, I’d totally be willing to help do it. Would be pretty awesome to have. We run a #live channel for watching streams and whatnot, so a “favorite teams” bot would be a perfect addition.
I love this idea! As the original author of TBA webhooks, it’s awesome to see people come up with cool uses for them.
I think you’re going to have to build your own server somehow to receive TBA webhooks and post to slack. I say so because TBA webhooks just return the raw data associated with an event. It does not return a human-readable string about what happened. It’ll be best to let end users (you) decide how you want your messages to read and to format them yourself.
That being said, I’ll definitely watch what you do with interest, and hope that you open source it!
This is so cool. Thanks for responses guys! I went ahead and created an account on Google App Engine for myself. They gave me 60 days of free trial - plenty for this season. Then we will see. Now I’m thinking what programming language to use. I’d guess following TBA it would be Python, right? Shall we create a project on GitHub? Of course it must be open source, not a tiny doubt about that.
That’s a wonderful library for polling TBA with GET requests. Must be a really powerful tool to run in a browser. What I was thinking of was a library to receive and parse POST requests from TBA so then the data could be recomposed into another POST and sent to Slack’s webhook.
App Engine actually has a free tier, and you shouldn’t need any more resources that that. Python works nicely on App Engine, so that’s a perfectly fine choice (other GAE choices are Java, Go, and PHP)
I’m not sure that library works if webhooks are used. The server wouldn’t actually poll the TBA API, the flow would go something like this:
Update:
I finally succeeded connecting the two webhooks: from TBA to Slack. Yay! It’s a -nasty hack- convoluted Python script running on Google Apps. So far it is very simplistic, basically just stripping JSON formatting for a couple of message types. I can’t open-source it yet because all the URLs and secrets are hard coded into the script. I’ll see how it works this upcoming weekend then will try to rewrite it in a more open-source-able form (after I’m done with my taxes as well). Stay tuned.
Alright. Sorry for the delay, our team 3130 happened to win its second regional and had to go to the world champs. So all our resources were taken by the preps. Now as the competitions season is over I managed to scratch some time to publish our code onto GitHub. Here it is.
That’s a very basic example we tested in our Slack team. So far only “Upcoming Match” and “Match Score” notifications are implemented. And even those are very basic.
I’d love to hear suggestions how to make the project more collaborative so others could contribute. For the starters the major conflict I already can see would be that if this project grows further everyone will want their own formatting for messages. For the meantime I have no idea how to handle that. Please chime in.