PHPackages                             woutersf/ai-console-bundle - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [CLI &amp; Console](/categories/cli)
4. /
5. woutersf/ai-console-bundle

ActiveMautic-plugin[CLI &amp; Console](/categories/cli)

woutersf/ai-console-bundle
==========================

AI-powered console interface for Mautic with voice input and intelligent assistance

v1.0.0(5mo ago)00GPL-3.0-or-laterPHPPHP ^7.4|^8.0

Since Nov 27Pushed 5mo agoCompare

[ Source](https://github.com/woutersf/MauticAiConsoleBundle)[ Packagist](https://packagist.org/packages/woutersf/ai-console-bundle)[ RSS](/packages/woutersf-ai-console-bundle/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (2)Versions (2)Used By (0)

Mautic AI Console Bundle
========================

[](#mautic-ai-console-bundle)

[![Mautic AI Console](Assets/mauticbot.png)](Assets/mauticbot.png)

An AI-powered console interface for Mautic with voice input, intelligent assistance, and tool integration. Chat with your Mautic instance using natural language!

Overview
--------

[](#overview)

The Mautic AI Console Bundle provides an intelligent assistant that helps users interact with their Mautic instance through natural language. Ask questions about your data, get help with configuration, or execute actions - all through a conversational interface.

[![AI Console Interface](Assets/console.png)](Assets/console.png)

Features
--------

[](#features)

- **Game-Like Console Toggle** - Instant access via keyboard (console key ` or § key) - just like Counter-Strike or Minecraft!
- **Natural Language Interface** - Chat with Mautic in plain language
- **Voice Input Support** - Speak to the AI using speech-to-text (Whisper integration)
- **Context-Aware** - Knows your name, language, and Mautic version
- **Conversation History** - Maintains context across multiple messages
- **Tool Integration** - Can execute actions in Mautic (contacts, segments, cache, etc.)
- **Customizable AI Model** - Choose from available models (GPT-4, Claude, etc.)
- **Custom Instructions** - Define system prompts to control AI behavior
- **Multi-language Support** - Responds in the user's preferred language

Requirements
------------

[](#requirements)

- Mautic 4.0+ or Mautic 5.0+
- PHP 7.4 or 8.0+
- **Mautic AI Connection Bundle** (required dependency)
- A configured LiteLLM instance or OpenAI API access

Installation
------------

[](#installation)

### Via Composer

[](#via-composer)

```
composer require mautic/ai-console-bundle
```

This will automatically install the required `mautic/ai-connection-bundle` dependency.

### Manual Installation

[](#manual-installation)

1. First, install the **Mautic AI Connection Bundle** (required)
2. Download or clone this repository
3. Place the `MauticAiConsoleBundle` folder in `docroot/plugins/`
4. Clear Mautic cache: ```
    php bin/console cache:clear
    ```
5. Go to Mautic Settings → Plugins
6. Click "Install/Upgrade Plugins"
7. Find "Mautic AI Console" and publish it

Dependencies
------------

[](#dependencies)

### Mautic AI Connection Bundle (Required)

[](#mautic-ai-connection-bundle-required)

This plugin **requires** the [Mautic AI Connection Bundle](../MauticAIconnectionBundle/README.md) to function. The AI Connection Bundle provides:

- LiteLLM service integration
- Centralized AI configuration (endpoint and API keys)
- Model management

**Important:** Configure the AI Connection Bundle first before using the AI Console!

Configuration
-------------

[](#configuration)

Navigate to **Mautic Settings → Plugins → Mautic AI Console** to configure the plugin.

### Basic Settings

[](#basic-settings)

#### 1. AI Console Enabled

[](#1-ai-console-enabled)

Enable or disable the AI Console interface.

#### 2. AI Model

[](#2-ai-model)

Select which AI model to use for the console:

- GPT-4 (most capable, slower)
- GPT-3.5 Turbo (fast, cost-effective)
- Claude 3 Sonnet/Haiku/Opus
- Other models available in your LiteLLM instance

**Note:** The AI Console and AI Reports can use different models independently.

#### 3. Pre-prompt (System Instructions)

[](#3-pre-prompt-system-instructions)

The pre-prompt is **critical** for controlling the AI's behavior. This is where you define:

- The AI's personality and role
- Output format (HTML, markdown, plain text)
- Language preferences
- Available context (user info, Mautic version)
- Behavioral guidelines

**Default Pre-prompt Example:**

```
CONTEXT:
--------------
Your name is Mattias. You are the Mautic helper and you run inside the Mautic AI console.

You are helping the following user:
User firstname: {account_firstname}
User Lastname: {account_lastname}
User Email: {account_email}

OUTPUT
------------
You may use the following HTML tags: , , , , ,
You don't return Markdown, you return HTML.
If you link to a URL (e.g., /s/dashboard), link to it like this: /s/dashboard

You always try to answer in short sentences or limited paragraphs, only elaborate when explicitly asked.

You answer in {language}

Instructions:
-----------------
You are a professional helpful Mautic assistant. You help users with their marketing automation tasks.
You answer in a professional manner, without repeating the question and in a brief manner.

You can help with:
1. Answering questions based on Mautic documentation
2. Triggering tool calls when needed

If you are asked commands or things you cannot do, just say: "This feature is not supported. I'm sorry."

```

#### Available Tokens in Pre-prompt

[](#available-tokens-in-pre-prompt)

- `{language}` - User's interface language (e.g., "English", "French")
- `{account_firstname}` - User's first name
- `{account_lastname}` - User's last name
- `{account_email}` - User's email address
- `{mautic_version}` - Current Mautic version

### Importance of a Good Pre-prompt

[](#importance-of-a-good-pre-prompt)

The pre-prompt is **the most important configuration** for the AI Console. A well-crafted pre-prompt will:

✅ **Define personality** - Is the AI formal, friendly, technical, or casual? ✅ **Control output format** - HTML vs Markdown vs plain text ✅ **Set boundaries** - What the AI can and cannot do ✅ **Provide context** - User info, system capabilities, documentation ✅ **Ensure consistency** - Same behavior across all users ✅ **Improve accuracy** - Clear instructions = better responses

**Tips for Writing Good Pre-prompts:**

1. **Be specific about output format**

    ```
    ❌ Bad: "Answer questions"
    ✅ Good: "Answer in 2-3 sentences using HTML tags only. No markdown."

    ```
2. **Define the AI's role clearly**

    ```
    ❌ Bad: "You are helpful"
    ✅ Good: "You are a Mautic technical expert who helps with marketing automation"

    ```
3. **Set response length expectations**

    ```
    ❌ Bad: "Answer questions"
    ✅ Good: "Keep answers under 100 words unless the user asks for more detail"

    ```
4. **Include relevant documentation or context**

    ```
    ✅ Good: Include key Mautic paths like /s/contacts, /s/campaigns, etc.

    ```
5. **Handle edge cases**

    ```
    ✅ Good: "If asked about features you're unsure about, direct users to the official documentation"

    ```

### Speech-to-Text Settings

[](#speech-to-text-settings)

#### Enable Speech-to-Text

[](#enable-speech-to-text)

Toggle voice input functionality.

#### Speech-to-Text Model

[](#speech-to-text-model)

Select the model for speech recognition:

- whisper-1 (OpenAI Whisper)
- Other speech models available in your LiteLLM instance

**Note:** Speech-to-text requires audio transcription support in your LiteLLM configuration.

### Tool Configuration

[](#tool-configuration)

Enable or disable specific tools that the AI can execute:

- **Clear Cache Tool** - Allow AI to clear Mautic cache
- **Create Contact Tool** - Allow AI to create contacts
- **Create Segment Tool** - Allow AI to create segments

**Security Note:** Only enable tools you want the AI to have access to. Disabled tools won't be available to the AI.

Usage
-----

[](#usage)

### Accessing the Console

[](#accessing-the-console)

The AI Console can be accessed in two ways:

1. **Keyboard Toggle (Recommended)** - Press the **console key** (` or ~ key, depending on your keyboard layout) or the **paragraph key** (§) to instantly toggle the AI Console on/off. This provides quick, game-like access similar to consoles in Counter-Strike or Minecraft.
2. **Toolbar Button** - Click the AI Console button in the Mautic toolbar (top right).

**Pro Tip:** The keyboard toggle is the fastest way to access the AI while working in Mautic!

### Asking Questions

[](#asking-questions)

**Examples:**

- "How many contacts do I have?"
- "Show me recent campaigns"
- "How do I create a segment?"
- "What's the difference between a segment and a tag?"
- "Navigate to the email builder"

### Using Voice Input

[](#using-voice-input)

1. Click the microphone icon in the AI Console
2. Speak your question
3. The AI will transcribe and respond

### Using Tools

[](#using-tools)

When enabled, the AI can execute actions:

**Example:**

- User: "Create a contact named John Doe with email "
- AI: Executes the Create Contact tool
- AI: "✅ Contact created successfully: John Doe ()"

Architecture
------------

[](#architecture)

```
┌─────────────────────────────────────┐
│     Mautic AI Console Bundle        │
│                                     │
│  ┌─────────────────────────────┐   │
│  │  Console Controller         │   │
│  │  - Process messages         │   │
│  │  - Handle voice input       │   │
│  │  - Tool execution           │   │
│  │  - Conversation history     │   │
│  └─────────────────────────────┘   │
└─────────────────────────────────────┘
              ↓ depends on
┌─────────────────────────────────────┐
│   Mautic AI Connection Bundle       │
│  ┌───────────────────────────────┐  │
│  │   LiteLLM Service             │  │
│  │  - Chat API                   │  │
│  │  - Speech-to-text API         │  │
│  └───────────────────────────────┘  │
└─────────────────────────────────────┘
              ↓ connects to
┌─────────────────────────────────────┐
│       LiteLLM Proxy Server          │
│  (Routes to OpenAI, Claude, etc.)   │
└─────────────────────────────────────┘

```

Advanced Configuration
----------------------

[](#advanced-configuration)

### Custom Tools

[](#custom-tools)

Create custom tools by extending the tool system:

1. Create a new tool class in `Tools/` directory:

```
