Components
Components for the Vector SDK
The Vector SDK exposes a small set of types that cover everything a bot needs. There is no separate Client, Metadata, Subscription, Crypto, or Upload module to configure directly, those concerns live inside vector-core and are handled for you. The components below are what you will actually interact with when building a bot.
VectorBot
VectorBot represents your running bot: its identity, its connection, and the entry point for sending and receiving. It is created via VectorBot::builder(), never constructed directly.
Key methods include npub(), channel(id), dm(npub), community(id), communities(), on_message(handler), on_event(handler), fetch_profile(npub), update_profile(...), and core() for dropping down to the full vector-core engine when needed.
VectorBotBuilder
VectorBotBuilder configures a bot before it comes online. Returned by VectorBot::builder() and consumed by .build().
Key methods include .nsec(...) / .mnemonic(...) / .password(...) for identity, .public() / .whitelist([...]) for invite policy, .data_dir(...) for storage location, and .tor() / .tor_bridges([...]) for routing the bot through an embedded Tor client.
Channel
Channel represents a single conversation, either a direct message or a community channel, handled identically through the same API. Returned by bot.channel(id), bot.dm(npub), or msg.channel().
Key methods include send(text), reply(msg_id, text), edit(msg_id, text), delete(msg_id), react(msg_id, emoji), react_custom(msg_id, shortcode, image_url), typing(), and send_file(path).
IncomingMessage
IncomingMessage represents a message your bot has received, passed into every on_message and BotEvent::Message handler.
Key methods include text(), is_mine(), reply(text), react(emoji), channel(), community() (if the message came from a community), and member() (the sender, as a Member, if the message came from a community).
Community
Community represents a community your bot belongs to. Returned by bot.community(id), bot.communities(), or msg.community().
Key methods include member(npub), members(), invite(npub), create_invite(), edit(name, description), leave(), dissolve() (owner-only), capabilities(), and roles().
Member
Member represents a single member of a community, returned by msg.member() or community.member(npub).
Key methods include npub(), community_id(), kick(), ban(), unban(), grant_admin(), revoke_admin(), profile(), is_owner(), and is_admin().
BotEvent
BotEvent is the full event stream delivered to an on_event handler, covering everything beyond plain messages: Message, MessageUpdate (a reaction or edit landed), Delete, MemberJoin, MemberLeave, Typing, Invite, and Removed (the bot was kicked or banned from a community).
Going Deeper
Anything not surfaced by the components above, including creating communities, reading message history, and lower-level protocol controls, is available through bot.core(), which returns the full VectorCore engine that the SDK is built on top of.
Last updated