A customer messages you at 10 p.m., nobody is on shift, and by morning they have bought from a competitor. For most small businesses the bottleneck is not product or price but the hours when nobody can answer. An AI assistant can cover those hours, but only if it has a solid knowledge base and a clear path to hand conversations over to a human.
This guide walks through building an AI customer support assistant that customers can actually trust: what to prepare before choosing a tool, how to write the instructions, when a conversation must go to a person, and how a developer can wire it into a Laravel app with a webhook.
Start by Sorting Your Conversations
Export your last 100 support conversations from email, live chat, or WhatsApp and group them. For a typical online shop or service business, you will see something like the following (an illustration, not research data):
- Information questions: opening hours, shipping rates, sizing, stock. The best fit for AI.
- Order status: "where is my package?" A good fit if the AI can read order data from your system.
- Complaints and returns: damaged or wrong items. The AI can collect the order number and photos, but a human decides.
- Negotiations and special requests: bulk pricing, custom orders. Route straight to a human.
If most of your volume sits in the first two groups, automation will pay off quickly. If complaints dominate, fix the underlying operations first; an AI will only deliver those complaints faster.
Building an Assistant Step by Step
- Write the knowledge base. One document covering FAQs, return policy, shipping zones, payment methods, and hours. One topic per paragraph, plain language.
- Define what the AI may not do. No discounts, no refund approvals, no guaranteed delivery dates. Put this in writing.
- Write the system prompt, the assistant's standard operating procedure. An example follows below.
- Connect one channel first, usually the busiest one: website chat, WhatsApp, or Messenger.
- Build the handoff. When the AI is unsure or the customer asks for a person, flag the thread and notify staff.
- Test with 30 to 50 real questions from your archive. When an answer is wrong, fix the knowledge base first, not just the prompt.
- Review weekly. Read a sample of conversations and add every unanswered question to the knowledge base.
A Reusable System Prompt
This template works with most large language model providers. Replace the bracketed parts.
You are the customer support assistant for [Store Name], which sells [products].
Tone: friendly, concise, no more than 3 sentences per reply.
Rules:
1. Answer ONLY from the KNOWLEDGE BASE below.
2. If the answer is not there, say you will pass the question to the team
and end your reply with the token [HANDOFF].
3. Never promise discounts, refunds, or exact delivery dates.
4. If the customer is upset, reports a damaged item, or asks for a human,
ask for their order number and end with [HANDOFF].
5. Never ask for passwords, one-time codes, or full card numbers.
KNOWLEDGE BASE:
[paste FAQs, policies, shipping table, hours]
The [HANDOFF] token gives your code an unambiguous signal instead of guessing from the wording.
Implementation Options Compared
| Option | Best for | Pros | Cons |
|---|---|---|---|
| Built-in auto-replies (email, WhatsApp Business, Messenger) | Very small businesses | Free, no setup | Static templates, not real AI |
| Hosted support platforms with AI (e.g. Intercom, Zendesk, Tidio) | Teams without developers | Fast launch, dashboards, analytics | Monthly per-seat or per-resolution fees |
| Custom build: LLM API plus your own app and messaging API | Businesses with a developer or existing app | Reads live order data, full control | You own maintenance, logging, security |
For Developers: A Laravel Webhook
If your shop already runs on Laravel, the assistant can answer order-status questions with real data. The flow: the messaging provider posts a webhook, Laravel queues the message, a job calls the model, and the reply goes back out. Queueing matters because an AI call can take several seconds while the webhook must respond immediately.
// routes/api.php
Route::post('/webhook/chat', [ChatWebhookController::class, 'handle']);
// app/Http/Controllers/ChatWebhookController.php
public function handle(Request $request)
{
abort_unless(
hash_equals(config('services.chat.secret'), (string) $request->header('X-Webhook-Secret')),
403
);
ReplyWithAi::dispatch(
customerId: $request->input('from'),
text: Str::limit($request->input('message'), 1000),
);
return response()->json(['ok' => true]);
}
// app/Jobs/ReplyWithAi.php (core of handle())
$order = Order::where('contact', $this->customerId)->latest()->first();
$context = $order
? "Latest order #{$order->code}: status {$order->status}, tracking {$order->tracking_no}."
: 'Customer has no orders yet.';
$reply = $ai->chat(system: $systemPrompt, user: $context . "\n\n" . $this->text);
if (str_contains($reply, '[HANDOFF]')) {
Conversation::markNeedsHuman($this->customerId);
$reply = str_replace('[HANDOFF]', '', $reply);
}
$messenger->send($this->customerId, trim($reply));
Two details people skip: verify the webhook with a shared secret so nobody can inject fake messages, and only ever pass the AI data that belongs to the sender. For the queue side, see Laravel queues and jobs for heavy tasks; for hardening, see 10 web application security best practices.
Common Mistakes and Fixes
The assistant invents answers
Usually the prompt does not restrict sources, or the knowledge base has gaps. Add the "answer only from the knowledge base" rule, fill the gaps, and lower temperature to around 0.2 for consistency.
Customers get stuck in a loop
Make words like "agent" or "human" trigger an instant handoff. Outside business hours, be honest: "Our team will reply tomorrow from 9 a.m."
API costs creep up
Send only the last few messages of history, truncate very long inputs, use a smaller model for FAQ-type traffic, and set a monthly spending cap in your provider dashboard.
Personal data ends up in logs
Mask addresses, IDs, and payment details before storing transcripts, and set a retention period such as 90 days. Check what your privacy policy promises customers.
Pre-Launch Checklist
- The knowledge base covers at least your 20 most frequent questions.
- The system prompt states limits and handoff rules.
- Typing "human" or "agent" always reaches a person.
- Handoff alerts reach staff phones (Slack, email, or a dashboard).
- Customers are told they are chatting with an automated assistant.
- At least 30 real archived questions have been tested.
- One named person owns the weekly review.
Measuring Whether It Works
Track four numbers: share of conversations resolved without handoff, time to first reply, handoffs per day, and orders placed outside business hours. Compare the month before and after launch. A handoff rate that stays high after a month usually means the knowledge base is thin, not that AI is the wrong tool.
Support automation works best when it is connected to the rest of your operations, such as stock and order data; how to digitize a small business with an information system covers that foundation. Developers who want a head start can build the order side on one of the Laravel source code packages available at GudangCode and plug the assistant in afterwards.