News Categories

Chatbots made easy with Amazon AI services

By Michael Low - on 25 May 2017, 4:00pm

Chatbots made easy with Amazon AI services

Eno is a SMS chatbot that enables Capital One account holders to check their account balances, pay credit card bills, and check available credit in a conversational manner.

Keeping customers happy is an important part of every business, and happy customers will be willing to spend more and share their experience with others. While it's not feasible for all businesses to offer 24/7 customer service in the form of outsourced phone support or social media management, many industries have begun using chatbots to engage with their customers in various ways. Whether it's to improve brand engagement or encourage online purchases, advancements in artificial intelligence (AI) enable these conversational assistants to simulate human conversation both text and synthesized voice – when interacting with customers. Humanizing brand engagement, for short.

Last year, Amazon Web Services (AWS) unleashed a trio of AI services "for any developer to harness high-quality AI capabilities  that are scalable and cost-effective without the need to build deep learning algorithms and create machine learning models from scratch." Since then, a growing number of AWS customers have integrated Lex, Polly, and Rekognition into their applications or infrastructure – with positive results. NASA, for example, utilizes Amazon Lex to inspire students and potential future explorers through Rov-E, a star robotic ambassador that can field questions about NASA's Mars exploration program via voice commands. Popular language-learning platform Duolingo, on the other hand, praised Amazon Polly for delivering high-quality voices that are "as good as natural human speech". As for Amazon Rekognition, the U.S.-based C-SPAN network was able to reduce the indexing of video content from 7,500 hours a year to 3,500 hours a year, as well as tag 97,000 known speaking individuals in less than two hours.

To better understand the process behind chatbot creation, we were given a tutorial on making a Facebook Messenger chatbot that runs on Amazon's fully managed AI services. In line with AWS' pay-as-you-go model, you only pay for what you use. With Lex, you are charged US$0.004 per voice request, and US$0.00075 per text request. As for Polly, you are charged US$4.00 per one million characters for speech requests, and equal amount for Speech Marks requests, but they can be cached and replayed at no additional cost. Free tier options are available for new users for the first year.

It started simple, with the creation of a custom bot using Amazon Lex from the AWS Management Console. For this exercise,  we opted to simulate a coffee shop's ordering chatbot. In the newly-created 'OrderCoffee' intent, three sample utterances were added that will serve as trigger phrases for the bot, which will then prompt the customer to specify the coffee drink and preferred temperature that we've added to Slots. A confirmation prompt follows, before the drink order is (theoretically) placed into the system, or canceled altogether.

We then hit the Build button, which allows us to test the chatbot in a pop-up window not unlike the ones on Facebook Messenger. Once satisfied, we hit Publish and moved on with Facebook integration. Else, you can choose to connect the bot to your mobile app, AWS Mobile Hub, Slack, or other services. We pointed our Facebook account to create a new Facebook Page named 'DEMO Coffeehouse Chatbot', with the Page type being 'Cause or Community'.

With that settled, we opened a new tab to the Facebook Developer Portal to get started on the webhook and bot integration. Part of this involved linking the Page Access Token and App Secret Key generated by the Messenger platform to the Facebook integration page found on the Amazon Lex console. Once activated, this creates the Endpoint URL needed for setting up the webhook. Back to the Facebook Developer Portal, we inserted the URL as Callback URL, along with the Verify Token and relevant Subscription Fields. This, in turn, completes the handshake between Facebook and Amazon Lex.

All that's left to enable webhooks integration is to subscribe to the 'DEMO Coffeehouse Chatbot' Facebook page.

The same chatbot will now take your coffee orders directly from Facebook Messenger.

What you just saw was just the starting point for a conversational, intelligent assistant. The key to Amazon's AI services is analyzing and learning from massive quantities of data, resulting in continually improving automatic speech recognition (ASR) and natural language understanding (NLU) models that developers can leverage to build smarter apps with humanlike intelligence.