Welcome to collective.ifttt!

https://travis-ci.org/collective/collective.ifttt.svg?branch=master https://coveralls.io/repos/github/collective/collective.ifttt/badge.svg https://readthedocs.org/projects/collectiveifttt/badge/?version=latest

Introduction

ifttt.com - If This Then That, also known as IFTTT (pronounced /ɪft/) - is a free web-based service to create chains of simple conditional statements, called applets. These applets can perform a configured action in response to a trigger. Triggers and actions are web services provided by platforms such as Facebook, Pinterest, Youtube, Spotify - and now, Plone sites.

Below are a few examples of IFTTT applets for better understanding:

  • If a video is liked on Youtube, then save the video details in Evernote
  • If a profile picture gets changed on Facebook, then update the same profile picture on Twitter
  • If I’m tagged in a photo on Facebook, then save it to my phone gallery
  • If I receive an email about a new Twitter follower in my Gmail inbox, then tweet the new follower a welcome message
  • If NASA posts a new astronomy picture of the day, then add it to my screensaver gallery.
  • Email me about Top Apps that have become FREE in the Apple App Store.
  • Automatically unmute my Android phone when I get back home.
  • Add a Spotify song from a liked YouTube Video.

collective.ifttt is an addon which enables any Plone site to play in the IFTTT ecosystem by allowing you to create IFTTT applets.

Below are a few examples of using IFTTT with Plone sites.

  • If a news item is published, then tweet about it or post it on Facebook.
  • If an event is published, then add it to my calendar.
  • If new users sign up for an event, then add them to a Slack channel.
  • If content changes, then record who edited it in a Google spreadsheet.

Contents

This documentation will teach you how to use collective.ifttt to create IFTTT applets for Plone sites. We’ll start with setting up a Plone RSS feed, which can be used on IFTTT without doing anything special. In the sections after that you will learn how to set up your IFTTT secret key and create IFTTT triggers, so you can create more customized applets.

Enabling RSS Feeds On Plone Sites

Introduction

Plone can generate RSS feeds from folderish content types like folders and collections. First you must enable syndication on your site so that RSS feeds will be generated. Then you can go to the collection or folder you want to use as a feed and adjust its syndication settings.

If you want to aggregate a particular set of content to an RSS feed, you can create a collection content item for that purpose. You can choose what content types to aggregate and filter by fields such as labels, dates, location or language. Collections are language aware so this works correctly on multilingual sites.

Once you have an RSS feed you can use it on IFTTT without doing anything special. (No secret key, no IFTTT trigger needed.)

Below are the steps to create an example RSS Feed on a Plone site. You can tweak the configuration to meet your requirements and make different kinds of RSS feeds given the flexibility of collections.

Enabling Syndication

Step 1

Go to Site Setup.

_images/Step1.png

Step 2

Select Syndication under General.

_images/Step2.png

Step 3

Select the following and save:

  1. Allowed
  2. Search RSS enabled (if you want to be able to use search results as feeds)
  3. Show settings button (this will enable the Syndication tab on the edit bar of folders and collections)
  4. Show feed link (this allows you to show an RSS link on the folder or collection)
  5. Save

You may optionally include author information and adjust the maximum number of feed items.

_images/Step3.png

Creating a Collection to Use as an RSS Feed

Step 1

Go to the site root. (This is a special type of object, so the Syndication tab will not show on the edit bar here, like it will on all other folders.)

_images/Step11.png

Step 2

Add a new collection.

_images/Step21.png

Step 3

Configure your collection. The configuration explained below will aggregate all available published content. This can be tweaked to suit your own requirements.

  1. Update Title to “Plone Site - RSS feed” or any other suitable name.
  2. For Select Criteria, choose Review State as Published. (Otherwise unpublished items will show in your feed and people will get an error when they click on that URL.)
  3. For Sort On choose Effective date and check Reversed Order.
_images/Step4.png

Step 4

On the Settings tab check Exclude from navigation if you want to make it disappear from the navigation tree.

Save your new collection.

_images/settings_tab.png

Step 5

If the collection’s content seems to be right, publish it using the State menu on the edit bar.

_images/publish_collection.png

Viewing Your RSS Feed

Step 1

Your RSS feed can be viewed by appending /RSS to your collection’s (or folder’s) URL - something like /path_to_collection/RSS. (Note that this is case sensitive, “/rss” will not work.) For our example the URL to the RSS feed is http://localhost:8080/Plone/plone-site-rss-feed/RSS

_images/Step8.png

Step 2

To show a link to the RSS feed on a collection or folder, enable it on the edit bar’s Syndication tab as shown below. This is an optional step - many sites choose not to show these feed links because it might confuse their users.

_images/Enable_feed_icon.png

Now your RSS feed is ready to be used in an IFTTT applet. You can test it by copy-pasting the RSS URL into an RSS Reader, like feeder.co or Mozilla Reader.

Configuring a Plone Site with an IFTTT Secret Key

IFTTT supports push notification, which can be leveraged to get instant notifications from a Plone site. To do that you need to configure the Plone site with your IFTTT secret key.

