cd /news/ai-agents/when-should-your-shopify-chat-bot-ha… · home › topics › ai-agents › article
[ARTICLE · art-177125] src=dev.to ↗ pub= topic=ai-agents verified=true sentiment=↑ positive

When Should Your Shopify Chat Bot Hand Off to a Human? A Small Rules Engine

A developer published a small, testable JavaScript rules engine for deciding when a Shopify live-chat bot should hand a conversation off to a human agent. The function returns a reason string rather than a boolean — triggered by a customer asking for a person, sensitive-topic keywords, two failed answers, or low bot confidence — so each escalation can be logged, and it falls back to collecting contact details when the team is offline. The writeup recommends sending the chat transcript with every transfer and reviewing the top handoff reasons weekly.

recommendation

Trigger handoff on an explicit human request, sensitive-topic keywords, two failed answers or low confidence, return the reason for logging, and send the transcript with the transfer.

more in playbook: Designing agent systems
by read1 min views6 publishedNov 27, 2026

When Should Your Shopify Chat Bot Hand Off to a Human? A Small Rules Engine

A live chat AI app is only as good as its handoff. Here's a small, testable function that decides when to pass a chat to your team, and what to do if nobody is online.

function shouldHandOff({ message, failedAnswers, botConfident }) {

  if (ASKS_HUMAN.test(message)) return 'customer asked';

  if (ESCALATE_WORDS.test(message)) return 'sensitive topic';

  if (failedAnswers >= 2) return 'bot failed twice';

  if (!botConfident) return 'low confidence';

  return null;

}

Returning a reason instead of true means you can log why each chat escalated.

Adjust the days and hours to your team's schedule.

if (isOnline()) {

    return { action: 'transfer', reason, transcript: chat.history };

  }

  return {

    action: 'collect_contact',

    reason,

    reply: 'Our team is offline right now. Leave your email or phone and we will reply by 11 AM tomorrow.',

  };

}

Always send the transcript with the transfer so shoppers don't repeat themselves.

Quick tests

javascript

console.log(shouldHandOff({ message: 'My order arrived damaged', failedAnswers: 0, botConfident: true }));

// 'sensitive topic'

console.log(shouldHandOff({ message: 'What is the delivery time?', failedAnswers: 0, botConfident: true }));

// null

Tips

Log every handoff reason and review the top ones weekly.

Don't promise a reply time your team can't keep.

Keep the "talk to a person" option visible, not only automatic.

If the shopper writes in an angry tone, escalate early.

── more in #ai-agents 4 stories · sorted by recency
── more on @shopify 3 stories trending now
sponsored brought to you by zahid.host 4,200+ EU-deployed projects
reading about agents? ship yours in a single git push.

Run your AI side-project on zahid.host

EU-based hosting, git-push deploys, automatic HTTPS, no cold starts. Free tier with a custom domain — perfect for shipping the agent you just read about.

$git push zahid main
→ Live at https://your-agent.zahid.host ✓
Get free account → Pricing
from €0/mo · no card required
LIVE [news/when-should-your-sho…] indexed:0 read:1min 2026-11-27 · —