View .md

ChatbotEvent events

2 FeatherPanel plugin events on ChatbotEvent (2 emitted by the core): the event names, the arguments each listener gets, where they fire and a PHP listener for each.

Last synced from FeatherPanel 15b94e9 on .

On this page

Part of the plugin events reference. Listeners get the payload values as positional arguments in the order shown, cannot cancel the action, and must catch their own exceptions.

Setup

Import ChatbotEvent in your entry class and register listeners in processEvents():

<?php

namespace App\Addons\myplugin;

use App\App;
use App\Plugins\AppPlugin;
use App\Plugins\PluginEvents;
use App\Plugins\Events\Events\ChatbotEvent;

class MyPlugin implements AppPlugin
{
    public static function processEvents(PluginEvents $event): void
    {
        $event->on(ChatbotEvent::onConversationDeleted(), function ($userUuid, $conversationId): void {
            App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:chatbot:conversation:delete ' . json_encode(['user_uuid' => $userUuid, 'conversation_id' => $conversationId]));
        });
    }

    public static function pluginInstall(): void
    {
    }

    public static function pluginUninstall(): void
    {
    }
}

ChatbotEvent::onConversationDeleted()

Name: featherpanel:chatbot:conversation:deleteemitted at 2 sitesCancel or modify: nodefinition

Docblock: string user uuid, int conversation id.

#Payload keyListener parameterType
1user_uuid$userUuidstringfrom docblock
2conversation_id$conversationIdint
When it fires (2 sites)
$event->on(ChatbotEvent::onConversationDeleted(), function ($userUuid, $conversationId): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:chatbot:conversation:delete ' . json_encode(['user_uuid' => $userUuid, 'conversation_id' => $conversationId]));
});

ChatbotEvent::onConversationMemoryUpdated()

Name: featherpanel:chatbot:conversation:memory:updateemitted at 2 sitesCancel or modify: nodefinition

Docblock: string user uuid, int conversation id, string memory.

#Payload keyListener parameterType
1user_uuid$userUuidstringfrom docblock
2conversation_id$conversationIdint
3memory$memorystringfrom docblock
When it fires (2 sites)
$event->on(ChatbotEvent::onConversationMemoryUpdated(), function ($userUuid, $conversationId, $memory): void {
    App::getInstance(true)->getLogger()->info('[myplugin] featherpanel:chatbot:conversation:memory:update ' . json_encode(['user_uuid' => $userUuid, 'conversation_id' => $conversationId, 'memory' => $memory]));
});