Working with custom buttons to drive conversations

If I’ve said anything about bots, it’s that they’re apps. They’re just apps with a conversational interface. This style of interface can be extremely powerful, as it allows the user to better express themselves, or “skip to the end” if they already know what it is they’re trying to accomplish. The problem, though, is without a bit of forethought to the design of the bot it’s easy to wind up back in this scenario, where the user isn’t sure what to do next:

Command Prompt

If you’re well versed in the set of commands you can quickly perform any operation you desire. But there is no guidance provided by the system. Just as they’re no guidance provided here:

Command Prompt

Buttons are a good thing

We need to guide the user.

Buttons exist for a reason. They succinctly show the user what options are available, and can guide the user towards what they’re looking for. In addition, they help reduce the amount of typing required, which is especially important when talking about someone accessing a bot on a mobile device with a tiny keyboard.

Providing choices

The most obvious place where buttons shine is when providing a list of choices for a user to select from. This might be a shipping method, a category for filtering, or, really, any other set of options. To support a list of choices, BotBuilder provides a choice prompt. The choice prompt, as you might expect, provides the user a list of options for them to choose from, and then provides access to that in the next step of the dialog.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
// sample waterfall dialog for a choice
(session, args, next) => {
builder.Prompts.choice(
session,
`What color do you want?`,
['Red', 'Green', 'Blue'],
{
listStyle: builder.ListStyle.button,
retryPrompt: `Please choose from the list of options`,
maxRetries: 2,
}
);
},
(session, results, next) => {
if(results.response && results.response.entity)
session.endConversation(`You chose ${results.response.entity}`);
else
session.endConversation(`Sorry, I didn't understand your choice.`);
}

The choice prompt limits the user’s response to just the list of options you provide. You can limit the number of times the bot will ask the user for a response before moving onto the next step in the waterfall.

While choice is certainly nice for providing a simple list of options, it does force the user into choosing one of those options. As a result, it’s not as easy to use choice when trying to guide the user with a list of options while also allowing them to type free-form, which is what you’ll want to do when the user first starts a session with the bot. In addition, you don’t get control over the interface provided.

Customizing the list of prompts

If you wish to customize the list of prompts, you need to set up a card. This can be an Adaptive Card, or one of the built-in cards such as thumbnail or hero. By using a card you can provide a bit more guidance to the channel on how you’d like your list of options to provide.

To allow the user to select from a list of options, you will add buttons to the card. Buttons can be set to either imBack, meaning the client will send the message back to the bot just as if the user typed it, or postBack, meaning the client will send the message to the bot without displaying it inside the client. Generally speaking, imBack is a better choice, as it makes it clear to the user something has happened, and can give the user a clue as to what to type in the future, should they so decide.

WARNING!!!

The code below is the wrong way to use buttons to provide a list of options, but it’s the most common mistake I see people make when using buttons with Bot Framework.

In the code snippet below, I want you to notice the addition of the buttons using builder.CardAction.imBack, and the call to session.send (where the mistake is).

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
(session, args, next) => {
const card = new builder.ThumbnailCard(session)
.text('Please choose from the list of colors')
.title('Colors')
.buttons([
new builder.CardAction.imBack(session, 'Red', 'Red'),
new builder.CardAction.imBack(session, 'Blue', 'Blue'),
new builder.CardAction.imBack(session, 'Green', 'Green'),
]);
const message = new builder.Message(session)
.addAttachment(card);
session.send(message);
},
(session, results, next) => {
if(results.response && results.response.entity)
session.endConversation(`You chose ${results.response.entity}`);
else
session.endConversation(`Sorry, I didn't understand your choice.`);
}

If you added this dialog to a bot and ran it, you’d see the following output:

Repeating buttons

The mistake, as I mentioned above, is at session.send. When using session.send in the middle of a waterfall dialog, the bot is left in a state where it’s not expecting the user to respond. As a result, when the user does respond by clicking on Blue, the bot simply returns back to the current step in the waterfall, and not to the next one. You can click the buttons as long as you’d like, and you’ll see them continuing to pop up.

The correct way to do it

In order for the bot to be in a state that expects user input and continues to the next step of a waterfall, you must use a prompt. When using buttons inside of a card, you can choose either a text or choice prompt. When using a text prompt, the bot can accept any input in addition to the buttons you provided. This can allow the user to be more free-form as needed. choice prompts, however, will limit the user to the list of choices, just as if you created it the traditional way mentioned earlier.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
// Using a choice prompt with custom buttons
// For simplicity, I removed the retry prompts, but you can continue to use them
// If you wanted to use a text prompt, you'd simply use:
// builder.Prompts.text(session, message);
(session, args, next) => {
const choices = ['Red', 'Blue', 'Green']
const card = new builder.ThumbnailCard(session)
.text('Please choose from the list of colors')
.title('Colors')
.buttons(choices.map(choice => new builder.CardAction.imBack(session, choice, choice)));
const message = new builder.Message(session)
.addAttachment(card);
builder.Prompts.choice(session, message, choices);
},
(session, results, next) => {
if(results.response && results.response.entity)
session.endConversation(`You chose ${results.response.entity}`);
else
session.endConversation(`Sorry, I didn't understand your choice.`);
}

Providing a menu

As I mentioned at the beginning of this post[1], one of the keys to a good user experience in a bot is to provide guidance to the user, otherwise you’re just giving them a C-prompt.Again, the easiest way to do this is via buttons.

We’ve already seen that imBack behaves just as if the user typed the value manually. We can take advantage of this fact by providing the list of options, and ensuring the values match the intents provided in the bot.

