# Sending RCS Messages

> Sending your first RCS message with Pinnacle's Python SDK

## Prerequisites

Before proceeding, ensure you have obtained a phone number and API key as described in the [prerequisites](/quickstart/rcs).

## Installation

Create a Python virtual environment:

```bash
python3 -m venv venv
```

Activate the virtual environment:

```bash
source venv/bin/activate
```

Install the Pinnacle Python SDK and python-dotenv to load env vars:

```bash
pip install rcs==2.0.28 python-dotenv
```

**Info:**
  This guide uses version `rcs==2.0.28`. Requires: Python &lt;4.0, &gt;=3.8

## Configuration

Create an `.env` file in your project root and add your Pinnacle API key and RCS agent ID:

```bash
PINNACLE_API_KEY="your_api_key" # pnclk_
RECIPIENT_NUMBER="+14155550123" # Replace with your whitelisted test number
AGENT_ID="your_agent_id" # agent_
```

## Sending Your First RCS Message

Create a new Python file (e.g., `main.py`) and use the [complete example](#complete-example).

Quick_replies are required but may be left empty. For sending media urls, you can also use storage on the dashboard under **System > Storage** or [via our API](/api-reference/tools/upload-file)

Run the script:

```bash
python main.py
```

If successful, the recipient will receive your RCS messages, and they should look something like this:

![RCS message example](/media/rcs-message-example.jpg)

## Complete example

```python
import os
from dotenv import load_dotenv
from rcs import (
    Pinnacle,
    RichCard,
    RichButton_OpenUrl,
    RichCardsMessage,
    RichTextMessage,
)

load_dotenv()

client = Pinnacle(
    api_key=os.getenv("PINNACLE_API_KEY"),
)

text_message_res = client.messages.rcs.send(
    request=RichTextMessage(
        text="Want to build on Pinnacle? Check out our docs below.",
        quick_replies=[
            RichButton_OpenUrl(
                payload="https://docs.pinnacle.sh",
                title="See our docs",
            )
        ],
        from_=os.getenv("AGENT_ID"),
        to=os.environ["RECIPIENT_NUMBER"],
    ),
)

print(text_message_res)

card_message_res = client.messages.rcs.send(
    request=RichCardsMessage(
        cards=[
            RichCard(
                media="https://server.trypinnacle.app/storage/v1/object/sign/vault/142/bea70540-0596-4f9e-af6a-5b6ad7fa6c00/Golden_Hour_Over_Rural_Landscape_1.png?token=eyJraWQiOiJzdG9yYWdlLXVybC1zaWduaW5nLWtleV9hOGI0YTI0NC00NzY4LTRhOTktYWI4MS1iNmZhNTZhNGQyZWYiLCJhbGciOiJIUzI1NiJ9.eyJ1cmwiOiJ2YXVsdC8xNDIvYmVhNzA1NDAtMDU5Ni00ZjllLWFmNmEtNWI2YWQ3ZmE2YzAwL0dvbGRlbl9Ib3VyX092ZXJfUnVyYWxfTGFuZHNjYXBlXzEucG5nIiwiaWF0IjoxNzYwOTAyMjQ0LCJleHAiOjMxNzEyMDkwMjI0NH0.l0CNvb4Z-tXXEwnGA6vNWnRb4XYxvWVUUSziuqq2TLA",
                title="Did you know you can send an RCS message in less than 5 minutes?",
                subtitle="Learn how by tapping an option below",
                buttons=[
                    RichButton_OpenUrl(
                        type="openUrl",
                        metadata="",
                        payload="https://docs.pinnacle.sh/quickstart/rcs",
                        title="RCS Quickstart Guide",
                    ),
                    RichButton_OpenUrl(
                        type="openUrl",
                        metadata="",
                        payload="https://docs.pinnacle.sh/api-reference/messages/send-rcs",
                        title="RCS API Reference",
                    ),
                ],
            )
        ],
        quick_replies=[],
        from_=os.getenv("AGENT_ID"),
        to=os.environ["RECIPIENT_NUMBER"],
    )
)

print(card_message_res)
```
