From 670ec4f59bd5cb40ee23e4e4a26cba1347bd78c7 Mon Sep 17 00:00:00 2001 From: RockChinQ Date: Fri, 6 Nov 2026 18:18:23 +0800 Subject: [PATCH] =?UTF-8?q?feat(plugins):=20add=20LeadCapture=20(purchase?= =?UTF-8?q?=20intent=20=E2=86=92=20contact=20=E2=86=92=20Resend=20email)?= =?UTF-8?q?=20(#2919)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit New misc plugin langbot-team/LeadCapture 0.1.0 (购买意向留资): - after each AI reply (NormalMessageResponded) a configured LLM judges strong purchase intent against a configurable prompt over the recent conversation (monitoring.messages, read-only) - on strong intent, a fixed contact-request text is appended to that reply, once per bot+user - user messages are then checked for contact details (patterns for CN mobile/landline, email, WeChat; LLM extraction as fallback) - on capture, the full conversation is emailed via Resend (configurable API key, sender, recipients) with a .txt transcript attachment; failed sends are retried on later replies, up to 3 attempts; an optional thank-you is appended to the next reply - every failure is logged and never breaks the conversation Misc plugin CI now uses any plugin's own requirements-dev.txt. Co-authored-by: Claude Opus 5.5 Co-authored-by: multica-agent --- plugins/README.md | 1 + plugins/catalog.json | 7 + plugins/misc/LeadCapture/.gitignore | 4 + plugins/misc/LeadCapture/README.md | 100 +++++ plugins/misc/LeadCapture/SHARED_RUNTIME.md | 5 + plugins/misc/LeadCapture/assets/icon.svg | 1 + .../misc/LeadCapture/components/__init__.py | 0 .../components/event_listener/__init__.py | 0 .../components/event_listener/lead.py | 32 ++ .../components/event_listener/lead.yaml | 27 ++ plugins/misc/LeadCapture/main.py | 387 ++++++++++++++++++ plugins/misc/LeadCapture/manifest.yaml | 114 ++++++ plugins/misc/LeadCapture/pytest.ini | 2 + .../misc/LeadCapture/readme/README_zh_Hans.md | 106 +++++ plugins/misc/LeadCapture/requirements-dev.txt | 6 + plugins/misc/LeadCapture/requirements.txt | 1 + .../LeadCapture/tests/test_lead_capture.py | 323 +++++++++++++++ 17 files changed, 1116 insertions(+) create mode 100644 plugins/misc/LeadCapture/.gitignore create mode 100644 plugins/misc/LeadCapture/README.md create mode 100644 plugins/misc/LeadCapture/SHARED_RUNTIME.md create mode 100644 plugins/misc/LeadCapture/assets/icon.svg create mode 100644 plugins/misc/LeadCapture/components/__init__.py create mode 100644 plugins/misc/LeadCapture/components/event_listener/__init__.py create mode 100644 plugins/misc/LeadCapture/components/event_listener/lead.py create mode 100644 plugins/misc/LeadCapture/components/event_listener/lead.yaml create mode 100644 plugins/misc/LeadCapture/main.py create mode 100644 plugins/misc/LeadCapture/manifest.yaml create mode 100644 plugins/misc/LeadCapture/pytest.ini create mode 100644 plugins/misc/LeadCapture/readme/README_zh_Hans.md create mode 100644 plugins/misc/LeadCapture/requirements-dev.txt create mode 100644 plugins/misc/LeadCapture/requirements.txt create mode 100644 plugins/misc/LeadCapture/tests/test_lead_capture.py diff --git a/plugins/README.md b/plugins/README.md index 7f4f215c1..1549c6f9c 100644 --- a/plugins/README.md +++ b/plugins/README.md @@ -55,6 +55,7 @@ publication. Plugins are not included in Core release artifacts. - [HelloPlugin](misc/HelloPlugin/README.md) - [HumanTakeover](misc/HumanTakeover/README.md) - [KeywordAlert](misc/KeywordAlert/README.md) +- [LeadCapture](misc/LeadCapture/README.md) - [MCBotPlugin](misc/MCBotPlugin/README.md) - [PowerContext](misc/PowerContext/README.md) - [QWeather](misc/QWeather/README.md) diff --git a/plugins/catalog.json b/plugins/catalog.json index eb4474449..03f0ab8f9 100644 --- a/plugins/catalog.json +++ b/plugins/catalog.json @@ -230,6 +230,13 @@ "path": "misc/KeywordAlert", "repository": "https://github.com/langbot-app/LangBot/tree/master/plugins/misc/KeywordAlert" }, + { + "id": "langbot-team/LeadCapture", + "version": "0.1.0", + "category": "misc", + "path": "misc/LeadCapture", + "repository": "https://github.com/langbot-app/LangBot/tree/master/plugins/misc/LeadCapture" + }, { "id": "RockChinQ/MCBotPlugin", "version": "0.1.3", diff --git a/plugins/misc/LeadCapture/.gitignore b/plugins/misc/LeadCapture/.gitignore new file mode 100644 index 000000000..6ab748d2d --- /dev/null +++ b/plugins/misc/LeadCapture/.gitignore @@ -0,0 +1,4 @@ +__pycache__/ +.pytest_cache/ +dist/ +.venv/ diff --git a/plugins/misc/LeadCapture/README.md b/plugins/misc/LeadCapture/README.md new file mode 100644 index 000000000..7e6d14a1d --- /dev/null +++ b/plugins/misc/LeadCapture/README.md @@ -0,0 +1,100 @@ +# Purchase Intent Lead Capture + +Let your AI customer service notice customers who want to buy. After every AI reply, the plugin reads the conversation with a model you choose and against criteria you write, and decides whether the customer has **strong purchase intent**. If so, it appends a contact request to that reply, only once per customer. When the customer leaves a phone number, WeChat ID or email, the plugin sends the **contact details plus the entire conversation with that customer** to your inbox through [Resend](https://resend.com). + +Works for private chats on any platform (WeChat Official Account, WeCom customer service, Telegram, QQ, …). + +## What it looks like + +1. A customer chats with the AI, e.g. "How much is the annual plan? Can you issue an invoice?" +2. After the AI replies, the plugin judges strong intent and appends: "为了更好地为您服务,方便留下您的手机号或微信号吗?我们的顾问会尽快与您联系。" (May we have your phone or WeChat so an advisor can contact you?) +3. The customer replies "138 0013 8000". The plugin recognizes the contact and immediately sends an email: + - subject: `【购买意向】138 0013 8000 · `; + - body: contact, user ID, source bot, the reason for the intent judgment, capture time, first contact time, message count and the full conversation; + - attachment: `conversation-