You’ll notice in the code sample below I created a bot with two simple dialogs, and the default dialog sends down the buttons inside of a card. By calling endConversation, the bot sends down the card and closes off the conversation. When the user clicks on a button it’s just as if the user typed in the value, and the bot will then route the request to the appropriate dialog. The user is free at this point to either click one of the provided buttons, or type in whatever command they desire.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
const bot = new builder.UniversalBot(
new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
}),
(session) => {
const card = new builder.ThumbnailCard(session)
.title('Sample bot')
.text(`Hi there! I'm the sample bot.
You can choose one of the options below
or type in a command of your own
(assuming I support it)`)
.buttons([
builder.CardAction.imBack(session, 'Hello', 'Hello'),
builder.CardAction.imBack(session, 'Greetings', 'Greetings'),
]);
const message = new builder.Message(session)
.addAttachment(card);
session.endConversation(message);
}
);
bot.dialog('Hello', (session) => {
session.endConversation(`The Hello Dialog`)
}).triggerAction( { matches: /Hello/ } );
bot.dialog('Greetings', (session) => {
session.endConversation(`The Greetings Dialog`)
}).triggerAction( { matches: /Greetings/ } );

The updated bot now performs as displayed below. In the dialog I started by typing test to trigger the bot. I then clicked on Hello, which displayed the Hello Dialog message. I completed the exchange by typing Hello, which, as you see, sent the same Hello Dialog message.

Introduction with buttons

Conclusion

I’ve said it before, and I’ll certainly say it again - buttons exist for a reason. Buttons can help you provide a good UI/UX for users in any type of application, and bots are no exception. You can use buttons to both limit the amount of typing required, and to help guide the user’s experience with the bot.

[1] This exceedingly long post?


Managing conversations and dialogs in Microsoft Bot Framework using Node.JS

Communication with a user via a bot built with Microsoft Bot Framework is managed via conversations, dialogs, waterfalls, and steps. As the user interacts with the bot, the bot will start, stop, and switch between various dialogs in response to the messages the user sends. Knowing how to manage dialogs in Bot Framework is one of the keys to successfully designing and creating a bot.

Dialogs and conversations, defined

At its most basic level, a dialog is a reusable module, a collection of methods, which performs an operation, such as completing an action on the user’s behalf, or collecting information from the user. By creating dialogs you can add reuse to your bot, enable better communication with the user, and simplify what would otherwise be complex logic. Dialogs also contain state specific to the dialog in dialogData.

A conversation is a parent to dialogs, and contains the dialog stack. It also maintains two types of state, conversationData, shared between all users in the conversation, and privateConversationData, which is state data specific to that user.

Waterfalls

Every dialog you create will have a collection of one or more methods that will be executed in a waterfall pattern. As each method completes, the next one in the waterfall will be executed.

Dialog Stack

Your bot will maintain a stack of dialogs. The stack works just like a normal LIFO stack), meaning the last dialog added will be the first one completed, and when a dialog completes control will then return to the previous dialog.

Managing dialogs

Bots come in many shapes, sizes, and forms. Some bots are simply front ends to existing APIs, and respond to simple commands. Others are more complex, with back and forth messages between the user and bot, branching based on information collected from the user and the current state of the application. Depending on the requirements for the bot you’re building, you’ll need various tools at your disposal to start and stop dialogs.

Starting dialogs

Dialogs can be started in a few ways. Every bot has a default, sometimes called a root dialog, which is executed when no other dialog has been started, and no other ones have been triggered via other means. You can create a dialog that responds globally to certain commands by using triggerAction or beginDialogAction. triggerAction is registered globally to the bot, while beginDialogAction registers the command to just that dialog. Finally, you can programmatically start a dialog by calling either beginDialog or replaceDialog, which will allow you to add a dialog to the stack or replace the current dialog, respectively.

Ending dialogs and conversations

When a bot reaches the end of a waterfall, the next message will look for the next step in the waterfall. If there is no step, the bot simply doesn’t respond, naturally ending the conversation or dialog. This can provide a bit of a confusing experience for the user, as they may need to retype their message to get a response from the bot. It can also be confusing for the developer, as there may be many ways a dialog might end depending on the logic.

As a result, when a conversation or dialog has come to an end, it’s a best practice to explicitly call endConversation, endDialog, or endDialogWithResult. endConversation both clears the current dialog stack and resets all data stored in the session, except userData. Both endDialog and endDialogWithResult end the dialog, clear out dialogData, and control to previous dialog in the stack. Unlike endDialog, endDialogWithResult allows you to pass arguments into the previous dialog, which will be available in the second parameter of the first method in the waterfall (typically named results).

State management

Ending a conversation or dialog will also remove the associated state data. This is important to remember when deciding where to store state data. The best practices of minimizing scope of state data apply to bots, just as they do to any other application.

The place where state lifespan becomes trickiest is dialogData. If you start a new dialog, the dialog doesn’t receive the data from the calling dialog. In addition, when a dialog completes, the previous dialog doesn’t receive the data from the calling dialog. You can overcome this by using arguments. endDialogWithResult allows you to pass arguments to the prior dialog, while both beginDialog and replaceDialog allow you to pass arguments into the new dialog.

The sample application

The sample application we will be building through the next set of examples is a simple calculator bot. Our calculator bot will allow the user to enter numbers, and once they say total we’ll display the total and allow them to start all over again. We’ll also want to allow the user to get help at any time, and to cancel as needed. The sample code is provided on GitHub.

Default dialog

Starting with version 3.5 of Microsoft Bot Framework, the default or root dialog is registered as the second parameter in the constructor for UniversalBot. In prior versions, this was done by adding a dialog named /, which led to naming similar to that of URLs, which really isn’t appropriate when naming dialogs.

The default dialog is executed whenever the dialog stack is empty, and no other dialog is triggered via LUIS or another recognizer. (We’ll see how to register dialogs using triggerAction a little later.) As a result, the default dialog should provide some contextual information to the user, such as a list of available commands and an overview of what the bot can perform.

From a design perspective, don’t be afraid to send buttons to the user to help guide them through the experience; bots don’t need to be text only. Buttons are a wonderful interface, as they can make it very clear what options the user can choose from, and limit the possibility of the user making a mistake.

