Saving Catchall & Error Message Data ->Intermediate

At the end of the last tutorial I left you with some ideas on how you could use catchall, with your intents. This tutorial will explain exactly how you can take the data you recover, and save it to a Google Sheet. In that way, you will be able to see exactly what your users have answered when you ask them for an intent.

 Here’s what my Google Sheet looks like

It has seven different columns each labeled to make it easy to understand at some future time if I look back at it. The columns are:  user ID, sessions, time, catchall data or error, error type, time zone, and error block. Originally I will just going to use it as a way to save all of the catchall data. but once I started doing it I realized that the Sheet  could do double duty. I test my skills extensively before submitting them to Amazon, and I often change The JavaScript in my code blocks, so I figured I might just as well use the same table to save my errors too.

The first two columns  (A & B), {user ID} and{ sessions}, are more or less self-explanatory, but I’ll explain them anyway. User ID is the code assigned by Amazon to a particular user with regards to the skill that they are using. The {sessions} variable keeps track of the number of times a user has used your skill. It begins with a value of one, as soon as they start using your skill, and increments each time they come back and use it again.  

The third column (C) is time and the sixth (F) is timeZone.  I used information from a tutorial by Nicolas Arcay Bermjo, located here, to get the information for them. Then I just pasted the timeZone into its column, and used some JavaScript to figure out the actual time, in the format I wanted.

For columns 4, 5 and 7, I relied on variables I added into the skill. The fourth column (D) contains the actual catchall data, or if the entry is as a result of some type of project error, it just displays ‘–ERROR–’.

Column five (E) displays the {errorType}. It shows ‘catchall’ if the user didn’t respond within expected parameters of the intent. If an error occurred in the actual project, it says the name of the block type (e.g. Integration, code block, etc.)


— date flow —




It uses 3 different code blocks. Since each block contains JavaScript, and I am constantly ‘tinkering’ with the code, I connect each of their ‘fail’ ports to a different set block, then connect each of them to my Error Flow. There are many ways you can make an error in JavaScript that will cause the Code Block to fail. Too many to list them here! I try to use separate blocks for different things. Why? Because if you have 30 lines of code and you make one mistake, it becomes easier to troubleshoot a third of the code. Breaking it up into bite size pieces simplifies error correction.  The image to the left, shows what’s in the first set block  The {errorType} variable is set to what you see, because the error occurred in a code block. The variable {errorBlock} is set to the name of the block that had the error. As a result, when everything is complete, by looking at the error sheet, you will know what type of error it is, and where the error is located.




— Error Flow —


Here’s my Error Flow Block. The speak block just says the word ‘error’ so I will know enough to check my google error sheet to see where the problem happened. The second block is my Integration Block that saves the error information. The third is the skill’s Stop Block.



If you have an error from this block, and direct it to the Error Flow, it will keep repeating and end up in an infinite loop! That’s not a good idea!


Set up your Google spreadsheet like I have in the image at the beginning of this tutorial.

You can find out, from Voiceflow’s official tutorials, how to ‘Create Data’ on a Google Sheet.


Here’s the layout from the Integration Block showing how I stored the data.

Note: some use just the variable. One uses just the text, ‘–ERROR–‘. Another uses multiple variables and a word. (What you put here is dependent on how you want your date and time to be written)

If you try Nicolas’ tute, but like the way I made the date, let me know and I’ll post it.

The only difference between the Error Flow’s Integration Block and the one in catchall’s integration Block is there is a variable used in it instead of ‘–ERROR–‘. Because I want it to end the skill for an error, and continue in catchall, I found it simpler to set one up, then copy and paste it to the other, and finally make the slight change.

Here’s the way I arranged my blocks for a simple Yes/No Interaction Block. Refer back to the previous tutorial before continuing if you haven’t read ,it. Port 3 is the catchall output. I connected it to a set block, then the catchall flow. then connected it’s output to the huh? speak block.

The set block assigns something that describes the Interaction block (1st Y/N Interaction) to the {errorBlock}

— catchall flow —


Here is what my catchall flow looks like. Two things happen there. The Set block is used to assign the value for {catchall} to the variable {catchallMessage}, and the  value for {errorType} is assigned the text value of ‘catchall’.

The Integrations block is a clone of the one for the errors flow, with one slight change. ‘catchall data or error’ is changed from ‘–ERROR–‘ to the value in the variable {catchallMessage}.

That’s all folks! If you need anything else explained, let me know.

Have fun!


About This Site

This site was created as a place for users of our Alexa skill to find more information about creating their own skills, without programming.