Unified message schema (Pydantic) for in-process use and adapter implementations. Matches the gRPC UnifiedMessage / Platform definitions.
"""
Unified message schema (Pydantic) for in-process use and adapter implementations.
Matches the gRPC UnifiedMessage / Platform definitions.
"""
from __future__ import annotations
from enum import IntEnum
from typing import Any
from claw_swarm.gateway.proto import messaging_gateway_pb2 as pb
from pydantic import BaseModel, Field
class Platform(IntEnum):
UNSPECIFIED = 0
TELEGRAM = 1
DISCORD = 2
WHATSAPP = 3
EMAIL = 4
class UnifiedMessage(BaseModel):
"""Single message normalized from Telegram, Discord, or WhatsApp."""
id: str
platform: Platform
channel_id: str
thread_id: str = ""
sender_id: str
sender_handle: str = ""
text: str = ""
attachment_urls: list[str] = Field(default_factory=list)
timestamp_utc_ms: int = 0
raw_m
... (truncated -- full source via MCP)
See the full source, get the GitHub permalink, and search 40K more like it.
Get a free API key