To get started, we’ll set up our default dialog to present the user with two buttons, add and help. For our first pass, we’ll simply echo the user’s selection; we’ll add additional dialogs in the next section. We’ll do this by setting up a two step waterfall, where the first step will prompt the user, and the second will end the conversation.

Default dialog sample code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
const builder = require('botbuilder');
const connector = new builder.ChatConnector({
appId: process.env.MICROSOFT_APP_ID,
appPassword: process.env.MICROSOFT_APP_PASSWORD
});
const bot = new builder.UniversalBot(connector, [
(session, args, next) => {
const card = new builder.ThumbnailCard(session);
card.buttons([
new builder.CardAction(session).title('Add a number').value('Add').type('imBack'),
new builder.CardAction(session).title('Get help').value('Help').type('imBack'),
]).text(`What would you like to do?`);
const message = new builder.Message(session);
message.addAttachment(card);
session.send(`Hi there! I'm the calculator bot! I can add numbers for you.`);
const choices = ['Add', 'Help'];
builder.Prompts.choice(session, message, choices);
},
(session, results, next) => {
session.endConversation(`You chose ${results.response.entity}`);
},
]);

Sample code

Working with dialogs

One of the biggest challenges when creating a bot is dealing with the fact users can be random. Imagine the following exchange:

1
2
3
4
User: I'd like to make a reservation
Bot: Sure! How many people?
User: Do you have a vegan menu?
Bot: ???

This is a common scenario. The user sends a message to the bot. The bot responds. The user gets a new piece of information, in this case their friend is a vegan, and thus asks about a vegan menu. The bot is now stuck, because it wasn’t expecting that response. triggerAction allows you to register a global command of sorts with the bot, and ensure the appropriate dialog is executed for every request.

Naming dialogs

In prior versions of Bot Framework, developers typically started every dialog name with /. This was because when registering the default dialog in earlier versions you named it /. As you’ve already seen, that’s not the case starting with version 3.5. As a result, you give your dialog a name that appropriately describes the operation the dialog is built to perform.

Registering a dialog

bot.dialog is used to register a dialog. The two parameters you’ll provide are the name of the dialog, and the array of methods you wish to execute when the user enters the dialog. Let’s create the starter for add dialog. For now, we’ll leave it with the simple echo, and introduce new functionality as we go forward.

Dialog sample code

1
2
3
4
5
bot.dialog('AddNumber', [
(session, args, next) => {
session.endConversation(`This is the AddNumber dialog`);
},
]);

Using triggerAction to start a dialog

We want to register our AddNumber dialog with the bot so whenever the user types add this dialog will be executed. This is done through the use of triggerAction, which is a method available on Dialog. triggerAction accepts a parameter of type ITriggerActionOptions.

ITriggerActionOptions has a few properties, the most important of which is matches. Matches will either be a regular expression to match a string typed in by the user, such as add in our case, or a string literal if the match will be done through the use of a recognizer, such as one from LUIS.

Let’s update our bot to register AddNumber to be started when the user types add. We’ll remove the second step from the default dialog and take advantage of the behavior of our buttons, which will send the text of the button to the bot, much in the same way as if the user typed it themselves.

triggerAction sample code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
// just the updated code
const bot = new builder.UniversalBot(connector, [
(session, args, next) => {
const card = new builder.ThumbnailCard(session);
card.buttons([
new builder.CardAction(session).title('Add a number').value('Add').type('imBack'),
new builder.CardAction(session).title('Get help').value('Help').type('imBack'),
]).text(`What would you like to do?`);
const message = new builder.Message(session);
message.addAttachment(card);
session.send(`Hi there! I'm the calculator bot! I can add numbers for you.`);
// we can end the conversation here
// the buttons will provide the appropriate message
session.endConversation(message);
},
]);
bot.dialog('AddNumber', [
(session, args, next) => {
session.endConversation(`This is the AddNumber dialog`);
},
]).triggerAction({matches: /^add$/i});

Sample code

triggerAction notes

triggerAction is a global registration of the command for the bot. If you wish to limit that to an individual dialog, use beginDialogAction, which we’ll discuss later.

Also, triggerAction replaces the entire current dialog stack with the new dialog. While that can be good for AddNumber, that wouldn’t be good for a dialog to provide help. We’ll see a little later how onSelectAction can be used to manage this behavior.

If you execute the bot at this point you’ll notice clicking Add on the buttons, or simply typing it, will cause the bot to send the message This is the AddNumber dialog. You’ll also notice that help, at present, does nothing. We’ll handle that in a bit.

Using replaceDialog to replace the current dialog

Let’s talk a little bit about our logic for AddNumber. We want to prompt the user for a number, add it to our running total, and then ask the user for the next number. Basically, we just need to restart the same dialog over and over again. We can use replaceDialog to perform this action.

In the first step of our waterfall, we’ll check to see if there is a running total available in privateConversationData, and create one if it doesn’t exist. We’ll then prompt the user for the number they want to add.

In the second step, we’ll retrieve the number, add it to our running total, and then start the dialog over again by calling replaceDialog.

replaceDialog sample code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
bot.dialog('AddNumber', [
(session, args, next) => {
let message = null;
if(!session.privateConversationData.runningTotal) {
message = `Give me the first number.`;
session.privateConversationData.runningTotal = 0;
} else {
message = `Give me the next number, or say **total** to display the total.`;
}
builder.Prompts.number(session, message, {maxRetries: 3});
},
(session, results, next) => {
if(results.response) {
session.privateConversationData.runningTotal += results.response;
session.replaceDialog('AddNumber');
} else {
session.endConversation(`Sorry, I don't understand. Let's start over.`);
}
},
]).triggerAction({matches: /^add$/i});

Sample code

replaceDialog notes

replaceDialog takes two parameters, the first being the name of the dialog with which you wish to replace the current dialog, and the second being the arguments for the new dialog. The object you provide as the second parameter will be available in the first function in the new dialog’s waterfall in the second parameter (typically named args).

