Skip to content

ChatApps Reference

The chatapps package provides the bridge between HotPlex's core engine and various chat platforms. It normalizes platform-specific events and messages into a unified "Chat Language".

🔄 End-to-End Bidirectional Flow

HotPlex Architecture Flow

🏛 Architecture Overview

HotPlex uses an Adapter-based Pipeline architecture.

Data Normalization

The chatapps layer normalizes raw provider events into standard UI components.

Provider Eventbase.MessageTypeUI Presentation
thinkingMessageTypeThinkingThinking bubbles
tool_useMessageTypeToolUseTool info block
tool_resultMessageTypeToolResultCollapsible output
answerMessageTypeAnswerMarkdown text
permission_requestMessageTypePermissionRequestInteractive buttons

Key Architectural Concepts

  • ChatAdapter: The platform-specific connector logic.
  • AdapterManager: Singleton for managing active connections.
  • ProcessorChain: Middleware-style pipeline for message styling and filtering.

🛠 Developer Guide

1. Implementing a New Platform Adapter

To add a platform (e.g., discord), implement the base.ChatAdapter interface:

go
type DiscordAdapter struct {
    client  *discord.Client
    handler base.MessageHandler
}

func (a *DiscordAdapter) SendMessage(ctx context.Context, sessionID string, msg *base.ChatMessage) error {
    // Convert to Discord format and POST
}

🏗️ Connect More Platforms

Slack Guide

Step-by-step Slack bot creation and Block Kit setup.

View Slack

Engine Manual

Understand how messages are processed by the core.

View Engine

"Interfaces are the grammar of software architecture." — The HotPlex Core Team

Released under the MIT License.