Skip to main content

Build a customer support bot

An avatar that answers from your help documentation and hands transcripts back for review.

This walkthrough builds a support avatar end to end: pick a face, give it your help documentation, shape how it behaves, put it in front of users, and read back what it said.

Budget about 30 minutes. You need an API key — see Authentication.

Every request needs your API key. Set it once:

export GOLDENENGINE_API_KEY="<YOUR_API_KEY>"

1. Pick an avatar​

A stock avatar is the quickest starting point: it is ready immediately. Its persona is fixed, though — step 4 covers what that rules out — so a bot confined to your documentation eventually means an avatar you own. The other steps work with either, with one difference in step 3.

cURL
curl -s "https://backend.goldenengine.ai/v1/avatars/stock" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

Pick one whose status is ready and keep its id:

export AVATAR_ID="<id from the response>"

2. Upload your help documentation​

Attach your support material directly to the avatar. PDF and DOCX, up to 50 MB per file, and up to five files in one request:

cURL
curl -s "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/knowledge/batch" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY" \

A 201 means all three were queued. If any file fails validation — wrong type, empty, over 50 MB — the whole request is rejected with 400 and nothing is queued; the message names the file. A 207 is different: every file was valid, but at least one could not be stored or queued on our side (upload_failed or queue_unavailable in results, which come back in the order you sent them). Nothing is wrong with that file — re-send it on its own; the others are already processing.

Extraction is asynchronous. Wait for everything to reach completed:

cURL
curl -s "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID/knowledge" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

3. Verify retrieval before going live​

Search the knowledge directly, using questions your users actually ask. This isolates retrieval from the model.

cURL
curl -s "https://backend.goldenengine.ai/v1/knowledge-bank/search" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{"query": "how long do refunds take", "limit": 5}'

Empty or irrelevant results here will be empty or irrelevant in conversation too. Fix the documents now — it is much harder to diagnose once a language model is in the loop.

POST /v1/knowledge-bank/search covers your account-level documents, and that is where documents uploaded to a stock avatar are stored — so everything from step 2 is in scope. They stay in your account bank but answer only for the stock avatars you attached them to. Documents attached to an avatar you own are not searched; for those, list GET /v1/avatars/{avatar_id}/knowledge to confirm each document is there, completed, and has a sensible chunk_count, then test with a real conversation.

4. Shape the behavior​

A support avatar needs tighter behavior than a general one: stay on topic, answer from the documentation, and hand off rather than guess. You do not write its system prompt — the API generates it from the avatar's persona fields — so you shape it through those fields, plus one switch.

cURL
curl -s -X PATCH "https://backend.goldenengine.ai/v1/avatars/$AVATAR_ID" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"bio": "Support agent for Acme. Helps customers with orders, refunds, and account questions in two or three sentences, and offers to connect them with a human whenever the documentation does not cover the question.",
"interaction_guardrails": [
"Stay on topic",
"Base answers only on provided material",
"Keep responses professional"
],
"web_search_enabled": false
}'

web_search_enabled is on by default: an avatar can look things up on the web when a question needs current facts. For a bot that should answer only from your documentation, turn it off — otherwise a question your documents do not cover may get an answer from the web instead of a hand-off.

interaction_guardrails come from a fixed list; the accepted values are on the request body in the API reference. They are written into the prompt as guidance, not enforced separately. Enforcement is the job of the response guardrail, which checks every sentence before it is spoken: for a support bot, set guardrail_fallback_line to a hand-off ("I can't help with that here — I'll connect you with the team.") and put competitor names or promises you never make in guardrail_blocked_words.

The bio is free text, so it is where the rest goes:

  • Length. Spoken answers run long. A paragraph that reads fine takes 30 seconds to hear.
  • Escalation. Say what the avatar should do when the documentation does not cover the question. Without that, models tend to produce a plausible answer rather than admitting the gap — which is exactly the failure mode that costs you trust.

Changing any persona field (name, bio, awards_achievements, known_for, personality_traits, interaction_guardrails) regenerates the prompt through a model call, so the request can return 502; retry it. Lists replace the current value rather than adding to it, and so does knowledge_base_ids — send the complete set of documents you want the avatar to keep. system_prompt itself is read-only: sending it returns 422.

5. Start sessions from your support page​

Create the conversation when the user clicks to start — not on page load, since the session token expires after 60 minutes.

cURL
curl -s "https://backend.goldenengine.ai/v1/conversations" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"avatar_id": "'"$AVATAR_ID"'",
"end_user_id": "cust-42",
"title": "Support — web widget",
"greeting": "Hi! I can help with orders, refunds, and account questions. What do you need?"
}'

The avatar must be ready: one that is still training, or that your key cannot use, returns 404. The response carries conversation_id and conversation_url. Keep the ID; step 6 uses it:

export CONVERSATION_ID="<conversation_id from the response>"

A specific greeting outperforms a generic one. Naming what the avatar can help with steers users toward questions your documentation actually answers.

end_user_id is the customer's ID in your own system. It gives each customer a memory of their own: the avatar starts their next session knowing what came before — written shortly after the previous session ended, so one that starts immediately may not see it yet — and never carries one customer's details into another's. For a visitor you cannot identify, leave it out and the session gets isolated memory. See Memory and end users.

Memory is kept per avatar, too: switch the bot to a different avatar and every customer starts with an empty memory. Two memory calls are worth wiring into a support bot — see Memory for both:

  • Forget a customer. When a customer asks you to delete their data, DELETE /v1/avatars/{avatar_id}/memory?end_user_id=cust-42 removes what the avatar remembers about them. Their conversations and transcripts stay — DELETE /v1/conversations/{conversation_id} removes those.
  • Tell it what you already know. A pinned memory — POST /v1/avatars/{avatar_id}/memory/pinned — hands the avatar a fact from your own records, such as the customer's plan, before their first conversation.

Render the returned conversation_url in an iframe on your support page — see Embed an avatar for the iframe attributes and the click-to-start pattern.

6. Review transcripts​

Every conversation is recorded and readable afterwards — this is your feedback loop.

cURL
curl -s "https://backend.goldenengine.ai/v1/conversations?limit=50" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

curl -s "https://backend.goldenengine.ai/v1/conversations/$CONVERSATION_ID/transcript" \
-H "X-Api-Key: $GOLDENENGINE_API_KEY"

To pull one customer's history, add end_user_id to the list call: GET /v1/conversations?end_user_id=cust-42.

Read transcripts weekly and look for two patterns. Questions the avatar could not answer are gaps in your documentation — the fix is a new document, not a prompt change. Questions it answered wrongly are usually retrieval problems; run them through POST /v1/knowledge-bank/search to see what it was working from. That covers documents on a stock avatar or your account; for an avatar you own, check GET /v1/avatars/{avatar_id}/knowledge instead — search does not reach its documents.

Going further​