Using beginDialogAction to localize commands

It doesn’t make a lot of sense for our bot to have a global total command. After all, it’s only valid if we’re currently adding numbers. Using beginDialogAction allows you to register commands specific to that dialog, rather than global to the bot. By using beginDialogAction, we can ensure total is only executed when we’re in the process of running a total.

The syntax for beginDialogAction is similar to triggerAction. You provide the name of the DialogAction you’re creating, the name of the Dialog you wish to start, and the parameters for controlling when the dialog will be started.

beginDialogAction sample code

1
2
3
4
5
6
7
8
9
10
11
bot.dialog('AddNumber', [
// existing waterfall code
])
.triggerAction({matches: /^add$/i})
.beginDialogAction('Total', 'Total', { matches: /^total$/});
bot.dialog('Total', [
(session, results, next) => {
session.endConversation(`The total is ${session.privateConversationData.runningTotal}`);
},
]);

Sample code

beginDialogAction notes

By using endConversation, we reset the entire conversation back to its starting state. This will automatically clear out any privateConversationData, as the conversation has ended.

Using onSelectAction to control triggerAction behavior

By default, triggerAction will reset the current dialog stack with the new dialog. In the case of AddNumber that’s just fine; the logic on the dialog is designed for the dialog to continually restart. But this is problematic when it comes to Help. Needless to say, we don’t want to reset the entire set of dialogs when the user types help; we want to allow the user to pick up right where they left off.

Bot Framework provides beginDialog for adding a dialog to the stack. When that dialog completes, it returns to the control to the active step in the prior dialog. Or, in terms of the case of our Help example, it will allow the user to pick up where they left off.

The onSelectAction property on ITriggerActionOptions executes when the bot is about to start the dialog being triggered. By using this event, we can change the way the dialog is started, using beginDialog, which will add the dialog to the stack instead of replacing stack. The first parameter is the name of the dialog we wish to start, which is provided in args.action, and the second is the args parameter we want to pass into the the dialog when it starts. The code sample below will ensure we return control to the prior dialog when this one completes.

onSelectAction sample code

1
2
3
4
5
6
7
8
9
10
bot.dialog('Help', [
(session, args, next) => {
session.endDialog(`You can type **add** to add numbers.`);
}
]).triggerAction({
matches: /^help/i,
onSelectAction: (session, args) => {
session.beginDialog(args.action, args);
}
});

Sample code

onSelectAction notes

When using beginDialog, don’t hard code the name of the dialog you’re about to start, but rather use args.action. Otherwise, you’ll notice the dialog won’t actually start.

Using beginDialogAction to centralize help messaging

One of the challenges with the help solution we created earlier is it can only provide generic help; whenever the user types help the exact same message is sent to the user. By using beginDialogAction you can parameters to the triggered dialog, allowing you to centralize messaging for help. In our case, we’ll use the name of the current action as the key to the message we want to send.

beginDialogAction to centralize help sample code

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
bot.dialog('AddNumber', [
// existing waterfall code snipped
])
.triggerAction({matches: /^add$/i})
.beginDialogAction('Total', 'Total', { matches: /^total$/})
.beginDialogAction('HelpAddNumber', 'Help', { matches: /^help$/, dialogArgs: {action: 'AddNumber'} });
bot.dialog('Total', [
(session, results, next) => {
session.endConversation(`The total is ${session.privateConversationData.runningTotal}`);
},
]);
bot.dialog('Help', [
(session, args, next) => {
let message = '';
switch(args.action) {
case 'AddNumber':
message = 'You can either type the next number, or use **total** to get the total.';
break;
default:
message = 'You can type **add** to add numbers.';
break;
}
session.endDialog(message);
}
]).triggerAction({
matches: /^help/i,
onSelectAction: (session, args) => {
session.beginDialog(args.action, args);
}
});

Sample code

Using cancelAction and endConversationAction

If you’ve made it to this point in the article, you already have the skills necessary to create a global cancel operation - you’d add a new dialog, register it with triggerAction, and add a string match for the word cancel. The dialog would then call endConversation with a friendly message, and the user would be able to restart he operation.

However, let’s say you wanted to provide granular support for cancel operations, changing the behavior on different dialogs, or maybe not allowing a cancel on a dialog at all. This is where cancelAction and endConversationAction come into place. Both are tied to a specific dialog, and cancelAction cancels just the dialog, while endConversationAction cancels the entire conversation.

The second parameter you’ll pass into cancelAction is ICancelActionOptions, which includes the matches and onSelectAction properties we’ve seen before. It also adds confirmPrompt, which, if set, will prompt the user if they actually want to cancel.

cancelAction sample code

1
2
3
4
5
6
7
bot.dialog('AddNumber', [
// prior code for AddNumber snipped for clarity
])
.endConversationAction('CancelAddNumber', 'Operation cancelled', {
matches: /^cancel$/,
confirmPrompt: `Are you sure you wish to cancel?`
})

Sample code

Conclusion

Bot Framework offers many options and methods for managing dialogs and responding to user requests. Harnessing the the power provided by dialogs allows you to create bots that can have conversations with your users that feel more natural.

Acknowledgements

Thank you to Nafis Zaman for the catch on the behavior of cancelAction.


New York Marathon - 2016

The New York Marathon. There’s really nothing else you need to say to runners and non-runners alike. It’s the largest marathon in the world, and arguably the most prestigious. While it doesn’t have the qualifying cache that Boston does, it’s a marathon everyone knows, and is on the bucket list of every runner, or at least all the ones I know.

As a Jersey Boy, it’s a race I’ve wanted to do for as long as I can remember, long before I laced up a pair of running shoes and heaved my way around Fiesta Island with a friend for my first “run”. I’d entered the lottery 3 times prior with no luck. So my joy upon seeing that email that contained the word “Congratulations” cannot even begin to be described. I’m honestly getting chills just sitting here thinking back to that day.

The Training

