Thanks to visit codestin.com
Credit goes to Github.com

Skip to content

Conversation

@codegen-sh
Copy link

@codegen-sh codegen-sh bot commented Nov 4, 2025

πŸš€ Browser Automation for Chat Interfaces

This PR adds comprehensive documentation, tooling, and examples for using Maxun to automate web-based chat interfaces with authentication, message sending, and retrieval capabilities.

✨ What's New

πŸ“š Complete Documentation

  • docs/BROWSER_AUTOMATION_CHAT.md - Comprehensive guide covering:
    • Quick start deployment guide
    • API authentication setup
    • Creating automation robots
    • Workflow structure and parameters
    • Best practices for security, reliability, and performance
    • Troubleshooting common issues

πŸ› οΈ Quick Deployment Tool

  • deploy_chat_automation.sh - One-command deployment script:
    • Automatic dependency checking
    • Secure secret generation
    • Docker Compose orchestration
    • Service health monitoring
    • Example setup automation

πŸ’» Code Examples

Located in examples/:

  • Python - Full-featured client with rate limiting and error handling
  • Node.js - Async/await implementation with TypeScript support
  • Bash - curl/jq-based automation for shell scripts
  • package.json - Ready-to-use Node.js project setup

🎯 Use Cases

This implementation enables:

  • Chat Platform Automation - Slack, Discord, Teams, etc.
  • Customer Support - Automated responses and ticket management
  • Marketing Automation - Bulk messaging with rate limiting
  • Testing & QA - Automated chat interface testing
  • Monitoring & Alerts - Send notifications via chat platforms

πŸ“‹ Features

API-Based Workflow

  • Procedural browser interaction recordings
  • Dynamic parameter injection (${USERNAME}, ${PASSWORD}, ${MESSAGE})
  • Capture text and lists from responses
  • Screenshot debugging support

Authentication Support

  • Login with actual credentials
  • Session management
  • Cookie persistence
  • Proxy configuration

Production-Ready

  • Rate limiting implementation
  • Error handling with retries
  • Comprehensive logging
  • Webhook integration
  • Scheduled runs support

πŸš€ Quick Start

# 1. Deploy Maxun
./deploy_chat_automation.sh

# 2. Access UI at http://localhost:5173
# 3. Create account and get API key
# 4. Record your first robot

# 5. Run examples
cd examples
export MAXUN_API_KEY="your-key"
export MAXUN_ROBOT_ID="your-robot-id"

# Python
python chat_automation_python.py

# Node.js  
npm install && node chat_automation_node.js

# Bash
./chat_automation_bash.sh

πŸ“ Example Usage

Python:

from chat_automation_python import MaxunClient, ChatAutomation

client = MaxunClient(API_URL, API_KEY)
chat = ChatAutomation(client, ROBOT_ID)

result = chat.send_message(
    username="[email protected]",
    password="password",
    message="Hello from automation!"
)

API Call:

curl -X POST http://localhost:8080/api/robots/{robotId}/runs \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "parameters": {
      "USERNAME": "[email protected]",
      "PASSWORD": "password",
      "MESSAGE": "Hello!"
    }
  }'

πŸ”’ Security Features

  • Secure secret generation via OpenSSL
  • Environment variable configuration
  • API key authentication
  • Credential encryption (using ENCRYPTION_KEY)
  • HTTPS support for production
  • Proxy configuration for anonymity

πŸ“Š Performance

  • Asynchronous execution
  • Rate limiting support
  • Parallel robot runs
  • Timeout configuration
  • Resource monitoring

πŸ§ͺ Testing

All examples include:

  • Error handling with retries
  • Status polling
  • Screenshot debugging
  • Comprehensive logging
  • Rate limiting

πŸ“– Documentation Structure

docs/
└── BROWSER_AUTOMATION_CHAT.md  # Complete guide (6000+ words)

examples/
β”œβ”€β”€ README.md                    # Quick reference
β”œβ”€β”€ package.json                 # Node.js dependencies
β”œβ”€β”€ chat_automation_python.py    # Python implementation
β”œβ”€β”€ chat_automation_node.js      # Node.js implementation
└── chat_automation_bash.sh      # Bash implementation

deploy_chat_automation.sh         # One-command deployment

πŸ”— Related Resources

βœ… Checklist

  • Comprehensive documentation
  • Deployment automation
  • Multi-language examples
  • Security best practices
  • Error handling patterns
  • Rate limiting implementation
  • Production deployment guide
  • API reference
  • Troubleshooting section

πŸŽ‰ Benefits

  • Zero Configuration: Deploy in one command
  • Multi-Language: Python, Node.js, and Bash examples
  • Production-Ready: Best practices included
  • Well-Documented: 6000+ words of documentation
  • Secure: Automated secret generation
  • Flexible: Support for any web-based chat interface

Ready to automate your chat interfaces! πŸ€–πŸ’¬


πŸ’» View my work β€’ πŸ‘€ Initiated by @Zeeeepa β€’ About Codegen
β›” Remove Codegen from PR β€’ 🚫 Ban action checks


Summary by cubic

Adds browser automation for web-based chat interfaces with API-driven workflows, plus a one-command deploy script and language examples. This enables authenticated message sending/retrieval with production-ready guidance.

  • New Features
    • docs/BROWSER_AUTOMATION_CHAT.md: end-to-end guide (setup, auth, workflows, API reference, troubleshooting).
    • deploy_chat_automation.sh: one-command Docker deployment with secret generation, health checks, and example setup.
    • Examples (Python/Node.js/Bash): message send/retrieve with retries, rate limiting, logging, and status polling.
    • Supports parameterized workflows, session/cookie handling, screenshots for debugging, webhooks, and scheduled runs.

Written for commit a9e1524. Summary will update automatically on new commits.

- Complete documentation in docs/BROWSER_AUTOMATION_CHAT.md
- Quick deployment script with auto-configuration
- Example implementations for Python, Node.js, and Bash
- API reference and best practices
- Support for authentication, message sending, and retrieval
- Rate limiting and error handling examples
- Production deployment guidance

Co-authored-by: Zeeeepa <[email protected]>
@coderabbitai
Copy link

coderabbitai bot commented Nov 4, 2025

Important

Review skipped

Bot user detected.

To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.


Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@cubic-dev-ai cubic-dev-ai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

4 issues found across 7 files

Prompt for AI agents (all 4 issues)

Understand the root cause of the following 4 issues and fix them.


<file name="deploy_chat_automation.sh">

<violation number="1" location="deploy_chat_automation.sh:161">
The script validates environments that only have the Docker Compose plugin, but later calls `docker-compose pull`, which will fail when the plugin is the only available option. Please use a command that works for both cases (e.g., detect once and set a variable) before invoking pull/up.</violation>

<violation number="2" location="deploy_chat_automation.sh:178">
`wait_for_services` relies on `curl`, but the dependency check never verifies that `curl` exists. If curl is missing, the health probe fails and the script exits with a backend error. Please add a curl dependency check (or guard) before using it.</violation>
</file>

<file name="examples/package.json">

<violation number="1" location="examples/package.json:15">
The license field should use a valid SPDX identifier (e.g., &quot;AGPL-3.0-or-later&quot;) so that npm consumers receive correct licensing metadata.</violation>
</file>

<file name="docs/BROWSER_AUTOMATION_CHAT.md">

<violation number="1" location="docs/BROWSER_AUTOMATION_CHAT.md:305">
Example 2 references `MESSAGE_RETRIEVER_ROBOT_ID`, but the guide never defines that constant, so the sample script will crash with a `NameError` when readers follow it.</violation>
</file>

React with πŸ‘ or πŸ‘Ž to teach cubic. Mention @cubic-dev-ai to give feedback, ask questions, or re-run the review.

local attempt=0

while [ $attempt -lt $max_attempts ]; do
if curl -sf http://localhost:8080/health > /dev/null 2>&1; then
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

