Open WebUI Message Fetcher from URL

Automatically injects and sends a message in Open WebUI if a `?message=` parameter is present in the URL. Useful for automation, testing, or scripted interactions.

Autor
Panonim
Instalaciones diarias
0
Instalaciones totales
0
Calificaciones
0 0 0
Versión
1.0.0
Creado
11/7/2025
Actualizado
11/7/2025
Tamaño
2,13 KB
Licencia
MIT
Funciona en

Script Name: Open WebUI Message Fetcher from URL

Description:

This UserScript is designed to automate message injection and submission in the Open WebUI interface (typically hosted at localhost:3000). When the page is accessed with a ?message= parameter in the URL, the script waits for the chat input field to become available, then automatically pastes the message and simulates pressing the Enter key to send it. This is especially useful for:

  • Automated testing of chatbot workflows.
  • Integration with scripts or tools that launch Open WebUI.
  • Quick pre-filled message submission for demos or debugging.

How It Works:

  1. Parameter Detection: The script reads the message value from the URL query string (?message=Hello+World).
  2. Polling Mechanism: Once the page loads, it repeatedly checks (every 500ms, up to 30 times) for the presence of the chat input field.
  3. Message Injection: When it finds the [contenteditable="true"] input inside the chat container, it sets its content to the message string.
  4. Input Simulation: It dispatches an InputEvent to make the change detectable by the frontend app.
  5. Enter Key Emulation: After a short delay (250ms), it simulates pressing the Enter key to trigger the sending of the message.

Usage Instructions:

  1. Install a UserScript Manager.
  2. Install This Script
  3. Access Open WebUI With a Message: Open a URL like:
   http://localhost:3000/?message=Hello+World

The script will automatically detect the message parameter and submit it once the input field is available.


Limitations / Notes:

  • Only Works on localhost:3000: If your Open WebUI is hosted elsewhere, update the @match line accordingly.
  • Single Use Per Page Load: It only sends the message once per page load to prevent accidental spam.
  • Relies on DOM Structure: If Open WebUI updates its structure or class names, the script may break and need an update.
  • Doesn’t Sanitize Input: It directly injects the URL-provided text. Be cautious when passing user-generated input.

Meta Info: