Quick Start Guide

"To make a great film, you need three things -- the script, the script, and the script."

- Alfred Hitchcock

To the delights of both yourself and the great Mr. Hitchcock, writing bots on Dexter is going to be a lot like writing movie scripts. They both involve writing dialogue between characters (in a bot's case, just two: the Human and the Bot), giving simple directions on how to act, and are both written in this cool monospace font.

But before you continue this quick start guide, you should create a new bot on Dexter from the Blank template and name it whatever you would like. You'll then be on the Editor page—you know you're in the right place when you see the cool monospace font. This is where you will be writing the dialogue script for your bot.

And no cheating: delete everything you see here before we get started!

The tester in action

Writing Your First Dialogue Exchange

Thinking about how to begin writing a script is always hard, so let's keep it simple here. Remember, we have just two characters: a Human (aka, your users) and a Bot (aka, the thing you're building now).

Let's start simple and pretend that one of your users is greeting the bot by saying hello to it. Type a plus sign + followed by hello into the editor so it looks like this:

+ hello

When you start a line with +, it means "a user might say this." We call this a trigger.

In this basic script, when a user says hello your bot should respond with it's me. To do this, let's add new line and write - it's me so that your full script looks like:

+ hello
- it's me

As you might have imagined, the - indicates a response and means "the bot should respond like this." For good measure, let's add another trigger/response pair so your script looks like:

+ hello
- it's me
 
+ goodbye
- leaving so soon?
Triggers should always be lower-cased; they will match regardless if users capitalize their messages.

Test Your Dialogue

Now that we have this little scene written between a Human and a Bot (and Adele stuck in our heads), let's practice this scene—in bot-building, this amounts to testing your bot. Find the tester on the right side of the screen and tell it hello. You should see your bot respond:

The tester in action

Pretty cool, right? It may not look like much, but you have in front of you now is a fully functional bot!

As you might have discovered, there are going to be times when a user will send your bot a message that it doesn't know what to respond with. (Just try sending your bot anything that's not "hello" or "goodbye"). To fix this, we are going to add a catch-all trigger and corresponding response. Add these two new lines to your script then try again:

+ hello
- it's me
 
+ goodbye
- leaving so soon?
 
+ *
- I don't quite understand! Try "hello" or "goodbye"

As you can tell, + * at the bottom of a script will match anything that you did not write a trigger for.

Organization and Adding Media

Now that we have a decently robust dialogue, let's talk a bit about organization. As you add more triggers to your bot, it could grow pretty large. Topics are a way to organize your script into sections that have isolated triggers from each other. (If we keep up up with the movie script analogy, think of these as movie scenes.) Every user of your bot is always "inside" of a topic, but not every user is inside the same topic. All users start in the default topic.

Let's suppose you want your bot to be able to cheer up your users with funny GIFs of animals when they ask. When they say dogs or cats, your bot will respond with a funny GIF. We're going to isolate these triggers in another topic because it wouldn't make sense to respond with GIFs unless your user asked to be cheered up!

Let's make the trigger + cheer me up and have the bot respond "Will do! Do you like cats or dogs?" At this point, we also want to switch topics to the "cheer" topic (we will create the topic in a bit).

Notice the new {topic=cheer} direction to your bot and where this trigger/response pair is placed: above the catch-all.

+ hello
- it's me
 
+ goodbye
- leaving so soon?
 
+ cheer me up
- Will do! Do you like cats or dogs? {topic=cheer}
 
+ *
- I don't quite understand! Try "hello" or "goodbye"

Now let's create this topic. Click the Add Topic button and change the topic's name to cheer:

Creating and renaming a topic

You should notice this looks pretty familiar—just like where we were before, starting a dialogue script from scratch.

Adding Images

Now that we're in our new "cheer" topic, let's add an image to your bot's response by using the ^image() shortcode. Just put a URL inside the parentheses and your bot will respond with an image. Hopefully triggers and responses are second nature to you by now and the following makes sense:

+ cats
- ^image("https://i.giphy.com/Ejf2QdsB7RKvu.gif")
 
+ dogs
- ^image("https://i.giphy.com/N2U7cpQvm0G5y.gif")
 
+ *
- I only understand "cats" or "dogs" -- try again!

Try talking with your bot again and get it to respond with your GIFs.

The "default" topic you started with is special in that it also acts as a "fallback" topic. If the current topic your user is in does not have any triggers that match what your user typed, it will look for a corresponding trigger in the "default" topic. This means it is critical to have a catch-all in the "default" topic!

Getting Your Bot Live

Publishing

Click the "Publish" button for both topics. The published version of a topic is the version that your users will interact with live. Users will not see any unpublished topics or changes to a topic that have not been published yet.

Publishing both topics

Configuration & Deployment

Once your topics are published, it is time to actually get your bot live on the internet. To do this, click Platforms on the menu

Platforms menu

and you should find a list of platforms that Dexter supports

Platforms list

For this guide, let's keep Messenger selected and you should be presented with a step-by-step guide on how to get your bot live onto Facebook. The main act of configuring means copy and pasting around some things so that Dexter can talk with your accounts on Facebook and vice-versa.

Once you're done configuring, deploy your bot so it is actually live and you can actually interact with it on Messenger!

You can always chat with your bot by going to m.me/YOUR_PAGE_ID.
Until you submit your bot to Facebook for review, only admins, developers, or testers that you list on your Facebook App will be able to interact with your bot. For more details, see our in-depth Facebook guide.

Pat yourself on the back. You've written a bot and gotten it live on the internet without any code. To learn how to make your bots even more powerful, explore our detailed guides below.

Detailed Guides

If you need to quickly reference what we've discussed in the docs, find the cheatsheet icon sprinkled throughout the site.