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

# Python WhatsApp and SMS API SDK: Installation

> Install the Hypersender Python SDK with pip to use the WhatsApp API, SMS API, and OTP API from Python, with keys read from environment variables.

## Getting Started with Hypersender SDK

This guide will walk you through the process of installing and configuring the Hypersender Python SDK for your Python application, whether it is a Django, Flask, or FastAPI app or a simple script.

## Prerequisites

Before you begin, ensure you have the following:

* **Python 3.10 or higher:** The SDK has a single dependency, [httpx](https://www.python-httpx.org/).
* **pip (or uv, Poetry):** For package management and dependency resolution
* **Hypersender account:** Sign up at [Hypersender](https://app.hypersender.com) to obtain your API key and Instance ID.

> [!TIP]
>
> You can find your API key and Instance ID in the Hypersender dashboard

![Hypersender Dashboard API Key](https://mintcdn.com/hypersender/oXq9uVgBJOXaL1p2/images/docs/whatsapp/img/api-key-and-instance-id.jpeg?fit=max\&auto=format\&n=oXq9uVgBJOXaL1p2\&q=85\&s=addd172bddcb335eeb1eb029473bac71)

## Installation

**1. Install the SDK via pip**

Run the following command in your terminal to install the Hypersender Python SDK:

```bash theme={null}
pip install hypersender
```

> [!TIP]
>
> After installation, you can verify the package is installed with `pip show hypersender`.

**2. Configure Environment Variables**

The SDK reads its credentials from environment variables, using the same names as the Laravel package. Set the variables for the APIs you use: WhatsApp, SMS, OTP, or any mix of them.

**`For WhatsApp API, set the following environment variables in your .env file:`**

```bash theme={null}
# API key from Hypersender dashboard
HYPERSENDER_WHATSAPP_API_KEY=
# Instance ID from Hypersender dashboard
HYPERSENDER_WHATSAPP_INSTANCE_ID=
```

> [!TIP]
>
> Learn how to get the Hypersender whatsapp `API token` and `Instance ID` from Dashboard: [Demo Link](https://docs.hypersender.com/v2/api-reference/whatsapp/how-to-send-a-whatsapp-message-in-postman.md).

**`For SMS API, set the following environment variables in your .env file:`**

```bash theme={null}
# API key from Hypersender dashboard
HYPERSENDER_SMS_API_KEY=
# Instance ID from Hypersender dashboard
HYPERSENDER_SMS_INSTANCE_ID=
```

> [!TIP]
>
> Learn how to get the Hypersender SMS `API token` and `Instance ID` from the dashboard: [Demo Link](https://docs.hypersender.com/v2/api-reference/sms/how-to-send-an-sms-message-in-postman.md).

**`For OTP API, set the following environment variables in your .env file:`**

```bash theme={null}
# API key from Hypersender dashboard
HYPERSENDER_OTP_API_KEY=
# Instance ID from Hypersender dashboard
HYPERSENDER_OTP_INSTANCE_ID=
```

**`For Enterprise instance management (Enterprise accounts only), set:`**

```bash theme={null}
# Enterprise API key from Hypersender dashboard
HYPERSENDER_ENTERPRISE_API_KEY=
```

> [!NOTE]
>
> Python does not read `.env` files on its own. Install `python-dotenv` (`pip install python-dotenv`) and call `load_dotenv()` before you create the client, or export the variables in your shell or hosting platform.
>
> ```python theme={null}
> from dotenv import load_dotenv
>
> load_dotenv()
> ```

**3. Send your first message**

Import `Hypersender`, create a client, and call the API you need. The client picks up the environment variables when you create it.

```python theme={null}
from hypersender import Hypersender

hs = Hypersender()

result = hs.whatsapp.send_text("20123456789@c.us", "Hello from Hypersender!")

print(result["queued_request_uuid"])
```

## Configure in code instead of environment variables

If you can't use environment variables, pass the credentials when you create the client:

```python theme={null}
from hypersender import Hypersender

hs = Hypersender(
    whatsapp_api_key="your-whatsapp-api-key",
    whatsapp_instance_id="your-whatsapp-instance-id",
    sms_api_key="your-sms-api-key",
    sms_instance_id="your-sms-instance-id",
    otp_api_key="your-otp-api-key",
    otp_instance_id="your-otp-instance-id",
)
```

To work with more than one account at the same time, create a `Hypersender(...)` client for each one. Each client has the same `whatsapp`, `sms`, `otp`, and `enterprise` attributes.

## You're all set!

You have successfully installed and configured the Hypersender Python SDK in your application. You can now start using the SDK to send messages and manage your communications.

* **WhatsApp:** [Usage Guide](https://docs.hypersender.com/v2/packages-and-sdks/python/whatsapp/send-messages.md)
* **WhatsApp bot:** [Build a WhatsApp bot in Python](https://docs.hypersender.com/v2/packages-and-sdks/python/whatsapp/whatsapp-bot.md)
* **SMS:** [Usage Guide](https://docs.hypersender.com/v2/packages-and-sdks/python/sms/send-and-manage-sms-messages.md)
* **OTP codes (WhatsApp or SMS):** [OTP with Python](https://docs.hypersender.com/v2/packages-and-sdks/python/otp/otp-with-python.md)
* **WhatsApp OTP links:** [Generate a link with Python](https://docs.hypersender.com/v2/packages-and-sdks/python/otp/generate-whatsapp-otp-link-with-python.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.