> ## Documentation Index
> Fetch the complete documentation index at: https://docs.embedchain.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# 💬 WhatsApp Bot

### 🚀 Getting started

1. Install embedchain python package:

```bash theme={null}
pip install --upgrade embedchain
```

2. Launch your WhatsApp bot:

<Tabs>
  <Tab title="docker">
    ```bash theme={null}
    docker run --name whatsapp-bot -e OPENAI_API_KEY=sk-xxx -p 8000:8000 embedchain/whatsapp-bot
    ```
  </Tab>

  <Tab title="python">
    ```bash theme={null}
    python -m embedchain.bots.whatsapp --port 5000
    ```
  </Tab>
</Tabs>

If your bot needs to be accessible online, use your machine's public IP or DNS. Otherwise, employ a proxy server like [ngrok](https://ngrok.com/) to make your local bot accessible.

3. Create a free account on [Twilio](https://www.twilio.com/try-twilio)
   * Set up a WhatsApp Sandbox in your Twilio dashboard. Access it via the left sidebar: `Messaging > Try it out > Send a WhatsApp Message`.
   * Follow on-screen instructions to link a phone number for chatting with your bot
   * Copy your bot's public URL, add /chat at the end, and paste it in Twilio's WhatsApp Sandbox settings under "When a message comes in". Save the settings.

* Copy your bot's public url, append `/chat` at the end and paste it under `When a message comes in` under the `Sandbox settings` for Whatsapp in Twilio. Save your settings.

### 💬 How to use

* To connect a new number or reconnect an old one in the Sandbox, follow Twilio's instructions.
* To include data sources, use this command:

```text theme={null}
add <url_or_text>
```

* To ask the bot questions, just type your query:

```text theme={null}
<your-question-here>
```

### Example

Here is an example of Elon Musk WhatsApp Bot that we created:

<img src="https://mintcdn.com/embedchain/pz6fpRISI4B6JS6w/images/whatsapp.jpg?fit=max&auto=format&n=pz6fpRISI4B6JS6w&q=85&s=ae4c8f9920e2e5e9c7a4020b099d915a" width="290" height="600" data-path="images/whatsapp.jpg" />