wait_for_services relies on curl, but the dependency check never verifies that curl exists. If curl is missing, the health probe fails and the script exits with a backend error. Please add a curl dependency check (or guard) before using it.

Prompt for AI agents
Address the following comment on deploy_chat_automation.sh at line 178:

<comment>`wait_for_services` relies on `curl`, but the dependency check never verifies that `curl` exists. If curl is missing, the health probe fails and the script exits with a backend error. Please add a curl dependency check (or guard) before using it.</comment>

<file context>
@@ -0,0 +1,320 @@
+    local attempt=0
+    
+    while [ $attempt -lt $max_attempts ]; do
+        if curl -sf http://localhost:8080/health &gt; /dev/null 2&gt;&amp;1; then
+            echo -e &quot;${GREEN}βœ“ Backend is ready${NC}&quot;
+            break
</file context>
Fix with Cubic

echo -e "${BLUE}Starting Maxun services...${NC}"

echo -e "${YELLOW}Pulling latest Docker images...${NC}"
docker-compose pull
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The script validates environments that only have the Docker Compose plugin, but later calls docker-compose pull, which will fail when the plugin is the only available option. Please use a command that works for both cases (e.g., detect once and set a variable) before invoking pull/up.

Prompt for AI agents
Address the following comment on deploy_chat_automation.sh at line 161:

<comment>The script validates environments that only have the Docker Compose plugin, but later calls `docker-compose pull`, which will fail when the plugin is the only available option. Please use a command that works for both cases (e.g., detect once and set a variable) before invoking pull/up.</comment>

<file context>
@@ -0,0 +1,320 @@
+    echo -e &quot;${BLUE}Starting Maxun services...${NC}&quot;
+    
+    echo -e &quot;${YELLOW}Pulling latest Docker images...${NC}&quot;
+    docker-compose pull
+    
+    echo -e &quot;${YELLOW}Starting containers...${NC}&quot;
</file context>
Fix with Cubic

},
"keywords": ["maxun", "automation", "chat", "browser"],
"author": "Maxun",
"license": "AGPLv3"
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The license field should use a valid SPDX identifier (e.g., "AGPL-3.0-or-later") so that npm consumers receive correct licensing metadata.

Prompt for AI agents
Address the following comment on examples/package.json at line 15:

<comment>The license field should use a valid SPDX identifier (e.g., &quot;AGPL-3.0-or-later&quot;) so that npm consumers receive correct licensing metadata.</comment>

<file context>
@@ -0,0 +1,16 @@
+  },
+  &quot;keywords&quot;: [&quot;maxun&quot;, &quot;automation&quot;, &quot;chat&quot;, &quot;browser&quot;],
+  &quot;author&quot;: &quot;Maxun&quot;,
+  &quot;license&quot;: &quot;AGPLv3&quot;
+}
</file context>
Suggested change
"license": "AGPLv3"
"license": "AGPL-3.0-or-later"
Fix with Cubic

}

response = requests.post(
f"{API_URL}/robots/{MESSAGE_RETRIEVER_ROBOT_ID}/runs",
Copy link

@cubic-dev-ai cubic-dev-ai bot Nov 4, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Example 2 references MESSAGE_RETRIEVER_ROBOT_ID, but the guide never defines that constant, so the sample script will crash with a NameError when readers follow it.

Prompt for AI agents
Address the following comment on docs/BROWSER_AUTOMATION_CHAT.md at line 305:

<comment>Example 2 references `MESSAGE_RETRIEVER_ROBOT_ID`, but the guide never defines that constant, so the sample script will crash with a `NameError` when readers follow it.</comment>

<file context>
@@ -0,0 +1,775 @@
+    }
+    
+    response = requests.post(
+        f&quot;{API_URL}/robots/{MESSAGE_RETRIEVER_ROBOT_ID}/runs&quot;,
+        json=payload,
+        headers=headers
</file context>
Fix with Cubic

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant