# 1. New bot, new block

{% hint style="warning" %}
&#x20;To get started, you need a Chatlayer account. **Don't have an account yet?** [Create a trial account here](https://chatlayer.ai/try-now/). You're having a problem with your account? Contact our support team at <support@chatlayer.ai>.
{% endhint %}

In this chapter we will build the very start of the conversation.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FjyNOzc74oowF4Ess5Mvd%2FChooChoo%20tutorial%20rework%20(4)%20(1).jpg?alt=media&#x26;token=2f73298a-4bc4-4612-ab6c-f38e573cf084" alt="" width="375"><figcaption><p>What we will build in Leadzy Lesson 1.</p></figcaption></figure>

## Step 1: Create a new bot

To create a new bot:

1. Go to [app.chatlayer.ai](http://app.chatlayer.ai) and log in using your credentials.
2. On the upper right corner of the screen, click on the **New bot** button.
3. Enter *Leadzy* as a name, so that you can easily find it again.
4. Select **English** as your primary language.

{% hint style="success" %}
The [primary language](https://docs.chatlayer.ai/understanding-users/multilanguage-bots#primary-language-vs.-secondary-languages) is the language that your bot will use. If you’d like your bot to be multilingual, you’ll be able to change that later.
{% endhint %}

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FLRjb0eDCdLvoKDT2DElV%2FScreenshot%202024-03-19%20at%2016.20.06.png?alt=media&#x26;token=5b05d0f6-5f7d-4be3-bdec-57116307c3f2" alt=""><figcaption><p>Create a new bot and call it Leadzy.</p></figcaption></figure>

5. Click on **Create**.

Your bot opens up, showing:

* Your bot [canvas](https://docs.chatlayer.ai/bot-answers/bot-canvas) in the middle of the screen, which is a visual representation of your chatbot architecture. A bunch of [default blocks of conversation](https://docs.chatlayer.ai/bot-answers/dialog-state#default-blocks) appear on this canvas, but let’s not worry about that now.
* The [**Flows**](https://docs.chatlayer.ai/bot-answers/bot-canvas/how-to-organize-your-flows) of conversation on the left.&#x20;
* The general menu of your chatbot on the very left.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F1CyrofALcafzo6LLsAiR%2FScreenshot%202024-03-19%20at%2016.21.56.png?alt=media&#x26;token=79503f1b-29e4-424f-ad34-a79ed6eb0381" alt=""><figcaption><p>The canvas view when you open your chatbot.</p></figcaption></figure>

{% hint style="info" %}
To navigate the screen, you can zoom in or out by using the scrolling wheel, or with your trackpad. You can also click and drag to move through the blocks tree.
{% endhint %}

{% hint style="success" %}
**Flows** are a way to group blocks that are about the same topic or use case. Learn more about them [here](https://docs.chatlayer.ai/bot-answers/bot-canvas/how-to-organize-your-flows).
{% endhint %}

Your chatbot has been successfully created!

## Step 2: Edit a Message block

Now, it’s time to make your chatbot say something.

{% hint style="success" %}
A **Message** **block** is a type of message where your bot will prompt something to the user. Learn more about blocks [here](https://docs.chatlayer.ai/bot-answers/dialog-state).
{% endhint %}

### Edit the Introduction block

To begin, let’s modify your introduction block.

{% hint style="success" %}
The **Introduction** block is a default block that serves as the first message that your users will see. It is where your bot introduces itself and explains its functionalities. Introductions are crucial for setting appropriate expectations for the bot.
{% endhint %}

To edit the **Introduction** block:

1. From your canvas, click on the **Introduction** block.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FmqSyA3hKFWfAxbLb8uP0%2FScreenshot%202024-02-01%20at%2015.16.12.png?alt=media&#x26;token=9737b18c-0ce3-4c74-a9a7-50ae00c5ce3b" alt=""><figcaption><p>Your Introduction block is where the conversation starts. It's filled with a default message.</p></figcaption></figure>

2. The block opens up on the right-hand side of the screen. Under **Text message**, delete the default message and replace it with:

*Hi there! Lucky you, today we have 15% off the whole selection! Are you interested to receive a discount code by email?*

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FgRnJvEVRWVq2xDcRtgpM%2FScreenshot%202024-02-01%20at%2015.22.09.png?alt=media&#x26;token=68bd1380-2e53-4737-9f74-399ade4a1cbc" alt=""><figcaption><p>Edit the message inside your Introduction block.</p></figcaption></figure>

3. Click **Save**.

Your Introduction block is now modified and you can see it from your canvas.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FqnSpT02GqbSto00FztEZ%2FScreenshot%202024-03-06%20at%2015.01.29.png?alt=media&#x26;token=156ba6d6-71b1-4686-9196-3307ba77ca7f" alt=""><figcaption><p>Your Introduction block after modification.</p></figcaption></figure>

### Add alternative messages

To make the conversation natural, we would like to have different ways of conveying the same introduction message.

{% hint style="success" %}
An alternative message is a text message that will be randomly alternated with another one so that the conversation feels more human-like.
{% endhint %}

To add alternative messages to a bot message:

1. Open your Introduction block by clicking on it.
2. Under **Text message**, click on **+** **Add alternative message**, and paste the following message:

   *Hey there! Good news! We're currently offering a 15% discount on our entire selection! Would you like to receive a code via email?*
3. Do the same for another alternative message:

   *Exciting news! We currently have a special offer of 15% off on our entire selection! Would you be interested in receiving a discount code via email?*

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FBRfbxyDBCCuLAYdtZHoj%2FScreenshot%202024-02-01%20at%2015.24.35.png?alt=media&#x26;token=46dbc617-d8b9-4e93-83c8-eba650ad41e1" alt=""><figcaption><p>Add alternative messages.</p></figcaption></figure>

4. Click **Save**.

Let’s now see how we can test that the bot behaves as expected.

## Step 3: Test your bot

Chatlayer offers a simple way to test your bot every time you make a modification.

### Run tests in the Emulator

To test your bot:

1. Click on the play button at the top right corner of your bot canvas.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F7A62dqAzCOS7jWm6Jkzw%2FScreenshot%202024-02-02%20at%2009.23.59.png?alt=media&#x26;token=61d787b3-a4a2-4209-8880-04e1d2abc04d" alt="" width="225"><figcaption><p>Test your bot.</p></figcaption></figure>

2. A **Test your bot** window pops up on the right-hand side. It automatically starts the conversation, which means that the bot will prompt its **Introduction** block. From there, type something as a response, for instance ‘*Yes I’d love to have a discount code*’.
3. Press Enter on your keyboard to send your message.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FIl6R9JpKFLhWSI52aJ5E%2FScreenshot%202024-02-02%20at%2009.27.03.png?alt=media&#x26;token=330f849b-0565-4fc1-8c9c-d6504c4d6b1a" alt="" width="285"><figcaption><p>Test your bot with this sentence. This is the expected result.</p></figcaption></figure>

4. The bot didn’t understand you — and that’s absolutely normal! For now, all we taught our bot is to say a greeting.
5. Click on the Restart conversation button at the top-right corner of the test window.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2F1lkN443NWBUWu1vohjGK%2FScreenshot%202024-02-02%20at%2009.28.33.png?alt=media&#x26;token=2bd3bacd-e0ff-4cda-a332-56e6d74faa23" alt="" width="291"><figcaption><p>Restart the conversation to run a new test.</p></figcaption></figure>

6. Notice that the Introduction message displayed is now different. This is because added alternative messages to it, and those are displayed in a random way.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2Fa2eGAcXashURDq4eKnmo%2FScreenshot%202024-03-06%20at%2015.07.43.png?alt=media&#x26;token=f553ed2a-90c4-49dd-a5de-b731a23f3101" alt="" width="355"><figcaption><p>By running several tests, you'll notice that messages alternate because you added alternative messages.</p></figcaption></figure>

You just ran a successful test: your bot has the expected behavior!

### Run tests in the WhatsApp sandbox

Given the high demand for WhatsApp among our customers, Chatlayer provides an easy method to test your conversations directly on the platform.

{% hint style="info" %}
Why running tests in a WhatsApp sandbox? Each channel has its [limitations](https://docs.chatlayer.ai/channels/multi-channel#channel-comparison), therefore you want to make sure that your tests run smoothly in the channels that you’re choosing.
{% endhint %}

To run tests within the WhatsApp sandbox:

1. Open your **Test your bot** window.
2. At the top-left corner of the Test window, select **WhatsApp sandbox**.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FiM2fYgfqAxvIEfyCSFb3%2FScreenshot%202024-02-02%20at%2009.44.19.png?alt=media&#x26;token=fee387d4-d3eb-4a82-b76f-52144fdb126b" alt=""><figcaption><p>Test your bot in WhatsApp using the WhatsApp sandbox.</p></figcaption></figure>

3. A QR code is displayed on the screen, with a link underneath. Either:
   * Scan the QR code with your phone, so that your WhatsApp phone app opens.
   * Click on the link below the QR code, so that you can open the WhatsApp web app.
4. Whatever you choose, click on **Continue** to chat.
5. Send the message starting with ‘join’ that is pre-filled in the text field.
6. You’ll get a confirmation that you’re all set in the sandbox. Say something to the bot to start the conversation as you designed it.

<figure><img src="https://2786867680-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LLTwFwbOqJj4dDhg8Ju%2Fuploads%2FXyDJD1hXMx2lErDUBSpa%2FScreenshot%202024-02-02%20at%2009.47.26.png?alt=media&#x26;token=962421b9-7d72-45d6-ab98-30b77f5a55ee" alt=""><figcaption><p>Follow these steps to start a conversation in the WhatsApp sandbox.</p></figcaption></figure>

Our bot is also working on WhatsApp, hurray!

## Lesson 1 recap

Congratulations, you just made your first steps! In this lesson, you’ve learned how to:

* [ ] Create a new bot from the Chatlayer landing page.
* [ ] Edit a Message block, and add alternative messages to it so that it feels natural. To do this, we took for example the default Introduction block.
* [ ] Test your changes in the Test window.
* [ ] Run tests on WhatsApp using the WhatsApp sandbox.

## Coming next

Next, we will teach your bot how to understand user responses.

{% content-ref url="2.-understand-your-users" %}
[2.-understand-your-users](https://docs.chatlayer.ai/start-quickly/leadzy-tutorial/2.-understand-your-users)
{% endcontent-ref %}

## 💬 Feedback

{% hint style="warning" %}
Your feedback on the tutorial means the world to us! Please, let us know what you think through [this short form.](https://forms.office.com/Pages/ResponsePage.aspx?id=ropROyGJe0qEl2GddWziDlEYn6XpsIRDjnCtdRk8L21UMFZMMlAzN0tHOTI4UjMxVTgzTVAwTE5aOCQlQCN0PWcu)
{% endhint %}
