Self-improving AI Employees for everyone
Python ai-agentsai-employeeai-employeesassistantautonomous-agentsco-employeescompanygrok-botinstinctloop-agentsmuseown-your-datapersonalself-hosted
feat(schema): Wave 6 Phase 3b - backend NodeSpec parity for messaging group
trohitg4b699cbedd84
diff --git a/server/models/node_metadata.py b/server/models/node_metadata.pyindex ca51ee77..66ef54f0 100644--- a/server/models/node_metadata.py+++ b/server/models/node_metadata.py@@ -117,6 +117,86 @@ NODE_METADATA: dict[str, NodeMetadata] = {"description": "Start, stop, and manage long-running processes (dev servers, watchers, build tools). Streams output to Terminal tab.","version": 1,},+ # Phase 3b: Messaging group ---------------------------------------------+ # Icons left blank for SVG-icon nodes - frontend resolves the SVG asset+ # via its own icon imports until we move SVG payload to the server too.+ "whatsappSend": {+ "displayName": "WhatsApp Send",+ "icon": "",+ "group": ["whatsapp", "tool"],+ "description": "Send WhatsApp messages (text, media, location, contact, sticker)",+ "version": 1,+ },+ "whatsappReceive": {+ "displayName": "WhatsApp Receive",+ "icon": "",+ "group": ["whatsapp", "trigger"],+ "description": "Trigger workflow when WhatsApp message is received",+ "version": 1,+ },+ "whatsappDb": {+ "displayName": "WhatsApp DB",+ "icon": "",+ "group": ["whatsapp", "tool"],+ "description": "Query WhatsApp database (chat history, contacts, groups, channels)",+ "version": 1,+ },+ "telegramSend": {+ "displayName": "Telegram Send",+ "icon": "",+ "group": ["social", "tool"],+ "description": "Send text, photo, document, location, or contact messages via Telegram bot",+ "version": 1,+ },+ "telegramReceive": {+ "displayName": "Telegram Receive",+ "icon": "",+ "group": ["social", "trigger"],+ "description": "Trigger workflow when Telegram message is received",+ "version": 1,+ },+ "twitterSend": {+ "displayName": "Twitter Send",+ "icon": "",+ "group": ["social", "tool"],+ "description": "Post tweets, reply, retweet, like, or delete tweets on Twitter/X",+ "version": 1,+ },+ "twitterReceive": {+ "displayName": "Twitter Receive",+ "icon": "",+ "group": ["social", "trigger"],+ "description": "Trigger workflow on Twitter mentions, search results, or timeline updates (polling-based)",+ "version": 1,+ },+ "twitterSearch": {+ "displayName": "Twitter Search",+ "icon": "",+ "group": ["social", "tool"],+ "description": "Search recent tweets on Twitter/X using the Search API",+ "version": 1,+ },+ "twitterUser": {+ "displayName": "Twitter User",+ "icon": "",+ "group": ["social", "tool"],+ "description": "Look up Twitter/X user profiles, followers, and following",+ "version": 1,+ },+ "socialReceive": {+ "displayName": "Social Receive",+ "icon": "",+ "group": ["social"],+ "description": "Unified receive trigger for any social platform (whatsapp, telegram, twitter, ...)",+ "version": 1,+ },+ "socialSend": {+ "displayName": "Social Send",+ "icon": "",+ "group": ["social", "tool"],+ "description": "Unified send action for any social platform",+ "version": 1,+ },}diff --git a/server/models/nodes.py b/server/models/nodes.pyindex b47fc2bc..07b17961 100644--- a/server/models/nodes.py+++ b/server/models/nodes.py@@ -324,6 +324,76 @@ class TwitterReceiveParams(BaseNodeParams):type: Literal["twitterReceive"]+class TelegramSendParams(BaseNodeParams):+ """Parameters for Telegram send message node."""+ type: Literal["telegramSend"]+ recipient_type: Literal["self", "chat_id"] = Field(default="self", alias="recipientType")+ chat_id: str = Field(default="", alias="chatId")+ message_type: Literal["text", "photo", "document", "location", "contact"] = Field(default="text", alias="messageType")+ text: str = ""+ media_url: str = Field(default="", alias="mediaUrl")+ caption: str = ""+ latitude: Optional[float] = None+ longitude: Optional[float] = None+ phone: str = ""+ first_name: str = Field(default="", alias="firstName")+ last_name: str = Field(default="", alias="lastName")+ parse_mode: Literal["Auto", "HTML", "Markdown", "MarkdownV2", "None"] = Field(default="Auto", alias="parseMode")+ silent: bool = False+ reply_to_message_id: Optional[int] = Field(default=None, alias="replyToMessageId")+++class TwitterSendParams(BaseNodeParams):+ """Parameters for Twitter send/action node."""+ type: Literal["twitterSend"]+ action: Literal["tweet", "reply", "retweet", "like", "unlike", "delete"] = "tweet"+ text: str = ""+ tweet_id: str = Field(default="", alias="tweetId")+ media_urls: List[str] = Field(default_factory=list, alias="mediaUrls")+ include_poll: bool = Field(default=False, alias="includePoll")+ poll_options: List[str] = Field(default_factory=list, alias="pollOptions")+ poll_duration_minutes: int = Field(default=1440, alias="pollDurationMinutes", ge=5, le=10080)+++class TwitterSearchParams(BaseNodeParams):+ """Parameters for Twitter search node."""+ type: Literal["twitterSearch"]+ query: str = ""+ max_results: int = Field(default=10, alias="maxResults", ge=10, le=100)+ sort_order: Literal["recency", "relevancy"] = Field(default="recency", alias="sortOrder")+ start_time: Optional[str] = Field(default=None, alias="startTime")+ end_time: Optional[str] = Field(default=None, alias="endTime")+ include_metrics: bool = Field(default=True, alias="includeMetrics")+ include_author: bool = Field(default=True, alias="includeAuthor")+++class TwitterUserParams(BaseNodeParams):+ """Parameters for Twitter user lookup node."""+ type: Literal["twitterUser"]+ operation: Literal["me", "by_username", "by_id", "followers", "following"] = "me"+ username: str = ""+ user_id: str = Field(default="", alias="userId")+ max_results: int = Field(default=100, alias="maxResults", ge=1, le=1000)+++class SocialReceiveParams(BaseNodeParams):+ """Parameters for unified social receive trigger node."""+ type: Literal["socialReceive"]+ platform_filter: str = Field(default="all", alias="platformFilter")+ channel_filter: str = Field(default="", alias="channelFilter")+ message_type_filter: str = Field(default="all", alias="messageTypeFilter")+++class SocialSendParams(BaseNodeParams):+ """Parameters for unified social send node."""+ type: Literal["socialSend"]+ platform: Literal["whatsapp", "telegram", "discord", "slack", "signal", "sms", "webchat", "email", "matrix", "teams"] = "whatsapp"+ recipient: str = ""+ message_type: Literal["text", "image", "video", "audio", "document", "sticker", "location", "contact", "poll", "buttons", "list"] = Field(default="text", alias="messageType")+ text: str = ""+ media_url: str = Field(default="", alias="mediaUrl")++class GmailReceiveParams(BaseNodeParams):"""Parameters for Gmail receive polling trigger node."""type: Literal["gmailReceive"]@@ -440,6 +510,9 @@ KnownNodeParams = Annotated[StartNodeParams, CronSchedulerParams, WorkflowTriggerParams,# TriggersTaskTriggerParams, ChatTriggerParams, TelegramReceiveParams, TwitterReceiveParams, GmailReceiveParams,+ # Messaging actions (Wave 6 Phase 3b)+ TelegramSendParams, TwitterSendParams, TwitterSearchParams, TwitterUserParams,+ SocialReceiveParams, SocialSendParams,# TextTextGeneratorParams, FileHandlerParams,# Chatdiff --git a/server/services/node_input_schemas.py b/server/services/node_input_schemas.pyindex af0b1481..7a265e3b 100644--- a/server/services/node_input_schemas.py+++ b/server/services/node_input_schemas.py@@ -21,9 +21,11 @@ from models.nodes import (ConsoleParams, CreateMapParams, CronSchedulerParams, FileHandlerParams,GmailReceiveParams, GmapsLocationsParams, GmapsNearbyPlacesParams,HttpRequestParams, JavaScriptExecutorParams, ProcessManagerParams,- PythonExecutorParams, SimpleMemoryParams, SpecializedAgentParams,- StartNodeParams, TaskTriggerParams, TeamMonitorParams,- TelegramReceiveParams, TextGeneratorParams, TwitterReceiveParams,+ PythonExecutorParams, SimpleMemoryParams, SocialReceiveParams,+ SocialSendParams, SpecializedAgentParams, StartNodeParams,+ TaskTriggerParams, TeamMonitorParams, TelegramReceiveParams,+ TelegramSendParams, TextGeneratorParams, TwitterReceiveParams,+ TwitterSearchParams, TwitterSendParams, TwitterUserParams,TypeScriptExecutorParams, WebhookResponseParams, WebhookTriggerParams,WhatsAppDbParams, WhatsAppReceiveParams, WhatsAppSendParams,WorkflowTriggerParams,@@ -60,6 +62,15 @@ _DIRECT_MODELS: dict[str, type[BaseModel]] = {"whatsappSend": WhatsAppSendParams,"whatsappReceive": WhatsAppReceiveParams,"whatsappDb": WhatsAppDbParams,+ # Telegram+ "telegramSend": TelegramSendParams,+ # Twitter / X+ "twitterSend": TwitterSendParams,+ "twitterSearch": TwitterSearchParams,+ "twitterUser": TwitterUserParams,+ # Unified social+ "socialReceive": SocialReceiveParams,+ "socialSend": SocialSendParams,# Code"pythonExecutor": PythonExecutorParams,"javascriptExecutor": JavaScriptExecutorParams,diff --git a/server/tests/test_node_spec.py b/server/tests/test_node_spec.pyindex 6415a49d..d00c2fed 100644--- a/server/tests/test_node_spec.py+++ b/server/tests/test_node_spec.py@@ -70,12 +70,13 @@ class TestNodeSpec:assert spec["version"] == 1def test_spec_fallback_metadata_when_unseeded(self):- # whatsappSend has input+output schemas but no seeded metadata yet- spec = get_node_spec("whatsappSend")+ # AI chat models have input + output schemas but no metadata seeded+ # yet (Phase 3c will migrate them).+ spec = get_node_spec("openaiChatModel")assert spec is not None- assert spec["type"] == "whatsappSend"- # Falls back to type id until Phase 3b migration- assert spec["displayName"] == "whatsappSend"+ assert spec["type"] == "openaiChatModel"+ # Falls back to type id until Phase 3c migration+ assert spec["displayName"] == "openaiChatModel"assert spec["group"] == []def test_spec_missing_entirely(self):@@ -135,3 +136,49 @@ class TestPhase3aCoverage:spec = get_node_spec("console")log_mode = spec["inputs"]["properties"]["logMode"]assert log_mode["enum"] == ["full", "field", "expression"]+++class TestPhase3bCoverage:+ """Phase 3b backend parity: messaging group (whatsapp, telegram,+ twitter, social) - 11 types."""++ PHASE_3B_TYPES = [+ "whatsappSend", "whatsappReceive", "whatsappDb",+ "telegramSend", "telegramReceive",+ "twitterSend", "twitterReceive", "twitterSearch", "twitterUser",+ "socialReceive", "socialSend",+ ]++ def test_all_have_input_schema(self):+ from services.node_input_schemas import get_node_input_schema+ missing = [t for t in self.PHASE_3B_TYPES if get_node_input_schema(t) is None]+ assert not missing, f"Phase 3b types missing input schema: {missing}"++ def test_all_have_metadata(self):+ from models.node_metadata import get_node_metadata+ missing = [t for t in self.PHASE_3B_TYPES if get_node_metadata(t) is None]+ assert not missing, f"Phase 3b types missing display metadata: {missing}"++ def test_all_have_full_spec(self):+ for t in self.PHASE_3B_TYPES:+ spec = get_node_spec(t)+ assert spec is not None, f"No spec for {t}"+ assert spec["displayName"] != t, f"{t} fell back to id displayName"+ assert spec["group"], f"{t} missing group"++ def test_twitter_send_action_enum(self):+ spec = get_node_spec("twitterSend")+ action = spec["inputs"]["properties"]["action"]+ assert action["enum"] == ["tweet", "reply", "retweet", "like", "unlike", "delete"]++ def test_telegram_send_parse_mode_enum(self):+ spec = get_node_spec("telegramSend")+ parse_mode = spec["inputs"]["properties"]["parseMode"]+ assert parse_mode["enum"] == ["Auto", "HTML", "Markdown", "MarkdownV2", "None"]++ def test_social_send_platform_enum(self):+ spec = get_node_spec("socialSend")+ platform = spec["inputs"]["properties"]["platform"]+ assert "whatsapp" in platform["enum"]+ assert "telegram" in platform["enum"]+ assert "discord" in platform["enum"]