Anyone who knows me knows my snake-bitten history with marathon training. This cycle was no exception in that aspect, but there were a few other factors that contributed to a less-than-optimal summer.

For starters, and I’m just going to point the biggest finger at myself, I was frankly just tired. I’d done Grandma’s Marathon at the end of June. For those of you scoring at home (or even if you’re alone), that’s just 4 months before the New York Marathon, or about 20 weeks. That doesn’t give you much “I’m just going to sit on my keester and do nothing” time. The moment I finished my last marathon I was already back in training mode. That was a bit much for me, and I was burned out going into the next round. As such, I wasn’t as committed as I should have been, and it certainly showed.

In addition, my travel schedule was a struggle. While I used to travel full time, my schedule and destinations were relatively predictable, so it was easy to work my training into the week. During the training period I had a handful of oddball trips that threw off everything, including a trip to Japan. As a perfect example, I’d hoped to knock out an 18 miler in Japan - the weather conspired against me, and my body quit after 14. (Actually, it quit after 8, but I pushed through the rest.) While it did give me an opportunity to do 18 with a great friend the next week, it wasn’t where I needed to be.

The week after said 18 I’d intended to do “the 20 miler”. After about 3 miles I had a tendon behind my knee start to complain. I kept thinking it just needed to loosen up, but after I finished 6, and the group I was with got back to the parking lot where we were going to meet more people for the rest of the run, I knew I was done for the day. I tried to stretch, which elicited a stream of curse words that would make a sailor blush. I hopped in the car, had a good cry thinking I wouldn’t be able to run after all. I went to my PT, who threw everything he had at it, rested, compressed, and everything else, in hopes I was able to run.

Amazingly, I was able to meet the one true goal every marathoner has: toeing the starting line. And this time it was at the foot of the Verrazano.

New York City Logistics

I knew I wanted to stay in the Financial District (FiDi), because it’s both quiet at night, and walking distance to the Staten Island Ferry. I found a nice little Airbnb that was just a few blocks away from the terminal, and thought all was good. Until about 6 weeks before the race when I received an email from the host saying his building’s management wouldn’t let him rent the place out any longer. Anyone who knows Airbnb in New York knows how little the government cares for Airbnb, and how little Airbnb cares for government regulations. So despite Airbnb being one of the sponsors of the event, it was pretty clear to me this wasn’t going to be an option, or at least not a reliable one. (FWIW, I’d suggest avoiding Airbnb in New York for this exact reason.)

Fortunately I managed to get a great rate on the DoubleTree, which is about 3 blocks from the terminal. It’s also a hotel I’d stayed at many times, so I was familiar with both the hotel and the area around it. I’m all about the comfort provided by routine, and this was going to give me exactly that.

I arrived on the Thursday before the race, so I could see Tim Minchin perform, and to get adjusted to the time zone. Landed in Newark, Lyft (speaking of companies with contentious relationships with the government) up to FiDi, and focused on relaxing as much as possible.

The Expo

Obligatory Expo Photo

I’d been told many times to get to the expo as early in the day, and the week, as possible. Heed this advice! While they take over a convention center floor, and have an amazing amount of real estate, there’s still 50,000 runners that need to make their way through the area, not to mention family and friends they bring along for support.

I got there at about 10:45, 45 minutes after opening, and it was already very busy.

That said, it’s as well organized as an event of this size can be. If you were smart enough to print out your check-in sheet at home you could head straight over to pickup. Or, if you were like me, you head over to a little kiosk, and get a little receipt printout, and then go get your packet. From there it’s over to grab your shirt, where there was a huge line for Men’s Medium. Fortunately I still have a few extra pounds on my frame, so I was grabbing a Large, and was through that pretty quickly.

Next up - swag. Yeah, we’re going to ignore the race fee, and the free shirt they just gave me. I needed more swag. So through the swag store I went, picking up a jacket. And another shirt. And a pint glass. And a hat. (I’m honestly I was that restrained.)

From there it’s on to the main expo floor, where you’ll find vendors selling all manner of snake oil, running gear, and last minute supplies such as gels. I made a bee-line for the CEP section to find a quad sleeve to help my ailing hamstring tendon. Upon acquiring that, I checked out a great little seminar put on by the Whippets running group, who walked everyone through the course. If it’s your first New York Marathon, I can’t recommend attending this enough. As an added bonus, I happened to see someone with a custom bib with his name on it; he pointed me at the station that was doing that, and grabbed ones that said “Chris” and “Jersey”, unsure of which one I was going to wear on race day.

Finally I realized I was tired, and hungry, and needed to get out of there. I spent about 3 hours there, and I’d say that’s probably about average for most people.

The Day Before

My wife took the red-eye on Friday into New York, and my brother caught an early flight from Burlington down. My support crew had arrived. Just having them there gave me great comfort.

I truly wouldn't be able to do this without amazing support

We spent Saturday doing a dry run of the three different viewing spots they were going to cheer me on at. It worked well for them, as they got to see the locations, and which trains they needed. It worked well for me, as it gave me great visuals of where I was going to be on the course, and where to look for them.

We also walked about the last 2 miles of the race. While it was much longer than I really wanted to walk, I wanted to see the last mile. In the end, I’m glad that I walked the distance. It allowed me to make a few mental notes in regards to landmarks, and to see the exit and re-entry into Central Park.

It also allowed me to see the hill that is the .2 of the 26.2. Make sure you’re ready for that! They make you work for that medal.

BTW, if you’re looking for a good cheer strategy, take a train out to somewhere close to Barclay’s Center (it was the R train for us). You can see people at the 8 mile mark, just after where all the runners come together (more on that later). From there, hop the 4 train to somewhere along 1st. The crowds start to think towards the 100 blocks; my cheer crew waited for me on 86th. From there they can walk over to 5th for one last cheer. From 5th, you can catch one of the paths across the park around 86th and 5th. I was able to meet up with them on Columbus and 74th. It all worked out perfectly. Granted, you can’t be much faster than about a 4 hour time for the 3x strategy to work, so YMMV.