Follow the steps below to get your IFTTT secret key and save it in your Plone site.

Obtaining an IFTTT Secret Key

  1. Go to ifttt.com and sign up for an account.
  2. At the top click on ‘Search’ and find ‘Maker’. (Update: this is now named ‘Webhook’.)
_images/search_maker.png
  1. Click the ‘Connect’ button to create a Maker (Webhook) channel.
_images/settings_maker.png
  1. Click on the gear icon (Settings) on the top-right of the Maker (Webhook) channel to view your key.
_images/obtain_key.png

Saving an IFTTT Secret Key in Plone

  1. Go to Site Setup
_images/Step1.png
  1. Select IFTTT Settings under Add-on Configuration
_images/select_ifttt_settings.png
  1. Copy your key to the Secret Key field and click Save.
_images/store_key.png

Trigger IFTTT Action

In this section we will discuss what are IFTTT actions and how to configure and use them.

Eagle View

IFTTT actions are a powerful mechanism to automate dealing with content and 3rd party web services. They are created and configured using Plone Content Rule.

There are several steps, that follow one another:

Define the IFTTT action configuration

  1. create and name a new rule, specifying what triggers it to be executed
  2. then narrow it down, by using conditions, to execute only on the content items you want
  3. and configure the IFTTT action that should be taken

But by default it will not execute yet; there is one more step to take:

Apply it to a portion of your site. Or to the whole site, if you so choose to. You can also apply different/multiple IFTTT actions onto different/multiple part of your site.

Triggers, conditions, actions

A general overview what makes up a IFTTT actions, some sample use cases, and who can set up and use content rules.

What is a `IFTTT action`?

A IFTTT action will automatically perform an action when certain events (known as “triggers”) take place.

You can set up an IFTTT action to email (the action) whenever certain (or any) content is modified to a specific folder (the trigger).

Who can set up and use IFTTT actions?

Site Manager permissions are required to in order to set up and apply IFTTT actions.

What are the triggers and conditions that come with Plone 5.0?

The following general triggers are available by default:

  • Comment added
  • Comment removed
  • Comment reply added
  • Comment reply removed
  • Object added to this container
  • Object copied
  • Object modified
  • Object removed from this container
  • User created
  • User logged in
  • User logged out
  • User removed
  • Workflow state changed

These triggers can be made more specific by using conditions

The following general conditions are available by default:

  • Content type: the type has to be one or more specific ones, like a Page or News Item
  • File extension: do only for type .PDF, for instance
  • Workflow state: only act on unpublished items, for instance
  • Workflow transition: only act when an item is being published
  • User’s Group: only act when one of the “Sports Team” members logs in
  • User’s Role: only act when a Site Administrator logs in
  • TALES expression: an advanced, programmable condition.

Creating and Defining Content Rules

IFTTT actions are configured inside content rules. So before starting with IFTTT actions, content rules have to be defined.

Creating a Rule

Content rules are created globally through the Plone Control Panel (“Site Setup” link) and then selected from the Rules tab for the desired folder (or at the Plone site root if you want the rule applied site-wide).

In this example, you’re going to create a content rule that will send an email any time a News item is modified.

  • Go to site setup
_images/site_setup.png
  • Select “Content Rules” in General tab.
_images/Content_Rules_on_site_setup.png
  • The first option, “Disable Globally”, allows you to disable ALL content rules. This is the emergency brake, for when you have created rules that are not doing what you want.
  • In the second section of the main page for Content Rules is where any existing content rules will be listed. There are also some checkboxes to filter them, which can be useful if there are many rules defined.
_images/add_content_rule.png

If no content rules exist, the only option is an “Add content rule” button. Click that.

An “Add Rule” form comes up. Enter a descriptive title – for this example, use: “Send Email when any News item is Modified”. Enter a description if desired.

For the “Triggering event” select “Object modified”. Leave “Enabled” checked, and “Stop executing rules” and “Cascading rule” unchecked.

_images/configure_content_rule.png

Click the “Save” button. At this point, you have essentially created a “container” for the content rule.

Next you’ll further define the trigger and actions for this rule.

_images/save_content_rule.png
Defining conditions and actions

After creating a content rule, you need to actually define the specific conditions of the trigger and actions that will occur based on those conditions.

For the condition:

  • By default, “Content type” is selected and since you want a trigger only for News item, click on the “Add” button.
  • From the “Add Content Type Condition” page, select “News item” and click on “Save”
_images/configure_trigger.png

For the action:

  • Select “IFTTT Trigger Action” from the drop down menu and click on the “Add” button.
_images/select_action.png
  • From the “Add IFTTT Trigger Action” page, fill out the form:
  • For the “IFTTT applet name” enter: the IFTTT applet which you want to trigger. For the given example, enter “send_email”
  • Choose the 3rd payload from available options (values of which will be dynamically fetched from the content which trigger this action) :
    • description - Description/Summary of content
    • username - Username of Editor
    • start - Event Start Date/Time
  • Click the “Save” button.
_images/configure_action.png

Congratulations, you have created a working IFTTT Trigger Action content rule!

Data sent to IFTTT applet

In the data sent to IFTTT, following values will be dynamically included (for which content on the site this content rule triggers):

  • Title
  • absolute_url
  • Chosen 3rd Payload

In the next sections, you’ll learn how easy it is to apply this content rule to any part (or all) of your Plone site.

Assigning a Content Rule

Now that you’ve set up a content rule, how does it actually get used?

At this point, you have successfully created a content rule. However, this content rule isn’t actually in use until it has been assigned and enabled on one or more folders.

  • Navigate to the folder where you want the content rule to be in effect. This can be any folder on the Plone site or it can be for the entire Plone site (“Home”) with the condition that, it only be triggered by configured content type (in this case we have configured it to news item in earlier section). So, in this example we’re going to the “News” folder.
  • Click on the “Rules” tab. From there you will see a drop down menu of possible content rules:
_images/rules_tab.png
  • Select the desired content rule (“Send Email…” in this example) and click on the “Add” button.
  • By default, the rule has now been applied to the current folder only as indicated by the symbol in the “Enabled here” column indicates.
_images/select_content_rule.png

There will be several buttons near the bottom.

Tick the check box for the rule you want (“Send Email…”) and then click on either “Apply to subfolders” button.

Now this content rule will also apply to any subfolder that exist now or are created in the future.

If you wish to have this rule apply to all the subfolders but not to the current folder , then tick the check box next to the rule and click on the “Disable” button.

Managing Multiple Rules

For each rule, you can define if additional rules should be applied after it, or if it is the end of the pipeline.

Furthermore, you can configure if you want rules to be cascading or not. The configuration is available in content rule configurations under General Tab of site setup.

An example: the first ContentRule is triggered for a content item, which is then moved to a folder. But, in this folder, another ContentRule is active, which will operate on any new content item that gets moved into that folder. Cascade means that yes, the second rule should be applied.

Working example of IFTTT Action

Now, that rules have been configured for “New folder”. So IFTTT actions will be triggered if any content on News is modified.

For example, below we will create a new news item and further update it’s content to trigger IFTTT send_email applet.

Create news item
  • Select Add new - news item
_images/new_news_item.png
  • Fill in form for new news. And click save.
_images/fill_new_news_item.png
Update news item
  • Select Edit for news item.
_images/edit_new_news_item.png
  • Update news item. And click save.
_images/update_new_news_item.png
Triggered the IFTTT Applet
_images/IFTTT_trigger.png

Content Trigger

This document will guide admins to add an IFTTT “Content Trigger” to any folder on their site that will send a trigger to IFTTT when content at or below the current path is published. This will allow them to create IFTTT applets to, for example, email, tweet, or Facebook post about the content.

Follow the steps given below to Add an IFTTT Content Trigger onto any folder.

  1. Traverse to folder on which you desire to apply IFTTT content trigger.
  2. From actions menu select Add Ifttt Content Trigger
_images/select_actions.png
  1. Fill the given form with required values and click Add
_images/fill_form.png
  1. Tada, trigger has been applied on your folder!!
_images/success.png

Behind the Scenes

This section details all jobs performed behind the scenes after form gets filled.

1. A new Content Rule is dynamically created and assigned with requested conditions and IFTTT event name for this folder and it’s sub-folder.

To know more about content rules, follow this link.

  1. Rules menu on left bar will show you all content rules applied on this folder.
_images/rule_tab.png

Default Settings

Following are the default settings which are configured during creation of content rule.

Conditions
  1. Default Trigger condition for this content rule is: Workflow state changed

2. Default contition for this content rule is: Workflow State as published

Data sent to IFTTT applet

In the data sent to IFTTT, following values will be dynamically included (for which content on the site this content rule triggers):

  • Title
  • Absolute_url
  • Description

Content and User Trigger

This document will guide admins to add an IFTTT “Content and User Trigger” to any folder on their site that will send a trigger to IFTTT when content at or below the current path is edited, including the information of who changed it. This will allow them to create IFTTT applets to, for example, log the edit information to Slack or a Google spreadsheet.

Follow the steps given below to Add an IFTTT User Trigger onto any folder.

  1. Traverse to folder on which you desire to apply IFTTT content trigger.
  2. From actions menu select Add Ifttt User Trigger
_images/select_actions.png
  1. Fill the given form with required values and click Add
_images/fill_form1.png
  1. Tada, trigger has been applied on your folder!!
_images/success1.png

Behind the Scenes

This section details all jobs performed behind the scenes after form gets filled.

1. A new Content Rule is dynamically created and assigned with requested conditions and IFTTT event name for this folder and it’s sub-folder.

To know more about content rules, follow this link.

  1. Rules menu on left bar will show you all content rules applied on this folder.
_images/rule_tab.png

Default Settings

Following are the default settings which are configured during creation of content rule.

Conditions

Default Trigger condition for this content rule is: Object Modified

Data sent to IFTTT applet

In the data sent to IFTTT, following values will be dynamically included (for which content on the site this content rule triggers):

  • Title
  • Absolute_url
  • Username who modified the content