Skip to content

Latest commit

 

History

History
55 lines (28 loc) · 5.21 KB

Readme.MD

File metadata and controls

55 lines (28 loc) · 5.21 KB

Google Alerts to Slack converter

A proxy server to prettify Google Alerts RSS feeds for displaying them in Slack RSS app.

Why it is needed

Google Alerts is a free and convenient tool for tracking web mentions of your company, your stocks, your favorite football team or yourself. It can send the mentions it finds to your email or generate an RSS feed with them. If you use Slack messenger and want to share the mentions found by Google Alerts with co-workers or friends there, you can install Slack's RSS app and add your Google Alerts feeds to it. After that, all the new mentions will appear in a configured Slack channel.

While it all seems easy and straightforward, there's one problem with this approach. The feeds that you receive from Alerts are poorly formatted and don't look nice in Slack. For example, instead of direct links to the website containing a mention you are interested in, you will receive proxy links to Google servers that will be resolved into target links after clicking on them. This is inconvenient, because it prevents Slack from downloading the image contained at the target URL and embed it into the message. Also, Google feeds use HTML <b></b> tags to mark searched terms bold. Slack doesn't support them and requires you to mark bold text with asterisks. The converter fixes this too.

Also, with the help of this converter you can rename your feeds to something more relevant than autogenerated names provided by Google. Neat, right?

It should also be possible to feed the output of this converter to other RSS readers, but your experience may vary. Feel free to fork this repository and adjust its source code (it's just one file, nothing to be scared about) to better suit your needs, or create an issue.

Raw Google RSS feed with no extra formatting Raw Google feed with no extra formatting

Formatted Google RSS feed Formatted Google RSS feed

Installation

This converter is implemented as a Flask application written in Python. To install it, you need in python with flask module. You can use virtualenv and pip to simplify Flask installation.

After Flask is installed, run python rss_converter.py to start the server.

For Slack RSS app to connect to the converter, you'll need to have a static IP address or a domain name configured for the server used to run this script. As an alternative, you can use a free ngrok plan to create a tunnel to the localhost of a machine running the script.

Configuration

  1. You have to log in into Google Alerts with your Google account and configure the RSS feeds you're interested in. If you just want to see this script in action, you can omit this and the following step to use pre-configured sample feeds.

  2. Open feeds.py and update it with the URLs of feeds you created at a previous step. Add or remove entries as needed.

  3. Log in into your Slack account, go to Apps directory and install RSS app if you don't have it installed yet.

  4. Add your proxied feeds to the Slack RSS reader. Use <root>/feed/<route> as a URL. Here, <root> is the root address of the Flask installation accessible from the Internet, route is a parameter specified in feeds.py for the given feed. For example, if the script runs at [http://example.com], use http://example.com/feed/google-news as a URL of a sample Google News feed.

  5. Stop the proxy server if it already runs and restart it with python rss_converter.py command.

Now you should be all set. However, new mentions won't appear in Slack instantly. RSS app won't forward the historic feed entries to Slack, only the new mentions will appear there. It might take Google several hours or a whole day to update the feed, even for popular search terms, so be patient.

License

MIT License

Copyright 2017 Zmicier Zaleznicenka

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.