Build a Claude Support Bot with 59API
Start with a narrow support workflow
A useful customer-support bot should solve a defined set of problems before it attempts to answer everything. Start by listing your top support categories, such as order status, account access, refunds, billing questions, and product setup. For each category, collect approved answers, links to documentation, escalation rules, and examples of questions the bot should not answer.
Define a clear success condition: for example, the bot should resolve common questions in two or fewer turns, cite the relevant help article, and hand off sensitive or uncertain cases to a human. This scope gives you a practical test set and prevents an overly broad system prompt from becoming difficult to maintain.
Connect your application to Claude through 59API
59API provides a low-cost, pay-as-you-go relay for Claude and GPT models. It is compatible with Claude-style requests, OpenAI SDK integrations, Claude Code, and Codex, so you can keep your application architecture flexible while choosing the model that fits each task.
Set your API base URL to https://api.59api.com and store your 59API key in a server-side environment variable such as SUPPORT_API_KEY. Never expose this key in browser JavaScript. Your backend should call the Claude Messages API with the appropriate authentication headers, the Anthropic API version header required by the endpoint, and a JSON body containing the selected model, system instructions, conversation messages, and maximum output tokens.
Choose a current model identifier from the 59API documentation or dashboard rather than hard-coding an outdated name. Haiku is a sensible starting point for high-volume FAQ replies, Sonnet is useful when answers require stronger reasoning, and Opus can handle unusually complex cases. 59API also provides access to Fable and GPT options, letting you compare quality and cost without rewriting your support layer.
Design the support prompt
Keep the system instruction operational rather than promotional. Tell Claude that it is a support assistant, identify the company and product, define the permitted knowledge sources, and specify what to do when information is missing. A reliable instruction might require the bot to answer only from the supplied support content, say when it is unsure, avoid inventing policies, and ask for one missing detail at a time.
Include explicit safety rules. The bot should not request passwords, full payment-card numbers, authentication codes, or unnecessary personal data. It should not approve refunds or change account ownership unless your backend has verified the user and a permitted tool has completed the action. Require a human handoff for threats, legal complaints, suspected fraud, account lockouts, and repeated low-confidence answers.
Add knowledge and conversation state
For a small launch, place a curated set of frequently used answers in the system context or retrieve the most relevant articles before each request. Keep articles short, dated, and identified by title or URL so the bot can provide useful references. As the knowledge base grows, use search or embeddings to retrieve a small context window instead of sending your entire documentation set on every call.
Store conversation history on your server with a customer or ticket identifier. Send only the recent turns and the relevant support content to Claude. Summarize older messages when a conversation becomes long. This reduces latency and token costs while preserving the details needed for a correct reply.
Implement guardrails, tools, and handoff
Keep read-only answers separate from actions. For order status, your backend can verify the authenticated customer and retrieve an order record before Claude writes the response. For refunds or account changes, require an explicit confirmation step and enforce authorization in application code. Never rely on the model alone to decide whether an operation is allowed.
When Claude cannot answer confidently, return a structured handoff event from your application. Include the conversation summary, category, customer identifier, and attempted answer in your helpdesk ticket. Show the customer a clear message such as, We are sending this to a support specialist, rather than exposing internal prompts or raw API errors.
Test quality and control cost before launch
Create a test set containing normal questions, misspellings, contradictory information, prompt-injection attempts, angry customers, and requests for restricted data. Check factual accuracy, citation quality, refusal behavior, escalation timing, latency, and token usage. Review failed conversations manually and update the knowledge articles or routing logic instead of endlessly expanding the prompt.
Use Haiku for routine classification and simple answers, then route complex conversations to Sonnet or Opus only when needed. Set maximum output tokens, trim irrelevant history, cache stable documentation, and record model, latency, token counts, outcome, and escalation reason. Because 59API uses pay-as-you-go pricing and native official-quality models rather than downgraded substitutes, it is a practical way to test this routing strategy at low cost. If you are ready to prototype, sign up for 59API and start with a small, measurable support queue; its referral rebate can also reduce ongoing experimentation costs.
Prêt à commencer ?
Connectez Claude et GPT en quelques minutes aux prix les plus bas, sans bridage. Inscrivez-vous pour votre clé API.
Inscription gratuite