For the complete documentation index, see llms.txt. This page is also available as Markdown.

Quickstart

Installation & Usage for Vector SDK

Installation

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

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

Usage

Sending a Text Message

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

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.

For more information on receiving messages, handling events, and building a fully interactive bot, see Advanced.

Last updated