Skip to content
Impulse SoftwareDOCS
Get modules

Impulse AI Assistant

Verified for Impulse AI Assistant 2.1.0 ·

Account context, tools & actions

By default, Impulse AI Assistant operates strictly as a cited documentation assistant. When you are ready to give signed-in customers account-aware answers or safe self-service actions, every capability is opt-in, individually toggleable, and enforced outside the AI model.

Inside the Assistant workspace, you can enable read-only, client-scoped WHMCS account context for signed-in customers (strictly rejected on Public Website Embeds and Response Lab):

Category What is shared with the model What is never shared
Active & recent services Product name, domain, status (Active, Suspended, Pending), and next due date Service passwords, control-panel credentials, root keys, server IPs
Unpaid invoices Invoice status, due date, and total Payment tokens, card/gateway metadata, billing notes
Domains Domain name, status, and expiry date EPP transfer codes, registrar credentials
Open support tickets Subject line and status of non-closed tickets Private admin notes, full ticket bodies, other clients’ tickets

Every built-in read tool runs through ToolRegistry and ToolPayloadGuard, scoping every query strictly to the authenticated WHMCS client_id and blocking any secret-shaped payload before it can leave WHMCS.

2. Confirmed self-service actions & independent kill switch

Section titled “2. Confirmed self-service actions & independent kill switch”

Under Assistant → Tools & confirmed self-service actions, you can enable safe, reversible self-service actions for signed-in clients:

  • Independent Actions kill switch: Separate from the AI response kill switch and paused by default. Clicking Pause all self-service actions stops all pending and new action executions immediately while keeping customer chat answers running uninterrupted.
  • Built-in reversible WHMCS actions (disabled by default):
    • whmcs.invoice.resend_email — resends an unpaid invoice payment reminder to the authenticated client’s email after verifying tblinvoices.userid ownership.
    • whmcs.domain.toggle_autorenew — enables or disables auto-renewal on an active domain owned by the authenticated client after verifying tbldomains.userid ownership.

Impulse AI Assistant Customer assistant workspace showing opt-in read-only WHMCS account context toggles, the independent Pause all self-service actions kill switch, built-in WHMCS confirmed actions, and discovered external tool providers

Models and untrusted callers can never execute a mutating tool directly:

  1. Proposal: Creating an action proposal validates arguments against the tool’s strict JSON schema and secret-free payload guard, persists the proposal in mod_impulseassistant_action_proposals with a 10-minute expiry and unique idempotency key, and stores only the SHA-256 hash of a 256-bit single-use confirmation token.
  2. Native confirmation card: The browser renders a native pure-DOM confirmation card showing the provider, action, exact parameters, and expiration time, with Confirm & run and Cancel buttons.
  3. Atomic server-side execution: Clicking Confirm & run re-verifies the WHMCS session, CSRF token, client and conversation ownership, unpaused actions kill switch, per-tool enablement, expiration, and constant-time confirmation token hash, then atomically claims the proposal (proposed → executing) so double-clicks and replays are rejected. Every proposal, cancellation, failure, and completed receipt is audited via ImpulseCore::log().

3. Building external tool providers (ImpulseAssistantToolProviders)

Section titled “3. Building external tool providers (ImpulseAssistantToolProviders)”

Installed Impulse modules and third-party WHMCS addons can register their own read-only tools and reversible confirmed actions through the versioned ImpulseAssistantToolProviders hook. Discovered providers appear automatically in Assistant → Tools & confirmed self-service actions, where administrators decide which tools to enable.

<?php
use ImpulseAssistant\Tools\ToolDefinition;
use ImpulseAssistant\Tools\ToolExecutionContext;
use ImpulseAssistant\Tools\ToolProviderInterface;
use ImpulseAssistant\Tools\ToolResult;
final class ExampleDnsToolProvider implements ToolProviderInterface
{
public function slug(): string
{
return 'example_dns';
}
public function definitions(): array
{
return [
new ToolDefinition(
name: 'dns.zone.summary',
description: 'Read a secret-free summary of DNS zones owned by the signed-in client.',
inputSchema: ['type' => 'object', 'properties' => [], 'additionalProperties' => false],
readOnly: true,
requiresConfirmation: false,
requiredPermissions: ['dns.zones.read'],
),
new ToolDefinition(
name: 'dns.cache.flush',
description: 'Queue a reversible DNS cache refresh for one zone owned by the signed-in client.',
inputSchema: [
'type' => 'object',
'properties' => [
'zone_name' => [
'type' => 'string',
'minLength' => 3,
'maxLength' => 128,
'description' => 'Domain name of the DNS zone.',
],
],
'required' => ['zone_name'],
'additionalProperties' => false,
],
readOnly: false,
requiresConfirmation: true,
destructive: false,
requiredPermissions: ['dns.cache.flush'],
),
];
}
public function execute(string $tool, array $arguments, ToolExecutionContext $context): ToolResult
{
// Always re-verify $context->clientId ownership against your own module state.
if ($tool === 'dns.zone.summary') {
return ToolResult::success('2 active DNS zones healthy.', ['zone_count' => 2]);
}
if ($tool === 'dns.cache.flush') {
if (!$context->confirmed || $context->idempotencyKey === null) {
return ToolResult::failed('Native confirmation and idempotency key are required.');
}
$zone = (string) ($arguments['zone_name'] ?? '');
return ToolResult::success(
sprintf('Queued DNS cache refresh for %s.', $zone),
['zone_name' => $zone, 'queued' => true],
);
}
return ToolResult::notSupported('Unsupported DNS tool.');
}
}
add_hook('ImpulseAssistantToolProviders', 1, static function (): array {
if (!interface_exists(ToolProviderInterface::class)) {
return [];
}
return [
'contract_version' => '1.0',
'providers' => [new ExampleDnsToolProvider()],
];
});