Friday, November 16, 2018

Using Zapier RSS and Google Sheets to Update Alexa Flash Briefing Skills

About a year ago I became interested in developing skills for my network of Alexa devices and discovered an easy-to-use development tool named Storyline.  With it, I created a number of Alexa skills including five Flash Briefing skills.  Alexa's Flash Briefing is a news feature that allows Alexa users to choose news feeds of interest that Alexa will read to them on request.  Most Alexa users that configure their Flash Briefing often use it to update them on news and information each day.

I developed two basic Flash Briefing news feeds that are available in several English language regions of the world. One feed named "Classic Moments Daily" provides a quote from ancient classic sources that provide guidance for living a productive life.  The other feed, "Antiquities Alive", provides information about exhibits of ancient art and artifacts in venues around the world.

I had been updating them almost every day for months since the skills were certified by Amazon.  But, earlier this week, I received a notice from Storyline that they were no longer going to continue their free tier and planned to support only for-profit skill developers after the first of the year and even increased their, already high, professional subscription rate.  I didn't want to abandon my Alexa skills since history enthusiasts with Alexa devices have begun accessing them regularly and I hoped the number of users would increase with the increase in the Alexa user base.

 So, I began looking for a solution to maintain my Flash Briefing skills without using the RSS feed from Storyline.  The most challenging part was to find a tool to produce an RSS feed of information in plain text without XML styling information. I knew Blogger automatically produces an RSS feed for each blog but those feeds are full of styling code that Amazon would not accept.  I contacted Amazon's Developer Support team and asked if they knew of an application that could produce the plain text RSS required but they told me they were not aware of any such tools. So my search continued until I found Zapier (https://zapier.com/).  Zapier is sort of like IFTTT in that they offer programmable "Zaps" to connect apps together or extract data from one app and share it with another.  As luck would have it, they have an RSS feed generator that can be used to extract data from a Google Sheet and convert it to a plain text RSS feed without any formatting code.

Here is an example feed from a Zap I developed for my Flash Briefing "Classic Moments Daily".

https://zapier.com/engine/rss/4046403/classicmomentsdaily3/

I began the process by creating a Google Sheet I called "Classic Moments Daily." I put "Title" in A1 and "Description" in B1. If you wish each post to have a unique reference link then put "Link" in C1.  These are the default values Amazon expects (based on their RSS feed specs I reviewed).  Then I placed the next update information in A2 and B2 (and C2 if you have that column - remember Amazon wants only secure links beginning with https://).  It's important that you have at least one post in your spreadsheet as Zapier will look for sample data to provide you with a preview of your feed.


You do NOT need to publish the Google Sheet to the web for this application.

I also duplicate my posts in a related blog I have created in Blogger (it's free too) so I have a default secure source URL if none other are available.


In Blogger, I use the title in the post Title field and the description in the Post contents.



I also add an image to my Classic Moments Daily posts. This blog post with images shows up in the Alexa App when the user clicks on the Read more link on the Home page of their Alexa app.


Each blog post has a unique URL on Blogger.  However, if you simply point each Flash Briefing update to the main blog URL instead of the post URL, not only will the user have the opportunity to see images and additional information for the current update, but will be able to browse previous updates with their related images and information.

I've asked Amazon if they could provide this same functionality on the Echo Show to provide an easy way to display images to accompany skill content there but this functionality does not yet exist on the Show.  But, back to our tutorial.

Next, I open my account in Zapier and create a new "Zap".  First, I select Google Sheets as the starting app.



Then specify that I want want the trigger to be a New Spreadsheet Row.



Then, if this is your first Zap, you will be asked for your Google account and asked for permission for Zapier to access your Google Sheets.  I have already granted access so I can just continue to the next screen.

Then I select the appropriate sheet from the dropdown list of my Google Sheets available.



Next I choose the worksheet within the spreadsheet. If you used the first sheet only, just choose it as your only choice.

Then I click on the Plus Action Step in the left hand pane and RSS as the action app. Next I specify a name for the feed URL that is added to your unique Feed ID. I usually just use the name of my skill with no spaces.


As you can see from my Zap RSS feed, I called the last part of my feed "classicmomentsdaily3".  The reason for the number is that there is no way to delete test feeds. Each time you test it puts a new entry in your feed.  When I first started I set the number of items to include in the feed to 5 (the Alexa Flash Briefing maximum) but decided eventually to go with only one update item as that is the way I have updated my Flash Briefings until now. I had to keep changing my URL each time I made a change to get rid of earlier items in the RSS feed.  After three tests I finally got everything the way I wanted it! You may be able to get everything just right on the first try!

Next I give my feed a title, usually just the same title as my Alexa Flash Briefing Skill. Then select the number of items you wish to include in your daily update. I only use one item so I entered the number 1.  Remember, Amazon allows only a maximum of 5 items per Flash Briefing update.

Next I select the cell in the worksheet for my Item Title from the dropdown list.

For source URL, and you have a link column on your spreadsheet, you can select that from the dropdown list or enter the URL for your related blog for all posts as I have done.

Then select the cell for my Item Description (Content) from the drop down list. Note:  Zapier can only handle a maximum of 10kb of data in the Content field!

Then enter your author name if you wish (it's optional), author email address (also optional) and author link (your homepage - also optional). For PubDate I just enter the recommended "now".


You will then have the opportunity to test your Zap and view your URL to see if it contains the information you wish.

Under the free tier, you are allowed to have up to 1,000 tasks each month and an unlimited number of Zaps. You are also limited to two actions per Zap.  Each time you generate a feed (update your flash briefing), you are "charged" one task.  If you update one feed every day for a month, you would only accumulate 30 tasks (If I understand how the task system works - of course there is no phone support.)

Now that you have your feed URL you can go to the Amazon Development Console, click on Edit for the Flash Briefing Development Version you wish to switch over from StoryLine,


Then on the next screen click edit again



 Now enter your Zap feed URL into Feed field in place of the StoryLine feed.  If you have created separate Flash Briefings for each language region (US, UK, CAN, AUS, and IND) you can use the same Zap URL in all of them. So, updating the Google Sheet will update all linked Flash Briefings at once!  As a precaution I copied the StoryLine URL to my notes in case something went wrong and I had to switch it back.  Also, Flash Briefings now have an icon field for the icon that displays on Echo Shows or Spots that StoryLine was not providing. It is 512X512 px so I just used the large one I had specified for my skill in the Alexa Skills Store.



Finally, I made a note in the testing instructions on the Distribution, Privacy & Compliance screen that I was changing the Feed URL for my skill.  Then I perfomed the functional tests and submitted the skill for recertification.

I hope those of you who are attempting to migrate your Flash Briefing skills away from Storyline will find this tutorial helpful.  If you are a new developer, you can use these same steps to create a new Flash Briefing skill merely by filling out the other fields in the Alexa Development Console then use the Zapier RSS feed for your secure endpoint.

No comments: