Showing posts with label Flash briefing. Show all posts
Showing posts with label Flash briefing. Show all posts

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.

Sunday, January 01, 2017

An Alexa-enabled Smart Home for Christmas

by Mary Harrsch © 2017

Note: This is a cross-post from my home page.

Back in 1995, Microsoft introduced an interactive help utility for Windows 95 called "Bob".  I was probably one of the few professional technology people who actually used "Bob" (As a dog lover I selected the helper incarnation called "Power Pup" though.)  "Power Pup" would keep track of my keystrokes as I worked in different applications and offer procedural advice on what it perceived I was trying to do at the time, prefaced by a little bark and a wag of his tail.  I found "Power Pup's" suggestions often useful and his friendly interaction a welcome break from the stress of administering a college-wide multiplatform local area network.  But, apparently, many of my colleagues thought he was "too cute" for the serious work of computing and "Bob" was relegated to the dustbin of failed products in fairly short order.

But I did not forget "Bob" and how artificial intelligence could be used to improve productivity while reducing social isolation.  So I began to experiment with conversational agents that utilized natural language programming coupled with knowledgebases to provide a more friendly computer-to-human interface.  With my interest in history, I decided to try to virtually recreate historical figures from the past that could converse about their culture with modern interested humans.  This resulted in the creation of a virtual Julius Caesar that was online for several years before I retired.  Caesar would answer questions about ancient Roman culture posed to him by visitors entering their questions in a text box.  He could give a textual answer or display related websites or online videos.  As text-to-speech technology advanced, I even experimented with software that would enable Caesar to answer questions verbally and explored voice recognition technology to see if it was viable for user input as well. But, when I retired I no longer had access to the server platforms needed to support projects like Caesar.  However, my interest in natural language programming and more friendly human-to-computer interfaces endured.

So, I followed the development of Amazon's Alexa-powered devices with a great deal of interest. But, I'm a rather pragmatic individual and at first so much marketing emphasis was placed on Echo's music management features that I wondered if there were more useful applications for a busy 21st-century household.

Then I began reading about wifi-enabled electrical connection accessories that could be managed with Alexa-enabled devices and thought about how convenient it would be to be able to turn on and off groups of lights and appliances with a few words rather than going around physically flipping switches. But spending almost $200 per device and the need to have a device in each main room was still an expensive proposition to gain a little convenience.

Then Amazon introduced the Echo Dot coupled with a holiday sale price of just $39.95 and I found resistance was futile as my Star Trek friends would say.  I was still a bit concerned about the accuracy of the voice recognition, though. So I started out with just one Echo Dot for the living room along with a couple of Wemo wifi-enabled plug adapters for the two main living room lamps.

I downloaded the Alexa app to my iPhone and discovered the Echo Dot setup was a breeze.  I opened the Alexa app, then opened Settings and changed my iPhone wifi connection to the detected Echo network and configured the detected Dot. Alexa also did not seem to have any problem understanding me.  I read through all of the "Try this" examples and began to configure some of the built-in features.

I really liked the "flash briefing" feature that lets you select specific news feeds for a personal news update which you can request at any time.  I selected NPR radio, BBC News, Tech Crunch and CNet (for technology news) and Discovery (for science news) as my personal news sources.  I also added the local weather forecast and the Alexa Try This feed.  Although I live in Oregon's Willamette Valley, I couldn't find any local news feeds but I think I'll add feeds from Seattle and San Francisco to at least hear major stories from the Pacific Northwest.

I also read that Alexa could interface with Google Calendar and keep you appraised of upcoming appointments.  I hadn't used an online calendar since I retired but knew how helpful this would be, especially when managing complex medication schedules and medical appointments.  So I configured my Google Calendar and paired it with Alexa.  Now, each morning after requesting my Flash Briefing, I ask what's on my schedule for the day and Alexa tells me.

I've also used the Google Calendar to keep track of upcoming programming on PBS that I may wish to record.   PBS sends me a physical schedule of their upcoming programming for a full month but at present, my DISH Hopper cannot see more than two weeks of scheduled programming at a time. Now, when I get my PBS schedule, I enter the programs I wish to record into my Google Calendar and Alexa lets me know each day if any are on that day.  I can then set my DVR to record them.

But the real "killer" app I was looking for turned out to be Alexa's Shopping List!  It never seems to fail that I realize I need something from the grocery store when I'm not in the kitchen where I keep my shopping list.  As I've gotten older my short term memory is not what it used to be either and it is not uncommon for me to forget what I was thinking about just a few minutes later as I walk from one room to the next.  So, imagine how helpful it is to be able to tell Alexa to add something to your shopping list as soon as you think of it regardless where you are! Of course, that meant I needed to add Echo Dots in my bedroom and the living room, too, which I promptly did. To access my shopping list once at the grocery store I just open the Alexa app on my iPhone and check off and delete each item as I add the item to my physical shopping cart.

Although my husband has the television blaring all day long, I did find a nice use of the music management features of Alexa.  Now that I have an Echo Dot in the bedroom, I can run a warm bath in the adjoining bathroom (Alexa's range is up to 20 feet), lay back in the tub and tell Alexa to play one of my favorite playlists from my Amazon Music account.  I did have a few hiccups configuring my Amazon playlists to work with Alexa, though.

I had already imported most of my music from my iTunes library to my Amazon Music account.  I had also set up playlists previously.  But Alexa did not seem to recognize my playlist names and would offer something from Prime Music (since I'm a Prime member) using my spoken words as a search guide. I ended up calling Alexa tech support and learned that Alexa does a better job of recognizing playlists if you name them "Your Name" then "Description".  For example, I had a playlist named "Holiday favorites".  I renamed it to "Mary's Holiday Favorites" then Alexa recognized it and played it for me.  That solved most of my playlist issues.  There were a few words, however, Alexa seemed to insist on using for search terms.  So, I experimented with different descriptions until she properly recognized the list.  I had a list named "Sentimentals".  I initially renamed the list to "Mary's Sentimentals" but Alexa still loaded some other Prime Music.  I renamed it again to "Mary's Mood Music".  Alexa still did not interpret it correctly.  So I finally renamed it to "Mary's Soft Rock" and Alexa now recognizes it.

When I received my Wemo wifi-enabled plug adapters for my living room lights, I realized just how powerful having a "Smart Home" would be.  Our living room does not have any overhead lighting so all lighting is provided by individually controlled lamps.  Each night I have to go around and turn each lamp on or off.  But, by connecting them with my Echo Dot, I now simply say "Alexa, Living Room On" and the entire living room lights up.

I had to first download and install the Wemo app onto my iPhone. Then I opened the Wemo app on the iPhone, changed my iPhone wifi connection in Settings to the detected Wemo network and configured each plug adapter.  Then I opened the Alexa app, selected the Smart Home option and grouped the two detected Wemo plugs into a "Living Room" group.

I hope to eventually replace some of my wall switches with wifi-enabled switches too since I have porch lights on different circuits in different parts of the house.  I would like to tell Alexa to turn on the porch lights and have all of them on at once without traipsing from room to room whenever I need to go outside after dark or have visitors arrive after dark.  I did read about a gotcha, though. I learned that many wifi-enabled switches require a neutral wire that was not normally included in wiring installed before 2011.  However, I have researched this issue further and it looks like there are switches out there that do not use the neutral wire.  I just have to be sure they will work with our home's wiring configuration.

I recently learned about a new app for Alexa called "Ask My Buddy" too.  It enables you to send a text, email or phone call to up to five family or friends if you need to alert them about a problem like you are incapacitated and cannot reach a phone.  It's sort of like "Life Alert" without the automatic 911 call or monthly subscription fee.  I wish it would allow you to send an individually specified text message but it only sends a message saying you need help.

I've also decided to try the timer feature and see if I can get Alexa to verbally remind me to take my medicine at noon.  Most of my medications are taken in the morning or at bedtime and I have no problem remembering them as they are part of my morning and bedtime routines.  But when I get busy preparing lunch I sometimes forget to set my noon medication by my water glass so I take it with my meal.

After reading up on Alexa's timer and alarm functions I learned that timers are designed for one-time use while alarms can be set to be repeating.  So I set an alarm for noon each day and selected a pleasing alarm tone.  I wish it would let you specify a short text string that Alexa could read to you using her text-to-speech capability but at present it doesn't.  For my present needs, a tone is okay as there is only one thing for me to remember at noon.  However, for someone with more complicated medication schedules, it would be really helpful to have Alexa sound a tone followed by a short reminder message.  Hopefully, Amazon's engineers will enhance the alarm function soon.  (Update: Amazon has now added voice messages with timers and alarms!  Yay!!)

So, my Echo Dots with Alexa are now very much an integral part of my day.  When I get up in the morning I say "Alexa, Living Room On" and the lights go on in the living room.  I walk in and sit down and say "Alexa, my Flash Briefing please".  I then listen to the news and get the latest weather forecast for the day.  Then I say "Alexa, what's on my schedule today?" and she tells me whatever I have scheduled in my Google Calendar".  As I prepare a meal and notice I'm getting low on coffee I say "Alexa, add Coffee to my Shopping List" and she tells me she has added coffee to my shopping list.  I drive to the grocery store and open the Alexa app on my iPhone select shopping list from the menu and load my cart.  At noon while I am preparing lunch, Alexa sounds a tone to remind me to set out my noon medication. In the evening, I take a warm bath to relax and tell Alexa to play "Mary's Soundtracks" and listen to my favorite movie music while I'm soaking.  Then when I'm ready for bed I say "Alexa, Living Room Off" and Alexa turns off the living room lights. I'm sure I'll find other useful applications, too, as more "skills" are developed by Amazon and third parties as well. I have a feeling this is just the beginning!