- Home
- Skills
- Sales & Lead Gen
- AI Lead Chatbot
AI Lead Chatbot
Convert site visitors into qualified leads with an embeddable AI chatbot, Prisma integration, and security guardrails.
$9.99
AI Lead Chatbot
Example session with this skill installed
Implement a lead qualification chatbot for a web development agency. We use Prisma and want to store leads with a source tag. Use OpenAI as the provider.
- Read your context and instructions
- Compiled the ai lead chatbot
I have implemented the AI sales chatbot system, including the provider-agnostic adapter, the streaming API route with Zod validation, and the Prisma-backed lead extraction logic.
Implementation Details
Provider Adapter
// src/lib/ai/provider.ts
import { OpenAI } from 'openai';
const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY });
export async function generateChatReply(messages: any[], systemPrompt: string) {
const response = await openai.chat.completions.create({
model: 'gpt-4-turbo-preview',
stream: true,
messages: [{ role: 'system', content: systemPrompt }, ...messages],
max_tokens: 500,
});
return response;
}
Lead Capture API
// src/app/api/chat/route.ts
import { db } from '@/lib/db';
import { z } from 'zod';
const ChatSchema = z.object({
visitorId: z.string(),
messages: z.array(z.object({
role: z.enum(['user', 'assistant']),
content: z.string().max(1000)
})).max(15)
});
export async function POST(req: Request) {
const body = await req.json();
const { visitorId, messages } = ChatSchema.parse(body);
// Logic to extract LeadPayload and upsert to Prisma
const lead = await db.lead.upsert({
where: { email: extractedEmail },
update: { lastInteraction: new Date() },
create: {
email: extractedEmail,
source: 'AI_CHATBOT',
score: calculateScore(extractedData)
}
});
return new Response(stream);
}
Next steps
- Add
LLM_PROVIDER="openai"andOPENAI_API_KEYto your.envfile. - Run
npx prisma generateto ensure theLeadandChatSessionmodels are synced. - Import
<LeadChatWidget />into your root layout file.
Connects securely to your tools. The creator never sees your data.
About this skill
Static contact forms fail to engage high-intent visitors before they bounce. This skill builds a production-ready AI sales assistant that qualifies leads through conversation and syncs them to your database.
What it does
- Multi-provider support via an LLM adapter for OpenAI, Anthropic, or Gemini.
- Automated qualification by extracting name, email, budget, and timeline from chat.
- Database integration using Prisma/PostgreSQL to persist sessions and leads.
- Security guardrails to prevent prompt injection and keep keys server-side.
- Lead scoring that calculates a 0-100 priority score for every captured lead.
- Accessible UI featuring a floating React widget with keyboard shortcuts and ARIA support.
How it works
- Initialize the adapter in
src/lib/ai/provider.tsusing server-side environment variables. - Configure the system prompt with strict business-only scope and injection defenses.
- Deploy the chat route at
/api/chatwith Zod validation and IP-based rate limiting. - Embed the widget using
LeadChatWidget.tsxwith quick-reply starter chips.
Frameworks & tools
Built for TypeScript environments using Prisma ORM, Zod for schema validation, and React for the frontend. Works with any standard LLM provider via a unified adapter pattern.
Why this beats prompting it yourself
Prompting alone doesn't handle session persistence, rate limiting, or data extraction into a relational database. This skill provides the architectural plumbing required to run a sales bot in production without exposing your API keys or leaking system instructions.
Use cases
- Qualify inbound agency leads before they book a discovery call.
- Provide 24/7 pricing and feature support for a SaaS landing page.
- Capture visitor intent and store it directly in a custom CRM.
- Reduce form abandonment by offering a conversational alternative.
Known limitations
Requires an existing Prisma schema or PostgreSQL database for lead storage. Message history is capped at the last 15 turns to maintain performance.
How to use
- 1
Connect your agent to the Agensi MCP
Copy the prompt and paste it into Claude, ChatGPT, Cursor or any agent that supports MCP. It sets up the connection for you. Manual setup
- 2
Sign in to Agensi
Your agent shows a sign-in link. Sign in and click Allow.
- 3
Ask for what you need
Your agent loads this skill and uses it on your task. It always asks before buying a skill.
Reviews
No reviews yet
Be one of the first to try it. Every listed skill goes through the trust checks below.
Security scanned
Checked by our 8-point scan before listing
Fresh listing
Recently published to Agensi
Money-back guarantee
Doesn't do what its page promises? You get your money back.
Trust & safety
Security scan
Security scan passed 8 days ago
- Software
- tsc
Node.jstyprscriptprisma
Permissions
What's inside
Frequently Asked Questions
New in Sales & Lead Gen
Find more skills like this on the Claude Skills Marketplace, the Codex Skills Marketplace and the Gemini Skills Marketplace, or browse Claude Skills for Sales & Lead Gen.