We bid my brother farewell for the night as he had family obligations (which I managed to dodge.) My wife and I went off to find Japanese food (rice is my pre-race carb of choice), and then off to sleep with visions of PRs dancing in my head.

The Morning

Now I should mention at this point that I, like many a runner, have a delicate stomach. Part of my plan behind paying the money for the DoubleTree in FiDi was to be in a familiar neighborhood, with familiar shops. During the short period of time we were there I’d asked the Essen deli/bagel shop about their hours. They assured me they were 24/7. Perfect!

I woke up after a pretty good night’s sleep, and began my preparations. I’d already laid out my deflated runner, so I knew what I was wearing, and that I had everything in regards to that. I put everything together, donning my running outfit, filling my water bottles, and tossing on my donation outfit of a sweatshirt, sweatpants and a robe.

That's a comfortable looking robe

Yes, a robe. I mean, if you’re going to be up that early, you may as well have a robe.

After kissing my wife goodbye, and getting the good luck wishes I certainly needed, I roamed over to Essen for my english muffin and peanut butter. Only, the “grill”, so to speak, wasn’t open. OK, deep breath. I’m not going to let this get into my head. So I bought two raw english muffins from the guy behind the counter, and a Kind Bar, which I hoped would be OK with my stomach.

I walked over to the ferry, with hundreds of other runners. If it didn’t already start to hit me that I was about to run the New York Marathon, it became a reality at that point. I chatted with a couple of other runners on the way over. Seeing the Staten Island Ferry sign elicited a couple of tears.

The security presence was obvious, but not overwhelming. My bags were sniffed by a couple of rather cute dogs, and away I went onto the 6:30 ferry. I was originally set for the 6:45 ferry, and I was hoping to see a couple of Seattle Green Lake Running Group (SGLRG) runners, but the draw of just getting to Staten Island was too much. (As it turned out, the ferries after 7:30 started having issues from what I’ve heard, so maybe it’s just as well.)

The ferry was full of runners, save for a few people that were riding it because it’s, well, the Staten Island Ferry, who weren’t necessarily thrilled we were there. I <3 NY. The ride is relatively quick, and gives you an amazing view of Lady Liberty, which is a wonderful way to start any morning.

Good morning Lady Liberty

Upon arriving on Staten Island it was a bus ride over to the start. Relax. That’s where the line really starts, as well as the waiting. Bring a paper, a copy of Runner’s World, or something to pass the time. Or, just people watch. Between the people who’ve done numerous marathons, to the first timers, to everyone else, there’s plenty of sights to see. Take it all in. You’re about to run the greatest marathon on the planet (again - sorry, Boston).

We unloaded at Fort Wadsworth, where we were greeted by more security, and more dogs. And then it was time to get prepped for the race.

The Waiting

Follow the signs

I’d read a few things in the past that said to get to Fort Wadsworth as late as possible. I landed a good 2 hours before the start, and I felt like that was perfect. Next time I run the race I fully intend on getting over to Staten Island relatively early.

The organizers have this down to a science. They know exactly what they’re doing. The race is broken down into 4 separate start times, and then 3 different colors, and then corrals from there. On top of that, the start area has a ton of real estate on which to spread out. As a result, it oddly feels like a much smaller race than it actually is. There was plenty of space to spread out, to take care of last minute preparations, or to just close your eyes and relax on the grass.

That said, the porta-potty lines are ridiculous. Make sure you give yourself plenty of time to answer nature’s call. In fact, it’s not a terrible idea to take care of things an hop back in line, just in case.

As for me, I worked on my last bits of prep. I assembled the rest of my outfit, attaching my bib and my name bib to my shirt. I drank more and more water. I worked on not letting the fact I was about to run the New York Marathon hit me, with mixed results. Seeing the Verazano Narrows Bridge in the distance is hard to ignore.

The Verazzano

The Time Goal

At some point I should probably talk about my time goal. Every runner has one, despite how much they might deny it. If they are admitting to a time goal, they probably have a faster one they’re not really not wanting to make public.

I’m not that runner. I have one simple marathon goal: I want the first number to be a 3. I don’t care if it’s followed by 59:59, my white unicorn starts with the number 3. Just once I want to finish under four hours.

Considering the disjointed training plan I had I wasn’t sure what my body might offer. But during that “taper” period, where I was mostly just trying to not upset that tendon, I was running a comfortable 8:40 pace, or about 30 seconds faster than what I’d need on race day. In fact, the last run I had with my Canadian Running Wife (CRW) featured a push up a hill which made her work, and she’s much faster than I am.

After all of that, I thought I’d be able to finally find that white unicorn.

The Corrals and Colors

The race of course starts on the Verazano Narrows Bridge. There’s two stories on this bridge. And a couple of entrance/exit ramps on the other side in Brooklyn. And, of course, 50,000 humans to try and work with.

As a result, they break things down into waves, colors, and corrals. The corrals are mostly what you’d expect - packs of runners. And the waves are the various start times. Where things are truly different than most races are the colors. There are actually three paths for the first few miles of the race. Two colors, blue and green, take the top deck of the bridge, while orange takes the lower deck. Each of the three colors exits on a different ramp in Brooklyn. Because they’re all at different paces, there’s enough time, and distance, for everyone to naturally spread out before hitting the point in Brooklyn where everyone is brought together. Don’t get me wrong, there will always be people around you, but you’ll never feel like you’re fighting for elbow room.

Corral A

My Start

They called my (now updated) corral of Wave 3, Blue, Corral A. I roamed over and waited. And waited. And waited. They were still unloading wave 2, which took quite a while. I used the time for last minute prep, ditching my robe (sadly). I dropped a Nuun into my water belt bottles, and filled them with water. And I started to get a feel for the weather.

