未加星标

Using Bots To Route Customer Requests Based On Sentiment and Emotion

字体大小 | |
[前端(javascript) 所属分类 前端(javascript) | 发布者 店小二03 | 时间 2016 | 作者 红领巾 ] 0人收藏点击收藏

2016: the year where no strategy or vision pitch was complete without mentioning bots.

You can’t watch a tech keynote, scroll through your newsfeed, or be anywhere online without reading how bots are replacing apps , or replacing humans .

Assuming though for just a moment that we don’t turn our every human interaction, from wedding vows to childcare, into an AI driven chat based interaction… we have a question to answer: what is a realistic view of how companies could be using bots today? I’m particularly interested in the possibilities for using bots within a call center (But not as a replacement for humans despite the hype we’re not a fully virtual society quite yet).

Sentiment driven routing

To explore these ideas, I built a call center prototype to look at ways to merge human and bot interaction together. I’ve been chewing on a few questions: Could you have customers chat with a bot first to better determine their intent, and even emotional state, and use that information to connect them to a better matched agent? Could you save the agent time by having the bot capture key information first and inform the agent when they take the interaction? What about handling self-service questions entirely automatically without ever passing the chat to a human agent?

My prototype handles inbound interactions coming in over both SMS and from Twilio’s new Facebook integration , all routed by TaskRouter. I also used Marketplace AddOns for details about the users texting in, along with Meya.ai for the bot platform, and Firebase. The code for this is all available in github , so you can follow along as we go through the architecture.

A customer messaging in ‘hey I could do with some help’ will get routed in a completely different way to someone messaging ‘You guys really suck I can’t believe you still haven’t fixed this’. And someone messaging ‘what are your opening hours?’ doesn’t need to be routed to an agent at all.

Customers messaging in first cause a task to be created in TaskRouter. The Task serves as the primary key for the entire lifecycle of the customer interaction. When the task is created, it sits in a queue waiting to be bot qualified, and my app server connects the messages back and forth with the bot platform. The customer first chats with a bot, which determines their intent and emotional state.

Sending messages related to unqualified tasks to the bot:

client.workspace.tasks(taskSid).get(function(err, task) { attr = JSON.parse(task.attributes); if (!attr.hasOwnProperty('bot_qualified')) { console.log("this task is not yet bot qualified"); console.log("posting to meya with user id " + meyaUserID_string + " and text " + request.body['Body']); req .post('https://meya.ai/webhook/receive/BCvshMlsyFf').auth(meyaAPIKey).form({ user_id: meyaUserID_string, text: request.body['Body'] }) .on('response', function(response) { console.log("got response from meya " + response); }) } else { console.log("this task is already bot qualified"); } });

The Meya bot platform uses an easy scripting interface to storyboard the interactions. It starts by gathering the intent of the first message, and then transitions between different states from there depending on what’s said the sequence will flow through to the next state unless you specify a transition to a different state.

intents: misunderstood: help hi: hi how_are_you: how_are_you help: help whats_up: whats_up who_are_you: who_are_you states: how_are_you: component: meya.text properties: text: I'm good! Thanks for asking! transitions: next: delay whats_up: component: meya.text properties: text: Oh we'rejustchilling. transitions: next: delay who_are_you: component: meya.text properties: text: I'm a bot, I will gather some information first and then pass you to an agent who can help transitions: next: delay hi: component: meya.random_text properties: responses: - Hi :) - Hello, there! - Howdy! - Bonjour. delay: component: al_delay help: component: meya.wit properties: text: How can I help you with British Exports? require_match: false token: <wit.ai token> transitions: angry: angry happy: happy needs_help: needs_help problem: problem service_question: service_question no_match: unsure_state angry: component: intent_checker properties: text: I'm reallysorry. Wouldyoumindif wechat a bitmoreand I canseeif I canhelpmakethingsbetter? emotion: angry return: true happy: component: intent_checker properties: text: I'm glad to hear it. Let me send you a free t-shirt to show our gratitude. :) emotion: happy return: true needs_help: component: intent_checker properties: text: I can definitely help you out. I'm goingto needto askyou a fewmore questions. emotion: needs_help return: true problem: component: intent_checker properties: text: We'll get that fixed ASAP. One moment please. emotion: problem return: true service_question: component: intent_checker properties: text: You'reaskingtherightperson. Letmeaskyou a coupleofquestionsso I cangetyoutheansweryouwant. emotion: service_question return: true unsure_state: component: intent_checker properties: text: Sorry...letmepassyouonto someonewhocanbetterhelpwiththat emotion: unsure return: true

When a bot gets an answer to the question ‘how can i help’, it uses Wit to determine sentiment. Wit is really easy to train from a data set of responses what the intent of the interaction is. The more you train it, the better is is at handling different variations of what the customer might say.


Using Bots To Route Customer Requests Based On Sentiment and Emotion

Once the bot has determined the intent, we’re ready to update the task attributes in TaskRouter to say that the task has been bot qualified, and mark their intent. In this case, it assigns each task to one of the following states: angry, happy, needs_help, problem, service_question, or unsure. To do this, I used the native Twilio integration available within the bot platform Meya.ai, so that my bot logic directly calls the update task API with the new attributes.

from meyaimport Component import re import json from twilio.restimport TwilioTaskRouterClient class IntentChecker(Component): def start(self): account_sid = <accountsid> auth_token = <authtoken> client = TwilioTaskRouterClient(account_sid, auth_token) # read in the response text, and default to empty if invalid or missing text = self.properties.get('text') or "" # meyaUserID=JSON.loads(self.db.user.user_id) meyaUserID = self.db.user.user_id.split('@@') taskSid=meyaUserID[2] task = client.tasks("WS056355824815f89c7cc46e5d8cacaf20").get(taskSid) task_attributes= json.loads(task.attributes) task_attributes['bot_qualified']='true' task_attributes['bot_intent']=self.properties.get('emotion') print task_attributes attribute_string=json.dumps(task_attributes) task = cl

本文前端(javascript)相关术语:javascript是什么意思 javascript下载 javascript权威指南 javascript基础教程 javascript 正则表达式 javascript设计模式 javascript高级程序设计 精通javascript javascript教程

主题: SAPFacebook
分页:12
转载请注明
本文标题:Using Bots To Route Customer Requests Based On Sentiment and Emotion
本站链接:http://www.codesec.net/view/482169.html
分享请点击:


1.凡CodeSecTeam转载的文章,均出自其它媒体或其他官网介绍,目的在于传递更多的信息,并不代表本站赞同其观点和其真实性负责;
2.转载的文章仅代表原创作者观点,与本站无关。其原创性以及文中陈述文字和内容未经本站证实,本站对该文以及其中全部或者部分内容、文字的真实性、完整性、及时性,不作出任何保证或承若;
3.如本站转载稿涉及版权等问题,请作者及时联系本站,我们会及时处理。
登录后可拥有收藏文章、关注作者等权限...
技术大类 技术大类 | 前端(javascript) | 评论(0) | 阅读(32)