An Idiot’s Guide to: Failing to Complete the Actions for the Google Assistant Codelab (and a Realisation that I Need to Learn More Code)

I am, as I ever am, running behind schedule for a variety of article deadlines. You’d think, therefore, I should be writing an article on time-management or ways to quickly generate article ideas. Sadly, those articles aren’t due to be late until next week. Instead, I’m taking a look at something that caught my eye yesterday.

I saw a tweet from John Mueller regarding a codelab that Google had built for I/O that dealt with schema and – running behind on another deadline – I took a walk through that for a piece on the Click blog. After finishing that, however, I spotted a couple of codelabs I’d not seen before – on how to build Actions for the Google Assistant.

At I/O18, Google has made it clearer than ever that it sees the future of search inextricably bound with voice interaction and artificial intelligence, so it seems timely to have a look at the newly updated (as of the 9th of May) codelab (Level 1) on building actions for the Google Assistant. You’ll be experiencing this pretty much in real time if I make it through [N.B. I don’t], so we’ll see how it goes. [N.B. as you’ll see, the title very much refers to the fact that the idiot wrote it – not that it was written for idiots.]

codelab options

To begin with, for anyone who doesn’t yet know, ‘Actions’ in this sense refer to a set of preprogramed routines that the Google Assistant can perform – from translations to answering queries regarding celebrity biographies, finding restaurant recommendations or running quizzes.

SOD actions list

The codelab promises that I will build a simple conversational ‘Action’ which can be summoned by name, ask for its interlocutor’s favourite colour and provide a lucky number in response. This should, it claims, among other things, teach me how Actions work, how to create a project, a Dialogflow and more.

Firstly, rather than being a directly incorporated part of the Google Assistant, the intro makes clear that your Action is a separately accessible sub-program, or an assistant to the Assistant which will, when summoned, serve the user the service you design it for. This is illustrated with the following diagram:

diagram

To begin with, I had to create a project using the Actions Console and give it a name. There’s a host of what I assume (having not looked yet) to be presets, but the codelab recommends I skip this and instead select ‘Actions’ from the left menu and add my first action (which it recommends should be in one language only to begin with). I then proceed to build a custom intent (which opens up a permissions box allowing it, for all the reading I did, ownership of my eternal soul). This leads to the creation of your Dialogflow and takes you to ‘Intents’.

Google then moves, suspiciously, in to the realm of daemonology by asking you to create your ‘welcome intent’ – or ‘invocation’ (best said with reverb at maximum and with a pitchshift to the low end). This is done by clicking on ‘Default welcome intent’ – which I do.

welcome intent

This is where I had my first issue: I entered my default welcome intent, I clicked through to test my app – all instructions followed…

access

Then I enter the invocation, standing squarely in the centre of the chalk pentagram and… nothing.

I’ve broken it already. However, the simulator – it turns out – will not work if all of your Activity Controls are disabled. Which mine were. Now Google has ownership of my soul and permission to track my every move… but once I enabled all of my controls, I was allowed to test the Action. It worked. I can now go on to learn how to create conversational responses.

At this point I went exploring the various entities and other key concepts, then had to dial in to a webinar, during which I was wondering about the myriad possibilities for actions – whether in creating chatbots for local clients, content for outreach activities and social media campaigns and much more besides. I then had to tune in to the webinar for a moment. [N.B. this is all hilariously optimistic in hindsight.]

Returning to the codelab, the next step has me create a basic Q&A – briefing my Action to ask for a favourite colour and adding a few training phrases to give it a rough guideline for possible answer syntax and adding a database to draw from in an ‘Actions and parameters’ section. Then it goes on to adding JavaScript.

I am far from fluent in JS. I can read it, I can understand some of it, I can write a little, but the training essentially gives you the code to use in your webhook and explains a little of which expressions in the code match to which forms you’ve filled in so far – so it’s a reasonable explainer to the uninitiated and explains that the lucky number will be based entirely on the length in characters of the ‘color’.

One thing to note is that you should use American spelling throughout, or your JavaScript will be referring to parameters that don’t exist.

My Action is broken, and I can’t see any reason why – so I start over. My second run through doesn’t return an error message – but does return the following:

Bruce Willis

Okay, my dreams of creating a voice powered, interactive guide to search are rapidly fading, but – girding myself for a third failure – I switch everything extraneous off and commit myself to following the guide line by bloody line.

Another run through leads to the same result – by now, I’m starting to lose my proverbial.

In desperation, I asked for help from any and every one I could think of, trying to find some kind of answer, before rage-quitting for the day to watch some talks from I/O and try to catch up with the other deadlines I’m missing.

Time passes.

I now have my colleague Scott going through the codelab… because I spent last night cursing my own idiocy and the deadline has now gone. I have another colleague, and far better coder than I, on standby. I’m now so invested in this that, essentially, I’m prepared to invoke literal demons for the understanding necessary to complete both this article and the simple task that this should, in theory, be.

While Scott is in the process of creating his own Action… I start again…

I’m even following instructions that aren’t stated, now – the ‘Set this intent as end of conversation’ slider is set to off as default, but in the screen grab in section four, it’s activated.

hidden message

So, reader, I activate it.

The section four test – as it has done each time since updating the permissions on my account – goes well:

section four test

Okay… I’m at the end of section five and I literally could not have done other than I have done in previous attempts, but I am almost comically paying attention to the instructions. There’s a close up on my profile, my head fades to transparency and in there, a hamster furiously races on its treadmill.

section five

Right, so it now tells me to replace the contents of index.js with the code beneath the instruction. I’ve copied that code to notepad because it’s suspiciously longer than the replacement code (even excluding the bits commented out), so I might come back to this if things cock up again.

proof goddamnit

I did it, god damn it, I did it – I pasted your code. God help me, I’m pressing deploy. You just watch me (a quick look at Scott shows growing frustration – but he does point out that at this stage – in their code – ‘use strict’; is on line 21 and now I don’t know what to believe – the image above on the page that shows it at line 1, or the one that shows it on line 14). Sod it, I’m deploying…

broken again

Broken.

Mutha*****.

Scott has given up.

Another cry for help:

At this point – unless Google comes back with a response, I literally cannot see what’s going on with this codelab.

If there’s something to be learned from the last few days – from I/O 18 and from this codelab – it’s that voice search is unquestionably where the digital sphere is headed, and that is going to mean that coding languages are going to become increasingly valuable for SEO. While my reasonable grasp of HTML and CSS and my smattering of JS has served me so far, I’m going to have to make some serious inroads with JavaScript and at least one other programming language.

Whether or not the codelab is broken (it has to be broken, even I’m not that thick, surely? If anyone manages it – please let me know how), the fact that I wouldn’t be able to fix something like this means that I need to take action and learn more code – and I’m pretty sure I’m not alone in that.

Know about what is changing in marketing!

Keep up with the latest digital marketing developments, views and how-tos through State of Digital’s digest newsletters. Be the first to hear about events, white papers, e-books, webinars, training and more!


John Warner

About John Warner

John is an internal marketer at Click Consult where he spends his time accruing industry certifications, tinkering with code, plotting strategy and writing articles on all aspects of search marketing. He also contributes to free quarterly search magazine 'Go Viral' and is the occasional host of the on.click podcast (available on iTunes and Stitcher).