Feeds

This service was deprecated on 14th December 2016. You can still use it, but we strongly recommend you use the new broadcast service instead, which is simpler and more powerful.

Our feeds service allows you to watch an RSS or Atom feed and push new items out to anyone who has subscribed.

Introduction

If your business or organization has an RSS or Atom feed (for example a blog, news or updates feed), you can allow your bot users to subscribe to it, and then receive new items directly to the chat channel where they subscribed, as soon as new items are published.

To set up your bot to do this, you'll need at least 2 flows:

  • A trigger (New Item) that will fire every time there's a new item, for every individual subscriber to the feed.
  • A flow that will listen for requests to subscribe the user, and handle that (Subscribe).

You will probably also want to allow users to stop receiving new items (Unsubscribe). It's also possible to fetch recent items retrospectively once a user has subscribed (Get Items). This is useful for sending the user some content straight after they subscribe, or allowing the user to request the most recent items on demand.

Supported Feeds

We support any feed in RSSAtom or RDF format. The feed will be normalized and a standard set of outputs will be populated regardless of the feed. The content available, and in which field, is highly dependant on the feed, so you'll need to examine the outputs carefully.

Getting Started

We'll walk through setting up a simple set of flows to subscribe the user, and to send new items. If you don't want to set this up manually, you can actually install either the Simple Publisher or Multi Category Publisher templates with just a few clicks.

It's important to set up the trigger (to send new items) first. That's because we'll select the feed from a list when we use the Subscribe action in our other flow.

  1. Create a new flow (call it "New Item"), then add a trigger. Select the Feeds service, then choose New Item.
  2. You'll be asked for a Feed URL. In this case we'll use the BBC Top Stories feed at http://feeds.bbci.co.uk/news/rss.xmlsave image
  3. It's important to give your trigger a descriptive name, because this is what you'll see in the select box later when you subscribe a user to it. In this case, call it something like "BBC News Top Stories". Save the trigger.
  4. Now add an action. This time choose Bot > Send a Message.
  5. Each time this trigger is fired, you'll get a Response Path in the output, along with the details of the new item(s) found. In the Response Path field, select the Response Path output from the trigger.
  6. For the message, we'll keep this simple for now, and just output the title and alternate link (the link to the story on the BBC website). So we select the Item Title and Item Alternate URL outputs, like this:save image
  7. Finally, save the action and switch on the flow. You now have a flow that will distribute new items to your subscribers. Next, we need to allow users to subscribe.
  8. Create another new flow (call it "Subscribe"), and add a trigger. This time, select Bot > New Message.
  9. You'll probably already know how to set up a new message trigger, but if not you can read our guide. Leave all the settings as default and just type "subscribe" as the word that the flow should trigger on.save image
  10. Next, add a Feeds > Subscribe action. We want to subscribe the Response Path where we receive the "subscribe" message, to the feed we set up earlier, like so:save image
  11. Finally, lets send a message back to the user to give them some feedback. So add a Bot > Send a Message action:save image
  12. When you've saved the last action, switch on the flow.
  13. Test it by sending the message "subscribe" to your bot. You should see the confirmation message, and will start receiving news stories as they happen!

Advanced Usage

Unsubscribe

This is a basic feeds setup. When you use this for real, you'll want to at least give your users a chance to unsubscribe. You can either do this with a separate flow, or by having a single flow and using Ask a Question to present the user with some choices ("subscribe" or "unsubscribe").

The Unsubscribe action is similar to Subscribe, except of course it removes the subscription rather than creating it.

Get Items

The Get Items action will retrieve the latest items for a user who is already subscribed to the feed. A popular use case is to call this straight after subscribing the user and then send a message containing the most recent 3 articles.

You could also run this on demand, maybe when the user types "latest articles".

Using Collections

The New Item trigger and Get Items action return a collection containing 1 or more items (an array). If you use the outputs without modification, you'll be accessing the first item. This is sometimes enough, but you're highly encouraged to learn about collections so you can do things like accessing the first, second and third items, or looping through each item (magic repeat).

Offering a Choice of Feeds

To offer users a choice of feeds to subscribe to, you have a couple of options:

  • Use a separate flow for each feed.
  • Ask the user what feed they want to subscribe too and then add several Subscribe actions into your flow, filtering on the user's response.

FAQ's

What happens if the same user is subscribed more than once?

Nothing, a repeat request to subscribe a user after they've already subscribed doesn't fail, but doesn't change anything either. Unsubscribe works in a similar way.

Can I change a Feed URL later?

No, you should instead delete the trigger completely and add a new one. Users will need to resubscribe to the new feed.

How often are new items polled for?

We look for new items on a feed every few minutes.

More Help

We're always happy to help with suggestions on how you can get the most out of this and other features in Flow XO. Find out how to get support.

Still need help? Contact Us Contact Us