# Build your first bot

> Answer a common question automatically, teach the AI about your business and turn the chatbot on.

Source: https://docs.soosh.io/get-started/build-your-first-bot/

By the end of this tutorial your WhatsApp number will answer customers by
itself: a keyword reply for questions about delivery, and AI answers for
everything else your business has taught it. The examples are from Blue Lotus
Fashion, a clothing shop.

## What you need

- A Soosh workspace with a WhatsApp number connected, where you're the owner or
  an admin ([Set up Soosh in four steps](https://docs.soosh.io/get-started/set-up-soosh/))
- A second phone with WhatsApp, or a colleague's, to test with

## How the bot answers

When a customer writes, Soosh tries, in order: conversation flows, then
keyword replies, then AI answers. The first one that has an answer replies.
This tutorial sets up the last two.

## 1. Add a keyword reply

A keyword reply sends the same answer whenever a message contains one of its
words. Use one for questions your team answers the same way every time.

1. Go to [**Automation > Keyword replies**](https://app.soosh.io/chatbot/keyword-replies) and click **Add rule**.
2. In **Keywords**, enter the words to listen for, separated by commas:
   *delivery, deliver, shipping*.
3. Keep **Match type** on **Contains**, so the words can appear anywhere in
   the message, and **Response type** on **Text response**.
4. In **Response message**, write the answer.
5. Click **Create**.

   *Picture: The New keyword page with the keywords delivery, deliver, shipping and the delivery answer, and a preview of a customer's message and the reply*

## 2. Teach the AI about your business

AI answers come from what you add to the knowledge base: your opening hours,
delivery, payment, returns. Write it the way you'd brief a new colleague.

1. Go to [**Automation > Knowledge base**](https://app.soosh.io/chatbot/knowledge-base) and click **Add source**.
2. In **Name**, enter *About Blue Lotus Fashion*.
3. Keep **Type** on **Static content**, and leave **Trigger keywords** empty
   so the AI always reads it.
4. In **Content / prompt**, write the facts customers ask about.
5. Click **Create**.

   *Picture: The New source page with facts about Blue Lotus Fashion's store, delivery, payment and exchanges, and on the right what the AI reads*

The **What the AI reads** panel shows the source exactly as the AI gets it.

## 3. Turn on AI answers

1. Go to [**Settings > Bot settings**](https://app.soosh.io/settings/bot) and choose **AI assistant**.
2. Turn on **Enable AI responses**.
3. Click **Save** in the bar at the bottom.

   *Picture: The AI assistant settings with Enable AI responses turned on and the Save button in the bar at the bottom*

> **Cost:** AI answers use Soosh AI; there's no AI account or key to set up. See what
> they cost in [**Settings > AI usage**](https://app.soosh.io/settings/ai-usage).

## 4. Turn on the bot

1. Go to [**Automation > Chatbot**](https://app.soosh.io/chatbot). It says **Off**.
2. Click **Turn on bot**, then **Enable**.

   *Picture: The Chatbot page, marked Off, with the Turn on bot button at the top right and the keyword replies and knowledge base listed*

The badge changes to **Live**. From now on the bot answers new messages
before they reach your team.

## 5. Test it

From the second phone, send your business number a question about delivery,
then a question the knowledge base answers. Each gets a reply within a few
seconds.

<WhatsAppPreview
  title="What the customer sees"
  messages={[
    { from: 'customer', text: 'Hi, do you deliver to Pune?', time: '11:02' },
    { text: 'We deliver across India in 3 to 5 working days, and in 1 to 2 days in Mumbai and Pune. Delivery is free on orders over ₹2,000.', time: '11:02' },
    { from: 'customer', text: 'Can I pay cash when it arrives?', time: '11:03' },
    { text: 'Yes, cash on delivery is available for orders up to ₹10,000. You can also pay by UPI or card.', time: '11:03' },
  ]}
>
  The first answer is your keyword reply, word for word. The second is
  written by the AI from your knowledge base, so its wording varies.
</WhatsAppPreview>

The chats also appear in [**Inbox > Chats**](https://app.soosh.io/chat), so your team can read what the bot
said and take over at any time.

## What you've learned

- The bot tries flows, then keyword replies, then AI answers.
- A keyword reply sends a fixed answer whenever a message contains its words.
- AI answers come from your knowledge base, and only when AI responses are
  on.
- Nothing is answered automatically until you turn the bot on.

## Next steps

- [Build a bot flow](https://docs.soosh.io/guides/chatbot/build-a-bot-flow/) and
  [Hand chats to agents](https://docs.soosh.io/guides/chatbot/hand-chats-to-agents/)
- [See what Soosh remembers about a customer](https://docs.soosh.io/guides/inbox/see-what-soosh-remembers/)
