Skip to main content
The OpenChat Bot SDK provides everything you need to build sophisticated bots for OpenChat, the decentralized chat platform on the Internet Computer. Whether you’re tracking governance proposals, monitoring NNS activity, or building custom bot interactions, this SDK gives you the tools to succeed.

What is the OpenChat Bot SDK?

The OpenChat Bot SDK is a Motoko-based framework that simplifies bot development for OpenChat. It provides:
  • Ready-to-deploy bot implementations (TallyBot and ProposalBot)
  • Complete OpenChat API integration for messaging, community management, and user interactions
  • NNS governance integration for proposal tracking and voting
  • Robust infrastructure including logging, error handling, and access control
  • Production-ready patterns for canister deployment and upgrade management

Key Capabilities

Bot Registration

Register your bot with OpenChat, configure avatars, and manage bot identity

Community Integration

Join groups, communities, and channels programmatically with invite code support

Messaging

Send and edit messages in groups, channels, and threads with full content type support

Governance Tracking

Monitor NNS proposals, track voting tallies, and broadcast updates in real-time

Access Control

Custodian-based permissions system with comprehensive logging and metrics

Canister Management

Deploy, upgrade, and monitor your bot canisters on the Internet Computer

Architecture Overview

The SDK is organized into focused, composable modules:
backend/
├── Bot/              # Core bot service and types
│   ├── BotService.mo    # Bot registration, messaging, community management
│   └── BotTypes.mo      # Bot state and interface types
├── OC/               # OpenChat API integration
│   ├── OCService.mo     # OpenChat service wrapper
│   ├── OCTypes.mo       # OpenChat type definitions
│   └── OCApi.mo         # Generated OpenChat API bindings (1700+ lines)
├── Governance/       # NNS governance integration
│   ├── GovernanceService.mo    # Governance canister client
│   ├── GovernanceTypes.mo      # Proposal and neuron types
│   └── GovernanceUtils.mo      # Governance helpers
├── Proposal/         # Proposal processing
│   ├── ProposalService.mo      # Proposal fetching and filtering
│   ├── ProposalTypes.mo        # Proposal type definitions
│   └── ProposalMappings.mo     # Type conversions
├── TallyBot/         # TallyBot implementation
│   ├── TallyBot.mo      # Tally tracking and subscription management
│   ├── TallyBotMain.mo  # TallyBot canister entry point
│   └── TallyTypes.mo    # Tally-specific types
├── ProposalBot/      # ProposalBot implementation
│   ├── ProposalBot.mo      # Proposal monitoring and broadcasting
│   └── ProposalBotMain.mo  # ProposalBot canister entry point
├── Log/              # Logging infrastructure
│   ├── LogService.mo    # Structured logging service
│   └── LogTypes.mo      # Log types and filters
└── Utilities
    ├── TextUtils.mo     # Message and proposal formatting
    ├── TimeService.mo   # Time utilities and mocking
    ├── Guards.mo        # Access control helpers
    └── Types.mo         # Shared type definitions

Use Cases

Governance Bots

Track NNS proposals and broadcast voting updates to OpenChat communities. TallyBot monitors proposal tallies and posts updates as votes change, helping communities stay informed about governance activity.

Notification Bots

Monitor blockchain events, proposal submissions, or custom triggers and notify OpenChat channels in real-time.

Custom Integrations

Build bots that bridge OpenChat with other Internet Computer services, external APIs, or traditional web services.

Community Management

Automate community tasks like welcoming new members, moderating content, or providing information on demand.

Technology Stack

Motoko

Safe, simple language designed for the Internet Computer

Internet Computer

Decentralized cloud platform with true ownership

OpenChat

Fully on-chain, decentralized chat platform

Mops

On-chain package manager for Motoko dependencies

dfx

Internet Computer SDK for canister deployment

mo-dev

Live reload development server for rapid iteration

Why Use This SDK?

Production-Ready: Both TallyBot and ProposalBot are deployed and running in production on OpenChat. Type-Safe: Written in Motoko with comprehensive type definitions for all OpenChat and NNS governance APIs. Modular Design: Use the entire SDK or cherry-pick components for your custom bot. Well-Documented: Extensive API documentation, guides, and real-world examples. Battle-Tested: Handles edge cases, upgrades, and error conditions that you’d discover only in production.

Getting Started

Ready to build your first OpenChat bot? Follow our quickstart guide to get up and running in minutes:

Quickstart Guide

Build and deploy your first OpenChat bot in under 10 minutes

Next Steps

Installation

Set up your development environment with dfx and dependencies

Bot Architecture

Understand the SDK’s module structure and design patterns

TallyBot

Learn about the governance proposal tracking bot

API Reference

Explore the complete API documentation

Community and Support

Build docs developers (and LLMs) love