Conversational UI:  writing chat bot scripts step by step

Time for reading: 10 min
Share article

The speed at which AI tech is advancing today, traditional UI may soon become a relic of the past. The future, it seems, will belong to a new type of UI – powered by advanced chatbot scripts.

This three-part series uncovers the main principles behind conversational interfaces.

So, dust off your typewriter, brew a bucket of jet-black coffee, and put on a writer’s hat.

writer cap

#1 Write dialog fragments and map them onto conversation flows

Learn as much as you can about potential users. What answers they might be looking for when talking to your bot? How can it improve their experience? Is chatbot really the best way to solve their problems?

Now, when you reviewed your goals, you can start designing the chatbot.

Before you start writing, pick the tools that will allow you to arrange branching dialogue trees. You can try BotMock, ArcTouch, Lucidchart, Twine, Chat Mapper,, inklewriter, or Xmind. Or you could do it the old-school way with lots of paper.

Approach it as if you’re writing a play, or even better, a choose-your-own-adventure story.

The key difference here is that a play is a cohesive piece of work while chat bot scripts can be divided into relatively small, independent fragments:

  • Conversation starters

You only have one shot at making the first impression, so make your greeting as appealing as possible. And don’t forget to entice users to write you back.

“Greetings, human! I’m Shopbot 2000, your awesome guide to the world of e-commerce.”

“Type /shop to see the categories or simply tell me what you want.”

At this stage, it can be a good idea to use buttons, quick replies, and carousels to illustrate different options users have for interacting with your chatbot.

  • Small talk fragments

They are great for simulating real conversations. Just keep the chatter to a minimum for utilitarian bots.

“How’re you doin’? Here’s a cat GIF to cheer you up.”

  • Objective-related fragments

Interacting with a chatbot typically includes a number of questions that help you qualify the potential customer and make the conversion.

“You’ve picked the sneakers category. Please, choose the item you like”.

“Great choice, now select your size”.

“Your size is 9.5, got it. What color would you like? We got pink, black, and white”.

  • Conversation finishers

All you have to do after a user makes a conversion is to thank them for attention and remind to come back if they ever need something.

“Always glad to help you, John! Write back if ever you need something”.

Your last message is extremely important as it’s the first thing your users will see when they open the messenger. You can be specific, creative, or inciting, but never boring!

Bonus tip: add the user name to your closing word for a personal touch.

Write each fragment separately and then map them onto your conversation flows.

Strung together they’ll form countless dialogue paths.

Remember, users can only travel one path at a time. So make sure that each separate conversation has a good flow and makes perfect sense in and of itself.

Now let’s meet our characters.

#2 Teach your bot to respond to user input

A user is the protagonist of your play.

While you can’t control what he or she will say in each situation, you can predict it. Without a capable AI behind your bot, you’ll have to teach it lots of alternative phrases.

Start at the sentence level. Brainstorm different constructions your customers may use in a particular situation. Then proceed to the words.

Look up as many synonyms as you can including slang and dialect words.

The final level is teaching your conversational chatbot the common misspellings.

Note: You can use the Normalizer library to transform British and Canadian spelling into its American variant, decipher popular abbreviations and correct more than 4,000 misspelled words.

The second character in the play is your bot.

Remember, the dialogue in a good play both advances the plot and gives us a glimpse into the characters’ personalities. Likewise, the bot’s dialogue should both move users towards their goals and tell them about your brand.

Here’s how to achieve this.

  • Remember your goals

When writing a chatbot script, you should always keep in mind the goals of your conversational interface.

Always try to bring your users back to the topic. Wandering in the dark and scary forest of the convoluted dialogue trees will quickly turn them into big sad trolls.

So, respect your users and their time!


Chatbot dialogue


Weather chatbot

Staying on topic like a champ

  • Sound natural

Talk like a real person, but never pretend to be one!

This mistake is common among customer service chatbots.

The majority of users prefer a fun conversational style that sounds like talking to an old friend. So unless your bot character is a posh gentleman, use simple grammar and avoid fancy wording. Address your users directly and if possible, use their names.


Healthcare center chatbot


Katy Perry's bot

  • Be consistent

By now you should’ve created a detailed personality guide for your bot. The document has to include the character’s info such as age, gender (even Roombas have one), occupation, interests, personality, etc.

Once you’ve created an engaging personality for your bot, you’ll have to stay in character. So remember to be consistent in your style, vocabulary, and tone as nobody enjoys chatting with a bot that seems to have a split personality.

Katy Perry's chatbot

Weird, but consistent Katy Perry’s bot

  • Be concise

Brevity is a writer’s best friend.

The bot’s message shouldn’t be longer than three lines of text on mobile devices (60 to 90 characters).

But if you absolutely have to present users with a wall of text, separate it into several speech bubbles to emphasize the negative space.

Just like I do with paragraphs.

Also, remember that a stream of one-word sentences will make your chatbot needlessly robotic. So mix them up. Surrounding brief remarks with longer sentences will emphasize them. Make them stronger. Punchier.