There are few things runners obsess over more than the weather, save for maybe pre-race-porta-potties. You could not have asked for a better day for a marathon. It was in the 50s to start, and sunny. No threat of rain, but there was talk of a little bit of wind, which did hit at times. But really, gorgeous running weather.

They opened the corral, which is really just another brief waiting area before you walk to the start. I saw a glimpse of the 4:00 pacer, who was towards the front of the corral, as I waited in line to, well, take care of business. By the time I got out they were long since gone.

I walked towards the start line with everyone as they released us, working on breathing exercises. Someone sang God Bless America, rather than the anthem, which got my blood going. I kept trying to find that 4:00 sign, wanting a pack to run with. Alas, I wasn’t able to find them. I ditched the sweatsuit and focused on the goal.

Then the cannon went off.

The Verazano Narrows Bridge

Marathon rules:

  1. Don’t go out too fast
  2. See Rule 1

It seems so simple. Especially in New York where the first mile is straight uphill. I mean, really, go slow. In theory, that first mile for someone trying to break 4:00 should still be around 10:00, if not even slower.

But, there’s a cannon. And cameras. And the fact that it’s the New York Marathon.

The adrenaline carried me up the hill in 9:40. I didn’t mean to run that fast, but there I was at the top of the bridge. Amazingly I still couldn’t find that 4:00 pacer, but at that point my concerns were focused around that lovely quad compression sleeve I’d purchased which was now around my knee.

Compression had been helping my tendon leading up to the race, so I was really hoping to have the sleeve for the race. The sleeve, however, had other plans. I’m no doctor, but I’m pretty sure having all of that around one’s knee is not a good thing. Once we hit the top of the bridge I stopped for a few seconds to pull the sleeve off and ditch it.

Then I focused my attention on relaxing. It’s just mile 2. I need to slow down. 9:40 was not where I wanted to be that first mile, so let me settle in and just enjoy the downhill.

The watch beeped at mile 2 at 8:20. So much for relaxing.

That's me on the lower right in green!!

Welcome to Brooklyn

I’d always been told that the New York Marathon was like no other marathon in regards to fans, that there would be fans the entire race. Obviously there are no fans on the Verazano, but landing in Brooklyn brought the first pack of fans.

It oddly felt at that point like a lot of other early marathon stages. Having run the San Diego Rock-n-Roll, it felt like I’d turned onto Washington St. There were people lining the streets, but only about one deep. And there were bands.

But there was still a different energy. There was a crescendo building.

I tried to settle in. Tried. I wanted nothing more than to just settle into a 9:09 pace (4:00 hours). But my legs just refused to go that slow. I was caught up in the energy. The fans and other runners carried me.

The crowds continued to build. Even though I was running in the middle of the street to try to just get into my own head and find my pace, I could still feel the energy they were giving me.

I crossed the 10K mark a full minute ahead of schedule. This was not good. And I knew it wasn’t good. My body started to feel it. The four to six mile section of the course features a steady downhill, which beat up my quads. But I kept hoping my legs would come back to me, and I knew that I had my cheering squad at mile 8.

I focused on the couple of turns that took us through the heart of Brooklyn and towards Abram and Karin. I took the right, drifted towards the left, and saw the green and pink poster boards they had. Giving them both high fives filled me with more energy than I can explain.

The crowds through that area are amazing. They’re 4 to 5 deep. And screaming at the top of their lungs. You feel like an absolute rock star. You’re on top of the world.

Around mile 10 you hit the traditional Jewish part of town. There are still fans there, but it’s more quiet. People are just going on about their day, mostly just ambivalent or annoyed at your presence. It was surreal coming out of such an energy filled section of the course to the exact opposite, and get a glimpse of the town going on about its day.

As for me, well, that was when I started spewing axle grease all over the course. My quads started to give way. As did almost every other subsystem in my body. I felt lightheaded. And nauseated. And miserable. I started walking, weaving a little side to side. While it’s certainly hard to self-diagnose, I’d be willing to bet I was over-hydrated. Whatever it was, I just refused to let it stop me. Slow me down, sure. But I wasn’t going to stop.

I focused, took a deep breath, found some form of a cadence, and kept moving.

Welcome to Queens

You don’t spend much time in Queens. From a marathoner’s perspective, about the only thing you do in Queens is get ready for the bridge. You do have to climb the Pulaski Bridge to get into Queens, but you’re only in the borough long enough to make a few turns.

I did have to walk a bit in Queens. My motivation was still high, and I still had a goal. At this point I knew my white unicorn was gone, but I was still hoping for about a 4:15.

Welcome to Manhattan

OK, maybe not yet.

Now, full disclaimer, I’m generally not one to swear. Because there’s only one way to tell this story, and that’s as follows.

We took the left from Queens onto the Queensboro Fucking Bridge. I’m convinced that’s its real name. The Queensboro Fucking Bridge (QFB).

At this point, my will to live was slowly sucked away.

The QFB has many terrible features.

For starters, there are no fans. There’s no way onto the QFB unless you’re a runner. It’s just you, and the sounds of everyone else around you.

In addition, you’re on the lower deck. That, for me, and many others I’ve talked to, creates this terrible illusion the crest of the hill is just ahead, but it’s not. It seems to just go on forever.

The views are certainly amazing.

But the rest of the experience is disheartening.

I finally got to the end of this interminable bridge, and my quads were truly gone. I had to stop as I got onto 59th to stretch, something I’d never had to do in any marathon prior to New York.

Welcome to Manhattan (for reals)

If you’ve read anything about the New York Marathon, you’ve certainly heard about the crowds that await you at the end of the QFB. All of that is real, and it continues for a good couple of miles. Fans will be there 4 to 5 deep. There are truly no words in my vernacular to describe how amazing the atmosphere is through this section of the course.

When you finally take the left onto First you are greeted by unmatched energy, and a view of a sea of runners stretching out as far as one can see. It’s breathtaking. It truly feels at this point like you’re running the New York Marathon.

