Skip to content

Chat lead capture, webhooks, and action signals - #208

Merged
HardeepAsrani merged 47 commits into
developmentfrom
feat/issue-192
Aug 3, 2026
Merged

Chat lead capture, webhooks, and action signals#208
HardeepAsrani merged 47 commits into
developmentfrom
feat/issue-192

Conversation

@HardeepAsrani

@HardeepAsrani HardeepAsrani commented Jul 18, 2026

Copy link
Copy Markdown
Member

Adds lead capture and outgoing webhooks to the chat, and a generic "action signals" mechanism the chatbot uses to decide when to surface them. Closes https://github.com/Codeinwp/hyve/issues/168 and https://github.com/Codeinwp/hyve/issues/192.

Pro PR: https://github.com/Codeinwp/hyve/pull/268
Agent PR: https://github.com/Codeinwp/agents/pull/136

Everything here is a Pro feature. This plugin holds the widget-side pieces and the free-tier upsell shells; the functional/server code lives in the Hyve Pro PR (linked below). The platform-side change for Hyve Connect is in the agents PR (also linked).

What it does

Lead capture. Visitors can leave their details through a contact form inside the chat. Admins build the form field by field (label, type, required, reorder) and choose when it appears:

  • Before the chat starts, with an optional "required to continue" gate.
  • When the bot can't answer a question.
  • When the visitor asks to talk to a human.

Submissions are stored on the site as leads, linked both ways to the conversation they came from, and the transcript shows a "Visitor submitted the contact form" marker at the point it happened. Admins review leads in a Leads tab under Messages (with CSV export), and a conversation that produced a lead is badged in the list.

Webhooks. Chat activity can be sent to any URL as JSON, as it happens: visitor messages, bot replies (with whether the question was answered), and actions (the contact form today, more later). Each request is signed with an HMAC X-Hyve-Signature header, delivery is non-blocking so a slow endpoint never delays the chat, and admins pick which events to send so metered tools like Zapier only receive what they use. Payloads are raw JSON, so the settings copy notes that Slack incoming webhooks need Zapier/Make/n8n in between.

Action signals. Rather than hardcoding "detect a contact request", the model is given a generic list of signals (a type and a plain-English description) and returns which apply. The widget maps each returned signal to an action it knows how to handle, and unknown ones are ignored. Adding a new action type later is a one-line change on the server; the widget and the platform don't need to change. The contact form is the first signal.

How it's split

  • Widget (this plugin): the form UI, the three triggers, the action dispatcher, and the transcript event row. The form only renders when Pro injects its config, which is license-gated.
  • Upsell shells (this plugin): the Leads settings panel, the Leads tab, and the Webhooks card show the disabled preview + upsell for free users, matching the rest of the dashboard.
  • Engine (Hyve Pro): leads storage, the submission route, the webhook engine, the signal registry, and all settings.
  • Connect parity (agents): the platform builds the same signal-detection schema from the descriptions it's sent, so Connect users get the human-ask trigger too.

Manual QA

Needs an active Pro license. In Settings, Chat, Leads: turn on Collect leads and pick some triggers.

  1. Form + storage: open the chat, trigger the form (ask the bot something it can't answer, or say "I want to talk to a human"), submit it. Confirm the thank-you bubble, that the lead appears under Messages, Leads, and that opening the source conversation shows the event marker and a lead badge.
  2. Triggers: with the pre-chat trigger on, confirm the form shows before the first message and that "required" locks the input until it's submitted or skipped. Confirm a submitted or declined form isn't re-offered, and that Clear Conversation re-arms it.
  3. Form builder: add/remove/reorder fields and change types; confirm the widget reflects them and that the "needs an email or phone field" notice behaves.
  4. Webhooks (Settings, Integrations, Webhooks): point the URL at a request bin (e.g. webhook.site; note that localhost/private IPs are rejected), select events, save. Confirm user_message/bot_message/action arrive with the documented shape and a valid signature, and that submitting a form sends an action event with the full transcript.
  5. Free tier: deactivate Pro and confirm the Leads panel, Leads tab, and Webhooks card show the upsell preview.

Unit tests cover the submission pipeline, webhook delivery and signing, the signal schema/mapping, and the threads lead badge.

HardeepAsrani and others added 13 commits July 16, 2026 15:06
Generate a persistent per-site token and send it as X-Site-Token so the
platform can bind a free site's identity without a license key.
# Conflicts:
#	src/backend/screens/Dashboard.js
#	src/backend/style.scss
#	src/backend/utils.js

Co-authored-by: HardeepAsrani <2649903+HardeepAsrani@users.noreply.github.com>
@github-actions

github-actions Bot commented Jul 18, 2026

Copy link
Copy Markdown

Plugin build for 6afad28 is ready 🛎️!

@HardeepAsrani
HardeepAsrani changed the base branch from feat/connect to development August 3, 2026 13:28
@HardeepAsrani

Copy link
Copy Markdown
Member Author

@copilot resolve the merge conflicts in this pull request

Co-authored-by: HardeepAsrani <2649903+HardeepAsrani@users.noreply.github.com>

Copilot AI commented Aug 3, 2026

Copy link
Copy Markdown

@copilot resolve the merge conflicts in this pull request

Resolved the merge conflicts and pushed the merge-resolution commit 334db1f.

@HardeepAsrani
HardeepAsrani merged commit 9673721 into development Aug 3, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants