Python Webhook Simulator v2.2

Unlimited Stress Testing Documentation

Web Version

🔧 Command Generator

Higher concurrency speeds up stress testing but makes debugging harder. Use 1-10 for debugging, 50-100+ for stress testing.

Runs calls one by one for easier debugging and tracing. Slower but sequential logs help identify issues.

Adds randomized delays between calls for more realistic testing. Simulates variable network conditions and timing.

python webhook_simulator.py --url https://api.example.com/webhook --agents 101001,101002,101003,101004,101005,101006,101007,101008 --calls 100 --shuffle

🚀 Introduction

The Python Webhook Simulator is a powerful tool that replicates and enhances all functionality from the original HTML/JS version, with unlimited concurrent requests for stress testing.

Key Enhancement

Unlike browser limitations (~6 concurrent requests), this Python version can handle unlimited concurrent calls for true stress testing.

📦 Installation

Requirements

  • Python 3.7+
  • aiohttp library

Install with PIP (Recommended)

pip install aiohttp
Copied!

Install with APT (For Debian/Ubuntu)

sudo apt update && sudo apt install python3 python3-pip python3-aiohttp -y
Copied!

🎯 Basic Usage

List Available Presets

python webhook_simulator.py --list-presets
Copied!

Simple Simulation

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002 \
  --preset inbound-missed
Copied!

Multiple Calls

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002,101003 \
  --calls 50 \
  --preset inbound-success
Copied!

⚡ Execution Modes

🔄 New Feature: Choose Your Execution Mode

Select between concurrent (fast, stress testing) and sequential (controlled, debugging) execution modes.

🚀 Concurrent Mode (Default)

Multiple calls run simultaneously for maximum performance and stress testing.

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002 \
  --calls 100 \
  --concurrent 20 \
  --preset inbound-success

✅ Faster execution, ideal for stress testing

🔄 Sequential Mode

Calls run one after another for controlled testing and debugging.

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002 \
  --calls 100 \
  --sequential \
  --preset inbound-success

✅ Controlled execution, easier to debug

📊 Performance Comparison

Example: 100 calls, each taking 1.5 seconds

Concurrent (--concurrent 20):

~7.5 seconds total

Sequential (--sequential):

~150 seconds total

🔥 Stress Testing

High-Volume Test (1000 calls)

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002,101003 \
  --calls 1000 \
  --concurrent 50 \
  --preset inbound-success
Copied!

Extreme Load Test (5000 calls)

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002,101003,101004 \
  --calls 5000 \
  --concurrent 100 \
  --preset inbound-success \
  --event-delay 100 \
  --call-delay 50
Copied!

Performance Testing

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002,101003,101004 \
  --calls 500 \
  --concurrent 25 \
  --preset inbound-success \
  --event-delay 200 \
  --call-delay 100
Copied!

🎛️ Custom Scenarios

Custom Outbound Success

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001 \
  --calls 50 \
  --custom-direction outbound \
  --custom-status success
Copied!

Custom with Duplicates

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001 \
  --calls 20 \
  --custom-direction inbound \
  --custom-status missed \
  --custom-duplicate
Copied!

Custom with Random Delays

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001 \
  --calls 50 \
  --custom-direction outbound \
  --custom-status success \
  --custom-duplicate \
  --random-delay \
  --min-delay 0.5 \
  --max-delay 3.0
Copied!

🔄 Shuffle Mode

✅ Enhanced Shuffle Mode

Randomizes direction (inbound/outbound), status (success/missed), duplicates, and phone numbers. No preset required!

🎲 True Randomization

Shuffle mode now works without presets and creates truly random call scenarios for ultimate robustness testing.

Pure Shuffle Mode (No Preset Required)

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002 \
  --calls 100 \
  --shuffle
Copied!

Shuffle with Custom Phone Numbers

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002 \
  --phones 0682693264,0762545638,0612345678 \
  --calls 200 \
  --concurrent 20 \
  --shuffle \
  --preset inbound-success
Copied!

Shuffle with Random Delays

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002,101003 \
  --calls 500 \
  --concurrent 10 \
  --shuffle \
  --random-delay \
  --min-delay 0.5 \
  --max-delay 5.0 \
  --preset inbound-success
Copied!

🚀 Advanced Features

Authenticated Webhook

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --token your-secret-token \
  --agents 101001,101002 \
  --calls 100 \
  --preset outbound-success
Copied!

Realistic Simulation

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002,101003 \
  --phones 0682693264,0762545638,0612345678,0698765432 \
  --calls 100 \
  --concurrent 5 \
  --random-delay \
  --min-delay 1.0 \
  --max-delay 5.0 \
  --preset inbound-success
Copied!

Mixed Scenario Testing

python webhook_simulator.py \
  --url https://api.example.com/webhook \
  --agents 101001,101002 \
  --calls 300 \
  --concurrent 15 \
  --shuffle \
  --preset inbound-success
Copied!

📋 Available Presets

inbound-success

created → answered → hungup

Successful inbound call

inbound-missed

created → hungup

Missed inbound call

inbound-missed-duplicate

created → hungup → hungup

Missed call with duplicate

outbound-unreachable

created → hungup

Unreachable outbound call

outbound-success

created → answered → hungup

Successful outbound call

outbound-success-duplicate

created → answered → hungup → hungup

Successful call with duplicate

🔧 Programmatic Usage

import asyncio
from webhook_simulator import WebhookSimulator

async def run_custom_test():
    simulator = WebhookSimulator()
    
    # Configure your test
    await simulator.run_simulation(
        webhook_url="https://api.example.com/webhook",
        agent_ids=["101001", "101002", "101003"],
        phone_numbers=["0682693264", "0762545638"],
        num_calls=50,
        preset_key="inbound-success",
        concurrent_calls=10,
        event_delay=300,
        call_delay=100,
        shuffle=True,
        token="your-secret-token"
    )

# Run the test
asyncio.run(run_custom_test())
Copied!

💡 Performance Tips

🎯 Start Small

Begin with 1-10 concurrent calls

📈 Scale Gradually

Increase load incrementally

🔄 Use Shuffle

Enable shuffle for realistic testing

⚡ Monitor Performance

Watch response times and adjust