Keep your conversations short. Each question is a barrier to conversion, so make sure users can fulfill their needs in as few steps as possible.


Facebook bot Mitsuku

This may work for website chat bots, but that’s too long for messengers.


Facebook chatbot Erwin

Just enough to explain the bot’s purpose and give a taste of what’s to come.

  • Expect the unexpected

When we launched our first bot for HipChat (now Slack), we discovered that the majority of users wanted to drive him crazy.

They’ve tried everything from playful quips and random questions to insults and gibberish.

In the end, MindkOfficeBot (creative name, right?) simply gave up. Last time we’ve heard of him, he started his own rock band 🙂

The lesson? People will always try to mess with your bot and the constant stream of “I don’t know” will get old really fast.


chatbot don’t understand your input

Sending users to Wikipedia with the “Read More” button, again and again, is really frustrating


chatbot clever responces

So prepare some clever responses for when users broach the unsupported topics and nudge them back to the bot’s core functionality.

Just remember to show empathy and never insult users.

  • Mind the context

Linguists often use the term discourse to describe a conversation with all of its context including the interlocutors’ age, gender, profession, their social standing, the topic of conversation, the place where it happens, the society’s attitude towards the discussed matters, etc.

A conversation between a professor and his student will sound different than a chat between two peers.

Although there are fewer variables than in a real conversation, chatbots’ contextual awareness is one of the most difficult things about conversational UI from the technical point of view.

As writers and designers, we can create flows that make use of the previously acquired information. We can write chatbot scripts that take into account all the available data about our users as well as the conversation’s circumstances (Where?When?Why?)

Old copywriting advice states that you should write for a specific person (even if Mary-Jane Shchlzrwicz exists only in your head), not for a vague target audience.

Think about your customers mood. If they need technical support, they’ll likely be upset or frustrated. It’s not the best time to make your bot funny or smart, so keep it professional.

Now, in a happier context (e.g. ordering a vacation ticket) your bot can show a bit of personality.

In the previous article on chatbots,  I’ve talked about the importance of user research. There’s a number of templates you can use to create detailed user personas and adjust your writing to better suit them.

Track the user entry point to guess their goals and expectations. Discover whether they’ve visited your bot before and greet returning visitors.

Just make sure that your bot has a larger attention span than a goldfish!

Track the user entry point to guess their goals and expectations. Discover whether they’ve visited your bot before and greet returning visitors.

Just make sure that your bot has a larger attention span than a goldfish!

Chatbot dialogue

Source: Techcrunch

  • Vary Responses

Add alternative responses to your bot’s lexicon. Remember, nothing shatters an illusion of talking to a person more than getting a row of identical answers.

It’s one thing when your interface greets users with “Hello!”, it’s a whole other if it can also say “How do you do!”, “Greetings, [name]!”, and “Good morning/Good evening” (depending on the time of day).

The more answers you can think up for a single input, the more human your bot will appear.

Remember, you can use buttons, quick replies, menus, emoji, images, GIFs, and other rich media elements to make your bot more engaging.


bot's alternative responses


alternative responses to your bot’s lexicon

That moment when a cat is better than you at spelling.

No matter how many alternative answers you have in store, your bot will at some point repeat itself. You can use such moments to your advantage.
When users complain of getting the same lines, say something clever:

“Repeating my lines? Nah, just checking if you’re paying attention.”

  • Add the finishing touches

After the conversation is over, don’t waste your chance to re-engage the user.
Just like with push notifications, the most powerful messages are the ones your customers have opted in for themselves.

So offer an option to subscribe to your bot and recieve some useful messages. Just remember to users to unsubscribe at any moment.


Skyscanner finds cheap flights and sends them by subscription

And remember to read the bot’s parts aloud after you’ve completed the script to see if the chatbot conversation sounds natural (this is especially important for voice apps)!

Now, writing chatbot scripts is much easier if you have a real AI behind your bot. So let us know if you need experienced chatbot developers.

Wrapping Up

ongratulations, you’ve learned how to write a chatbot script!

Now all you’ve got to do is wait for the developers to do their magic.
So take a day off, order a bunch of mojitos, and lie in the sun as coding wizards bring your chatbot to life.

But remember, creating a fun and engaging conversational interface is not a one-off task. It’s a long and winding path to perfection. You should improve your chatbot scripts after the launch!

Employ analytics, look for the drop-off points, run A/B tests. And if you ever feel lost on your way, you always can
contact us directly.

Further reading: how to craft an unforgettable chatbot experience.

e-book agile development

Subscribe to MindK Blog

Get our greatest hits delivered to your inbox once a month.
MindK uses the information you provide to us to contact you about our relevant content andservices. You may unsubscribe at any time. For more information, check out our privacy policy.

Read next

Project management best practices

13 Project Management Best Practices When Outsourcing Software Development 

Read more
How to scale a consulting business

A More Effective Way to Scale Your Consulting Business in 2023

Read more
Cross-platform vs. Native development

React Native vs Native development: What should your mobile app development team choose?

Read more