As for me, it’s now truly a struggle. My goal has been adjusted to just making the New York Times, who does a special section for the marathon listing off marathoners; I had heard the cutoff is 4:30.

Walk as needed, force myself to run as much as possible. But just keep moving.

I knew Karin and Abram were at 87th, and that was all I was focused on. I saw them, and gave them both a hug. Normally I wouldn’t have done that, but considering most of my time goals were shot, I wanted to take the time to thank them.

I shared my hatred for the QFB with them, and said I was happy I wasn’t the guy I passed a little earlier who’d pooped himself. It’s all about perspective.

From there I kept working my way on to the Bronx, with a single focus - seeing Karin and Abram one more time. I’m not going to say I would have dropped out of the race, but at this point I was rather miserable, and my main reason for staying on the course was to see them one last time on 5th.

Welcome to The Bronx

As much as I loathe the QFB, and I do, I have to say that the bridge leading into The Bronx has its own special kind of awful. It’s cambered, and while not long is just steep enough to truly frustrate you. Or, at least frustrate me.

That said, the fans in The Bronx, while certainly not as numerous as Manhattan, are feverish. They were truly proud of their neighborhood, and wanted you to know it. I appreciated that more than my face showed.

Although, my face only showed misery at that point.

Welcome Back to Manhattan

At this point my body is just shot. Mentally, I’m still in the game. After all, I’m running the New York Marathon. I mean, what could be better than that? But I couldn’t get much behind a 50/50 run/walk, and even a 50/50 ratio was a struggle at best. My goal had shifted to just finishing in under five hours.

After climbing the last bridge (finally!!) into Manhattan, I tried to just enjoy the atmosphere. The atmosphere through Harlem was all that I had hoped it would be. There was a church choir out singing, and, again, a prideful neighborhood.

It’s at this point I realize how well the course shows off the city and its neighborhoods. You get a great feel for what makes New York the greatest city on the planet.

It’s also when I realize the hill that is mile 23, and 5th Avenue.

As I mentioned earlier, one of the driving forces I had was to see Karin and Abram. We had made plans for them to be in the mid-to-upper 90s along 5th, on the left side. After taking the quick right, left, left, and right around the park, it was all I was focused on.

The hill was tougher than I expected. That said, the crowds were beyond comprehension.

Callback

At this point I’d like to double back to the name tag debate I had in my head before the race of Chris vs Jersey. While I truly hate being called Chris, I was worried that wearing “Jersey” in New York would bring me nothing but heckling. I asked a friend of mine who’d run the race a couple of years prior, Elaine, who told me there is no negativity on race day.

I can safely say she’s right. I heard nothing but either “Jersey Strong!!” or people chanting “Jersey”.

And down 5th, that energy kept me going.

Back to 5th

I hung to the left side where we’d agreed to meet, and didn’t see them. While I was disappointed, I kept to the left hoping they’d simply not ventured that far north, while accepting the fact I’d missed them.

And then there they were. I gave them both a hug.

Welcome to Central Park

Welcome to Central Park

Shortly after seeing Karin and Abram I turned right into Central Park. I’d seen the signs the day before, but seeing them on race day brought me to tears.

I love Central Park.

It is my favorite place on the planet to run, full stop.

Seeing that sign not only meant I had less than 3 miles to go, it also brought me into my “running mecca”.

It had been a while since I’ve run Central Park, so the walk the day before helped remind me that the path back towards Central Park South is longer than it seems. I focused on the sights, but also on hitting the 40K mark at 4:45. I knew, if nothing else, that I could force myself through 2K in under 15 minutes.

Coming down 5th, and then into Central Park, you’re just surrounded by runners and energy. It’s near deafening. It’s truly special.

The Last Point 2

Mile 26

Taking the right from Columbus Circle back into the park was one of the best feelings I’ve ever had. I saw the 26 Mile sign and started bawling. After a few steps I realized it’s hard to breathe while crying and managed to contain myself.

Then you hit the uphill that makes up that last 385 yards. It’s tough.

And then the finish. No words can describe finishing a marathon, and nowhere is that more true than in New York.

More tears. More joy. I just finished the New York Marathon.

The Next Mile

Yes, you read that right. There’s one more mile to go as you work your way out of the finishing chute. There’s 50,000 runners to contend with. As large as Central Park is, they still need to go somewhere. Add to that the fact that there’s only certain exit spots from the Park to the City, and you’re looking at a solid mile walk to the finish if you didn’t gear check (which I didn’t.) On top of it all, you have to walk uphill.

The Reunion

After making it through the next mile I met up with Abram and Karin at 75th & Columbus. Karin gave me a huge hug, and Abram handed me a can of Heady Topper. We figured on race day open container laws would be overlooked. :-)

It was then time to go find food and celebrate.

We walked into a German beer hall (Reichenbach Hall), where they cheered every runner who stumbled in. This city embraces the marathon.

And the celebration was in full swing.

Celebration

Post mortem

When it comes time to do it again (because there will be another go):

  • Focus on training
  • Focus on hills - lots of hills
  • Respect the course
  • Go out slower
  • Enjoy it all over again!

The reward

Race Day Tips

  • Wear your name on your shirt. Yes, you’ll feel a bit dorky, but I’m here to tell you that hearing your name chanted at mile 23 makes all the difference in the world.
  • If you’re going to have a cheer crew, work out exactly where they’re going to be. There are a lot of runners, and it’s easier for the runner to spot the fan. Work out the side, the corner, what they’re going to be wearing, what signs they’ll be holding, etc.
  • There are porta-potties where the busses pick up at the Staten Island Ferry. If you don’t feel the need to have an actual restroom, there are no lines there. It’s a great place to, well, take care of business.
  • Do not check a bag if at all possible. Having to walk through the bag check area is a challenge you don’t want to face when you finish.
  • Bring a phone if you can for post-race coordination. Having a Metro card and a $20 is also a good idea.
  • Enjoy it. It’s the New York Marathon.