From 3ab925a7f1884514ac9896d78c2a0913d12312dc Mon Sep 17 00:00:00 2001 From: Philip-Evans Date: Sat, 25 Apr 2026 00:40:09 +0100 Subject: [PATCH] Add Chatwoot plugin and provider Add Chatwoot plugin and provider --- chatwoot/README.md | 12 +++++ chatwoot/config/chatwoot.php | 6 +++ chatwoot/plugin.json | 15 ++++++ chatwoot/src/ChatwootPlugin.php | 47 +++++++++++++++++++ .../src/Providers/ChatwootPluginProvider.php | 44 +++++++++++++++++ 5 files changed, 124 insertions(+) create mode 100644 chatwoot/README.md create mode 100644 chatwoot/config/chatwoot.php create mode 100644 chatwoot/plugin.json create mode 100644 chatwoot/src/ChatwootPlugin.php create mode 100644 chatwoot/src/Providers/ChatwootPluginProvider.php diff --git a/chatwoot/README.md b/chatwoot/README.md new file mode 100644 index 00000000..9e65b38c --- /dev/null +++ b/chatwoot/README.md @@ -0,0 +1,12 @@ +# Chatwoot Widget (by Boy132) + +Adds a Chatwoot live chat widget to all panels for real-time customer support. + +## Features + +- Chatwoot live chat integration +- Configurable through plugin settings + +## Credits + +Original Tawk.to widget by Boy132. Edited by Philip E to work with Chatwoot. diff --git a/chatwoot/config/chatwoot.php b/chatwoot/config/chatwoot.php new file mode 100644 index 00000000..9995ac01 --- /dev/null +++ b/chatwoot/config/chatwoot.php @@ -0,0 +1,6 @@ + env('CHATWOOT_BASE_URL'), + 'website_token' => env('CHATWOOT_WEBSITE_TOKEN'), +]; diff --git a/chatwoot/plugin.json b/chatwoot/plugin.json new file mode 100644 index 00000000..fbaae987 --- /dev/null +++ b/chatwoot/plugin.json @@ -0,0 +1,15 @@ +{ + "id": "chatwoot", + "name": "Chatwoot", + "author": "Boy132 (edited by Philip E)", + "version": "1.0.0", + "description": "Adds a Chatwoot widget to all panels", + "category": "plugin", + "url": "https://github.com/pelican-dev/plugins/tree/main/chatwoot", + "update_url": null, + "namespace": "Boy132\\Chatwoot", + "class": "ChatwootPlugin", + "panels": null, + "panel_version": null, + "composer_packages": null +} \ No newline at end of file diff --git a/chatwoot/src/ChatwootPlugin.php b/chatwoot/src/ChatwootPlugin.php new file mode 100644 index 00000000..8779314a --- /dev/null +++ b/chatwoot/src/ChatwootPlugin.php @@ -0,0 +1,47 @@ +label('Base URL') + ->required() + ->default(fn () => config('chatwoot.base_url')), + TextInput::make('website_token') + ->label('Website Token') + ->required() + ->default(fn () => config('chatwoot.website_token')), + ]; + } + + public function saveSettings(array $data): void { + $this->writeToEnvironment([ + 'CHATWOOT_BASE_URL' => $data['base_url'], + 'CHATWOOT_WEBSITE_TOKEN' => $data['website_token'], + ]); + + Notification::make() + ->title('Settings saved') + ->success() + ->send(); + } +} diff --git a/chatwoot/src/Providers/ChatwootPluginProvider.php b/chatwoot/src/Providers/ChatwootPluginProvider.php new file mode 100644 index 00000000..8102b8af --- /dev/null +++ b/chatwoot/src/Providers/ChatwootPluginProvider.php @@ -0,0 +1,44 @@ + Blade::render(<<<'HTML' + + + + HTML, [ + 'baseUrl' => $baseUrl, + 'websiteToken' => $websiteToken, + ]) + ); + } + } +}