How to create a Blip Bot Router
By: Gabriel Rodrigues Dos Santos
Tags: Blip, Chatbots, Chatbot Development, Chatbot Design, Router

Adding services

Now you can publish your flow and go back to the router dashboard to add it as a service.

In the services tab you’ll see the “Add a service” button, click that and it will show you some options to add the service

The first option is the bot name, this name will be used to redirect to that service with the redirect command, so choose a meaningful name;

The second option is the bot itself, you can search by name and click on the bot you want to add;

The first checkbox must be set when adding a main bot, this bot will be the landing bot to new users;

The second checkbox only appears when you’re adding a bot that isn’t a main bot, when this box is checked the user will be stuck at the your subbot flow until you redirect him to other bot;

If you don’t check the second checkbox then you should set the redirect timeout, and if you won’t the default timeout is 30 minutes, it means that the user will be automatically redirected to the main bot after the redirect timeout (default or not).

As we are adding a main bot we will check the first checkbox, and after that you can click on “confirm”.

Now our router works and the badge on the icon is green! But keep in mind that you will have access to the bot through the router, not the main, so if you add any channel to the bot it must be set on the router.

I want more services!

We will create two bots, Tutorial specific 1 and Tutorial specific 2, using the same steps as for creating the main bot, the only difference is that this time you will have to set different names to the services and set they to not automatically redirect.

At the end you will have 4 bots and your router services will look like this

Now that we are able to redirect between services, let’s add some actions!

Redirecting

We’re going to do a simple thing: two options will be displayed on our main bot, the first option will redirect to the specific 1 and the second to the specific 2!

Both specific bots will receive any input, redirect back to the main bot and return the user to the bot’s initial state. After the main bot redirect the user to the specific 1 we will direct user to his initial state on main, but, for learning purpose, when the main bot redirects to specific 2 we will direct the user to another block instead of the initial block.

On the main bot:

In the Welcome block

1.1. Add a quick reply

2. Add two leaving actions (both “redirect to service”, we’re going to use conditional actions 😃)

1.2.1. In the first action

1.2.1.1 Put the Service as “specific 1” (the name must be exactly the same as in router services)

1.2.1.2. As our subbots will always start at the “start” block, we need a user input, we can bypass that sending any content as context, to do so we need to activate the “send message” option and put anything in the textbox (like a dot or whatever).

1.2.1.3. Now, let’s add our condition if User input is Equal to "First option"

2.2. In the second action

1.2.2.1 Put the Service as “specific 2” (the name must be exactly the same as in router services)

1.2.2.2. As our subbots will always start at the “start” block, we need a user input, we can bypass that sending any content as context, to do so we need to activate the “send message” option and put anything in the textbox (like a dot or whatever).

1.2.2.3. Now, let’s add our condition if User input is Equal to "Second option"

2. Add a new block called “waiting return” (this will wait til a user input (or redirect with context))

3. Add a new block called “back from 2”

4. On “waiting return”

4.1. Add a new output condition to Go to back from 2 If User input Exists

5. On “back from 2”:

5.1. Add a new text content “Back from specific 2, input anything to reset” and remove the User input

5.2. Add an output condition Go to Start If User input Exists

6. Back to the Welcome block on the output conditions

6.1. Add a condition to Go to to Start If User input is Equal to "First option"

6.2. Add another condition to Go to waiting return If User input is Equal to "Second option"

7. Publish your flow

On the specific 1/2: Both will do the same thing (just change texts)

On Welcome block

1.1. Add text content “You are in specific 1, send anything to go back to main” (change to specific 2 or whatever)

1.2. Add a action “Redirect to service” as leaving action

1.2.1. Set service as “main” (Must be exactly the same as your main bot name is router services)

1.2.2. Enable “Send message” and set anything as “Context value”

1.3. On output conditions

1.3.1. Add a condition to Go to Start If User input Exists

2. Publish your flows

Testing!

Go to your router to test the bot, start a conversation and everything should work as expected!

Always keep in mind

Every time you redirect to another bot your user will still be “running” on the flow of the source bot, so, whenever you redirect it’s good for you to wait an user input, that way you will hold the user in that point of the flow;

You can use Context values to pass an information to other bots when redirecting, but we have unified contexts with router’s contexts so it’s better to do that by saving a real context variable;

The trackings made in all bots of a router will be registered in the router;

Artificial Intelligence it’s not bot specific, it’s retrieved from the router’s artificial intelligence, so you need to manage intents and entities on the router;

Contact identity is only the same if you’re using router’s context;

the same if you’re using router’s context; Desk is not on router, so all tickets and the identity of the contacts on the tickets are from tunnel domain and they are not the same as the router’s ones.

Conclusion

You can use blip’s routers to achieve complex and big bots without making a mess with your flows by diving the skills into subbots and reuse them as long as you need.

That’s it!