> For the complete documentation index, see [llms.txt](https://vector-privacy.gitbook.io/vector-privacy/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://vector-privacy.gitbook.io/vector-privacy/vector-sdk/basics/quickstart.md).

# Quickstart

Installation & Usage for Vector SDK

### Installation

To use the Vector SDK, add it as a dependency in your `Cargo.toml`:

```toml
[dependencies]
vector_sdk = "0.3"
tokio = { version = "1", features = ["full"] }
```

### Usage

#### Sending a Text Message

```rust
use vector_sdk::VectorBot;

#[tokio::main]
async fn main() -> vector_sdk::Result<()> {
    // Build a bot — supply a key with .nsec(...) / .mnemonic(...),
    // or omit it and one is created for you on first run
    let bot = VectorBot::builder()
        .nsec("nsec1...")
        .build()
        .await?;

    // Open a channel by npub or community channel id — DM or Community, handled identically
    let chat = bot.dm("npub1example...");

    // Send a private message
    let message_id = chat.send("Hello, world!").await?;
    println!("Message sent: {}", message_id);

    Ok(())
}
```

#### Sending an Image

```rust
use vector_sdk::VectorBot;

#[tokio::main]
async fn main() -> vector_sdk::Result<()> {
    let bot = VectorBot::builder()
        .nsec("nsec1...")
        .build()
        .await?;

    let chat = bot.dm("npub1example...");

    // Send a file directly by path — Vector handles reading, encrypting, and uploading it
    let message_id = chat.send_file("path/to/your/image.png").await?;
    println!("Image sent: {}", message_id);

    Ok(())
}
```

#### Typing Indicators

Typing indicators provide real-time feedback to recipients that a bot is composing a message. This is useful when a bot needs to retrieve information or is "thinking" before responding.

```rust
use vector_sdk::VectorBot;

#[tokio::main]
async fn main() -> vector_sdk::Result<()> {
    let bot = VectorBot::builder()
        .nsec("nsec1...")
        .build()
        .await?;

    let chat = bot.dm("npub1example...");

    // Show a typing indicator (recipients see "typing…")
    chat.typing().await?;

    // Simulate work (e.g. fetching data, processing)
    tokio::time::sleep(std::time::Duration::from_secs(2)).await;

    // Send the actual message
    let message_id = chat.send("Here's my response!").await?;
    println!("Message sent: {}", message_id);

    Ok(())
}
```

For more information on receiving messages, handling events, and building a fully interactive bot, see [Advanced](/vector-privacy/vector-sdk/docs/advanced.md).
