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.
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.
We support any feed in RSS, Atom 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.
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 theSimple 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.
- Create a new flow (call it "New Item"), then add a trigger. Select the Feeds service, then choose New Item.
- 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.xml
- 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.
- Now add an action. This time choose Bot > Send a Message.
- 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.
- 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:
- 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.
- Create another new flow (call it "Subscribe"), and add a trigger. This time, select Bot > New Message.
- 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.
- 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:
- Finally, lets send a message back to the user to give them some feedback. So add a Bot > Send a Message action:
- When you've saved the last action, switch on the flow.
- 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!
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.
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".
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.
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.
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.