> For the complete documentation index, see [llms.txt](https://docs.robinapp.co/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.robinapp.co/messaging-with-robin/add-messaging-with-core-sdks/python.md).

# Python

### Robin for Messaging with Python

Add live messaging to your Python applications with the Core Python SDK. Take advantage of the Robin API and deploy messaging solutions in very little time.

{% embed url="<https://github.com/robin-io/robin.io-py>" %}

### Prerequisites

The following python packages are required to use the SDK:

1. [Requests](https://pypi.org/project/requests/)
2. [Websocket-client](https://pypi.org/project/websocket-client/)
3. API Key - Learn about how to get your API Keys in [Setting up your Robin account](/messaging-with-robin/guides/setting-up-your-robin-account.md)

### Install the Python SDK

```bash
## pip
pip3 install robin.io-py
```

## Sending your first message

Follow the step-by-step instructions below to send your first message using the Python SDK

### Step 1: Create a Robin Instance

To create a `Robin` instance, pass the `apiKey` as the first argument, and the optional `tls` argument as the second in the `Robin(apiKey, tls)` constructor.

```python
robin = Robin("YOUR_API_KEY", True)
```

{% hint style="warning" %}
Initializing the Chat SDK at the top of your Python file is recommended.
{% endhint %}

### Step 2: Connect to Robin Server

You can connect to the Robin server using the `connect(user_token)` method from the `Robin` instance. If you do not have a [Robin User Token](/messaging-with-robin/guides/what-is-the-robin-user-token-rut.md) (user\_token), you would have to create one. [What is the Robin User Token (RUT)?](/messaging-with-robin/guides/what-is-the-robin-user-token-rut.md)(specific link to create user token) is a good place to start.

```python
robin.connect(user_token="YOUR_RUT")****
```

### Step 3: Create a Conversation

Before sending a message, you need to create a `Conversation`

```python
response = robin.create_conversation(sender_token="SENDER_RUT", sender_name="SENDER_NAME", receiver_token="RECEIVER_RUT", receiver_name="RECEIVER_NAME")
```

### Step 4: Send a message to Conversation

Now, you can send a message to a conversation with the `robin.send_conversation_message()` method.

```python
robin.send_conversation_message(msg={}, channel="CHANNEL_ID", conversation_id="CONVERSATION_ID", sender_token="SENDER_TOKEN")
```
