Developer Getting Started

Welcome to OpenAutomate bot development! This guide will help you create your first automation bot using our cookiecutter template - the easiest way to get started.

Prerequisites

Before you start developing, ensure you have:
  • Python 3.11+: Download from python.org
  • Cookiecutter: Install with pip install cookiecutter
  • Code Editor: VS Code, PyCharm, or your preferred editor
  • OpenAutomate Account: Access to the cloud orchestrator

Step 1: Create Your First Bot

The fastest way to start is using our bot template:

Generate from Template

# Install cookiecutter first
pip install cookiecutter

# Generate your bot from the template
cookiecutter https://github.com/OpenAutomateOrg/openautomate-bot-template

Answer the Prompts

bot_name [MyBot]: FileProcessorBot
bot_description [A Python automation bot]: Processes CSV files automatically
cd FileProcessorBot
You’ll get a project structure like this:
FileProcessorBot/
β”œβ”€β”€ bot.py                     # πŸ‘ˆ Your main file - edit this!
β”œβ”€β”€ framework/                 # Bot utilities (don't touch)
β”œβ”€β”€ examples/                  # Example bots to learn from
β”œβ”€β”€ config/                    # Configuration files
β”œβ”€β”€ tasks/                     # Your custom task modules (optional)
β”œβ”€β”€ requirements.txt           # Python dependencies
β”œβ”€β”€ .gitignore                # Git ignore file
└── README.md                  # Project-specific README

Step 2: Install Dependencies

pip install -r requirements.txt

Step 3: Edit Your Bot

Open bot.py and find the execute method. This is where your automation logic goes:
def execute(self):
    """
    Add your automation code here!
    """
    self.logger.info("πŸ€– Starting my automation...")
    
    # Example: Get data from platform
    api_key = self.get_asset('api_key')  # Get secure data
    
    # Example: Create folders for your files
    create_transaction_folders(self.bot_name, self.logger)
    
    # TODO: Your automation code here!
    # - Process files
    # - Scrape websites  
    # - Automate tasks
    # - Send emails
    # - Anything you want!
    
    return {
        'message': 'βœ… My automation finished!',
        'data': {'items_processed': 5}
    }

Step 4: Test Your Bot

Run your bot locally to test it:
python bot.py
You should see:
  • Log messages in the console
  • Files created in Documents/openautomate-bot/YourBotName/

What You Get Automatically

πŸ—‚οΈ Automatic Folders

The bot creates folders for your files in Documents/openautomate-bot/YourBot/:
  • input/ - Put files to process here
  • output/ - Bot saves results here
  • temp/ - Temporary files
  • screenshots/ - Screenshots

πŸ”‘ Secure Assets

Get sensitive data safely:
api_key = self.get_asset('api_key')        # Get API key
password = self.get_asset('database_pass')  # Get password
all_keys = self.get_all_asset_keys()       # See what's available

πŸ“ Easy Logging

self.logger.info("Starting task...")       # Info message
self.logger.warning("Something's odd...")   # Warning
self.logger.error("Oops, failed!")        # Error

πŸ“Š Status Updates

self.update_status("Processing files...")   # Update progress
self.update_status("Almost done...")        # Keep users informed

Basic Examples

Simple File Processor

def execute(self):
    # Get input and output folders
    input_folder = ensure_folder(self.bot_name, "input")
    output_folder = ensure_folder(self.bot_name, "output")
    
    # Process all text files
    for file in input_folder.glob("*.txt"):
        with open(file, 'r') as f:
            content = f.read()
        
        # Do something with content (example: convert to uppercase)
        processed = content.upper()
        
        # Save result
        output_file = output_folder / f"processed_{file.name}"
        with open(output_file, 'w') as f:
            f.write(processed)
    
    return {'message': 'Files processed!'}

Check the Examples Folder

Your generated bot includes complete examples:
  • examples/simple_web_scraper.py - Web scraping example
  • examples/asset_demo.py - How to use secure assets
  • examples/complex_bot_example.py - Advanced multi-task bot

Creating Additional Bots

After your first bot, creating more is even easier:

If You Have the Template Locally

# Navigate to where you cloned the template
cd path/to/openautomate-bot-template

# Generate another bot
cookiecutter .

Or Use the GitHub URL Again

cookiecutter https://github.com/OpenAutomateOrg/openautomate-bot-template

Common Automation Ideas

Here are some ideas to get you started:
  • File Processing - Convert, rename, organize files
  • Web Scraping - Extract data from websites
  • Excel Automation - Process spreadsheets
  • Email Tasks - Send reports, check inbox
  • Database Work - Import/export data
  • API Integration - Connect to web services
  • Report Generation - Create PDFs, charts
  • System Monitoring - Check disk space, processes

Optional: Advanced Bot Structure

For complex automations, you can organize your code into task modules:

Create Task Modules

Create a tasks/ folder and organize your subtasks:
your-bot-project/
β”œβ”€β”€ bot.py                     # Main orchestrator
β”œβ”€β”€ tasks/                     # πŸ‘ˆ Your subtasks here
β”‚   β”œβ”€β”€ __init__.py           # Makes it a Python package
β”‚   β”œβ”€β”€ email_tasks.py        # Email automation
β”‚   β”œβ”€β”€ file_tasks.py         # File processing
β”‚   └── web_tasks.py          # Web scraping
β”œβ”€β”€ framework/                 # Bot utilities
└── config/                    # Configuration

Import and Use Tasks

In your bot.py:
# Import your task modules
try:
    from tasks import email_tasks, file_tasks, web_tasks
except ImportError as e:
    print(f"⚠️  Some task modules not found: {e}")

def execute(self):
    # Use your task modules
    files_processed = file_tasks.process_csv_files(self.logger, input_folder, output_folder)
    email_tasks.send_report(self.logger, smtp_config, recipients, report_data)
    
    return {'message': 'βœ… Complex automation completed!'}

Tips for Success

  1. Start Simple - Begin with logging and folder creation
  2. Use Examples - Copy from the examples folder
  3. Test Often - Run python bot.py frequently
  4. Check Folders - Look in Documents/openautomate-bot/YourBot/
  5. Use Assets - Store passwords and API keys as assets
  6. Organize Tasks - For complex bots, create a tasks/ folder

Need Help?

  1. Check Examples - Look in examples/ folder in your generated bot
  2. Read Logs - The bot tells you what’s happening
  3. Start Simple - Just make it log β€œHello World” first
  4. Community Support - Join our Discord

Next Steps

Once you have a working bot:
  1. Deploy Your Bot: Package it as a ZIP file and upload to the OpenAutomate dashboard
  2. Explore Advanced Features: Check out Python Templates for more examples
  3. Learn About Assets: Store credentials securely in the platform
  4. Set Up Scheduling: Run your bots automatically on schedules
You’re ready to start automating! πŸ€– Happy automating! πŸŽ‰