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

> Source: <https://dev.to/aylelite_fdb8fce6a0f4ce96/when-should-your-shopify-chat-bot-hand-off-to-a-human-a-small-rules-engine-3j9k>
> Published: 2026-11-27 06:39:39+00:00

**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 the playbook "Designing agent systems": <https://wpnews.pro/playbooks/agent-architecture>

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.
