Cloud Methodologies for A Seamless Integrated Chatbot

Download Full-Text PDF Cite this Publication

Text Only Version

Cloud Methodologies for A Seamless Integrated Chatbot

Sharan Kumar Paratala Rajagopal

IEEE Member

Senior Manager, Capgemini America, Inc.

Dallas, Texas, USA

AbstractThis research paper provides details of connecting Amazon connect to Amazon pinpoint to send SMS and also provides some insights on how it can be integrated with social platforms such as Facebook messaging and WhatsApp. Amazon Lex can be leveraged as standalone bot on the website or can be triggered from Amazon connect for Intelligent voice responses.

KeywordsAmazon Lex, Amazon Connect, Amazon Pinpoint, WhatsApp, Facebook Messaging.

  1. INTRODUCTION

    Amazon Lex [1] is a service for building conversational interfaces into any application using voice and text. Amazon Lex provides the advanced deep learning functionalities of automatic speech recognition (ASR) for converting speech to text, and natural language understanding (NLU) to recognize the intent of the text, to enable you to build applications with highly engaging user experiences and lifelike conversational interactions. With Amazon Lex, the same deep learning technologies that power Amazon Alexa are now available to any developer, enabling you to quickly and easily build sophisticated, natural language, conversational bots (chatbots).

    With Amazon Lex, you can build bots to increase contact center productivity, automate simple tasks, and drive operational efficiencies across the enterprise. As a fully managed service, Amazon Lex scales automatically, so you dont need to worry about managing infrastructure.

  2. BENEFITS OF AMAZON LEX

    1. Easy to use

      Amazon Lex provides an easy-to-use console to guide you through the process of creating your own chatbot or conversational interface in minutes. Just supply a few example phrases and Amazon Lex builds a complete natural language model through which your user can interact using voice and text, to ask questions, get answers, and complete sophisticated tasks.

    2. One click deployment

      With Amazon Lex, you can easily build, test, and deploy your chatbot everywhere across all your channels and platforms. This includes mobile devices, web apps, and chat services such as Facebook Messenger, Slack, and Twilio SMS. Amazon Lex is a fully managed service that automatically scales with usage, so you dont need to worry about provisioning hardware and managing infrastructure to power your bot.

    3. Seamless AWS integrations

      Amazon Lex provides built-in integration with AWS Lambda and Amazon CloudWatch and you can easily integrate with many other services on the AWS platform including Amazon Cognito and Amazon DynamoDB. You can take advantage of the power of the AWS platform for security, monitoring, user authentication, business logic, storage and mobile app development.

    4. Cost effective

    With Amazon Lex, there are no upfront costs or minimum fees. You are only charged for the text or speech requests that are made. Amazon Lex pay-as-you-go pricing and low cost per request makes it a cost-effective way to build conversational interfaces anywhere. With the Amazon Lex free tier, you can easily try Amazon Lex without any initial investment.

  3. USE CASES OF AMAZON LEX

    1. Call Center Chatbots and Voice Assistants

      By using an Amazon Lex chatbot in your call center, callers can perform tasks such as changing a password, requesting a balance on an account, or scheduling an appointment, without needing to speak to an agent. These chatbots use automatic speech recognition and natural language understanding to ascertain a callers intent, maintain context and fluidly manage the conversation. Amazon Lex uses AWS Lambda functions to query your business applications, provide information back to callers, and make updates as requested.

    2. QnA Bots and Informational Bots

      You can use Amazon Lex to build chatbots for everyday consumer requests, such as accessing the latest news updates, game scores, or weather. After you build your Amazon Lex bot, you can deploy them on mobile devices, chat services, and IoT devices, with support for rich message formatting.

    3. Application Bots

      Amazon Lexs high-quality speech recognition and natural language understanding capabilities make it possible to build powerful interfaces to mobile applications. You can add a voice or text chat interface to create bots on mobile devices that can help customers with many basic tasks, such as accessing their bank account, booking tickets, ordering food, or calling a cab. Amazon Lex integrates with Amazon Cognito so you can control user management, authentication, and sync across all devices.

    4. Enterprise Productivity Bots

      You can use Amazon Lex to build enterprise chatbots that streamline common work activities and improve organizational efficiencies. For example, employees can check sales data from Salesforce, marketing performance from HubSpot, and customer service status from Zendesk, directly from their chatbots within minutes. With Amazon Lex, you can build your bots to connect to a variety of enterprise productivity tools through AWS Lambda functions.

  4. HOW IT WORKS?

    Amazon Lex enables you to build applications using a speech or text interface powered by the same technology that powers Amazon Alexa. Following are the typical steps you perform when working with [2].

      1. Create a bot and configure it with one or more intents that you want to support. Configure the bot so it understands the user's goal (intent), engages in conversation with the user to elicit information, and fulfills the user's intent.

      2. Test the bot. You can use the test window client provided by the Amazon Lex console.

      3. Publish a version and create an alias.

      4. Deploy the bot. You can deploy the bot on platforms such as mobile applications or messaging platforms such as Facebook Messenger. Before you get started, familiarize yourself with the following Amazon Lex core concepts and terminology:

    • Bot A bot performs automated tasks such as ordering a pizza, booking a hotel, ordering flowers, and so on. An Amazon Lex bot is powered by Automatic Speech Recognition (ASR) and Natural Language Understanding (NLU) capabilities, the same technology that powers Amazon Alexa. Amazon Lex bots can understand user input provided with text or speech and converse in natural language. You can create Lambda functions and add them as code hooks in your intent configuration to perform user data validation and fulfillment tasks.

    • Intent An intent represents an action that the user wants to perform. You create a bot to support one or more related intents. For example, you might create a bot that orders pizza and drinks. For each intent, you provide the following required information: Intent name A descriptive name for the intent. For example, OrderPizza.

    • Sample utterances How a user might convey the intent. For example, a user might say "Can I order a pizza please" or "I want to order a pizza".

    • How to fulfill the intent How you want to fulfill the intent after the user provides the necessary information (for example, place order with a local pizza shop). We recommend that you create a Lambda function to fulfill the intent. You can optionally configure the intent so Amazon Lex simply returns the information back to the client application to do the necessary fulfillment.

    • Slot An intent can require zero or more slots or parametes. You add slots as part of the intent configuration. At runtime, Amazon Lex prompts the user for specific slot

      values. The user must provide values for all required slots before Amazon Lex can fulfill the intent. For example, the OrderPizza intent requires slots such as pizza size, crust type, and number of pizzas. In the intent configuration, you add these slots. For each slot, you provide slot type and a prompt for Amazon Lex to send to the client to elicit data from the user. A user can reply with a slot value that includes additional words, such as "large pizza please" or "let's stick with small." Amazon Lex can still understand the intended slot value.

    • Slot type Each slot has a type. You can create your custom slot types or use built-in slot types. For example, you might create and use the following slot types for the OrderPizza intent:

    • Size With enumeration values Small, Medium, and Large.

    • Crust With enumeration values Thick and Thin. Amazon Lex also provides built-in slot types. For example, AMAZON.NUMBER is a built-in slot type that you can use for the number of pizzas ordered.

  5. LAMBDA FUNCTIONS AS CODE HOOKS

    Lambda Functions as Code Hooks You can configure your Amazon Lex bot to invoke a Lambda function as a code hook. The code hook can serve multiple purposes:

    • Customizes the user interactionFor example, when Joe asks for available pizza toppings, you can use prior knowledge of Joe's choices to display a subset of toppings. Validates the user's inputsuppose that Jen wants to pick up flowers after hours. You can validate the time that Jen input and send an appropriate response.

    • Fulfills the user's intentAfter Joe provides all of the information for his pizza order, Amazon Lex can invoke a Lambda function to place the order with a local pizzeria. When you configure an intent, you specify Lambda functions as code hooks in the following places:

    • Dialog code hook for initialization and validationThis Lambda function is invoked on each user input, assuming Amazon Lex understood the user intent.

    • Fulfillment code hookThis Lambda function is invoked after the user provides all of the slot data required to fulfill the intent. You choose the intent and set the code hooks in the Amazon Lex console, as shown in Fig 1.

    Fig. 1. Amazon Lex Fulfillment

  6. HOW TO INTEGRATE AMAZON LEX TO AMAZON CONNECT

    After the Lex bot is implemented this can be called in the Amazon connect flows and can be customized based on the business need.

    1. Test chat bot

      You can test the chats and mimic how it will be displayed on the website as shown in Fig 2.

      Fig. 2. Amazon Test chat bot

    2. Configuring Amazon lex bot on Amazon Connect instance Once the Amazon connect instance is up and running, we need to configure which connect flows will be used for Amazon connect and if there is any lambda functions which has to be explicitly called.

    Go to the contact flows from Amazon connect set up region as shown in Fig 3. Add the Lex bot which will be called via this Connect flow

    Fig. 3. Amazon Connect instance set up

    Set up the Amazon Lambda function for Amazon connect as shown in Fig 4.

    Fig. 4. Set up Amazon Lambda in Amazon Connect

    This initial setting will invoke the Amazon Lex bot and Amazon Lambda function through Amazon connect contact flow.

    Amazon connect flow can be configured after the initial set up is complete as shown in Fig 5.

    Fig. 5. Amazon Connect contact flow

    Set Contact Attributes will save the customer inputs such as

  7. AMAZON PINPOINT

    calling customer phone number as shown in Fig 6.

    Lets take a look at the Amazon SMS service called Amazon Pinpoint which helps in sending messages as shown in Fig 7.

    Businesses need to send real-time notifications in order to take action when alerted of a critical situation. Examples could include anomaly detection, healthcare emergencies, operations failures, and fraud transactions. Email, SMS, and push notifications are often used to notify stakeholders in real-time. However, building a large-scale, real-time notification solution can be a complex and costly challenge for a business [3].

    Fig. 6. Set contact attributes in Amazon Connect.

    This variable will be used by the Lambda function to trigger the SMS to be sent to the calling customer.

    Amazon Pinpoint enables you to engage with your stakeholders in real-time by sending email, SMS and push notifications. Your app can use the Amazon Pinpoint API and the AWS SDKs to send direct messages. With transactional messages, you send alerts to specific recipients, as opposed to messages that you send to segments. There is no minimum fee, no setup cost, and no fixed monthly cost with Amazon Pinpoint.

  8. SEND SMS FROM AMAZON LEX

    Fig. 7. Amazon PinPoint

  9. CONCLUSION

    Create a lambda function which can retrieve the customer phone number which is identified by the IVR contact flow and when it calls the Lex bot internally it will in turn trigger the code fulfillment hook which calls the lambda function.

    Code snippet to send SMS from Amazon lambda function is as shown below.

    function sendMessage(destinationNumber,messageContent) { var params = {

    //ApplicationId must match the ID of the application you created in AWS Mobile Hub

    ApplicationId: "<application ID>", MessageRequest: {

    Addresses: { [destinationNumber]: {

    ChannelType: "SMS",

    },

    },

    MessageConfiguration: { SMSMessage: {

    Body: messageContent, MessageType: "TRANSACTIONAL", SenderId: "AWS",

    Amazon Lex bot can be easily configured for a business requirement and minimize the routine work and bot can be designed for the responses which can divert most of the calls to the logic built instead of passing to the customer agent. This reduces tremendous amount of work on the call center agents and Lex can handle most of the use cases. This can be invoked from Amazon connect or can be used as standalone chat functionality on the websites.

    Amazon Lex bot can also be integrated with social platforms such as Facebook messaging. And all this click and drag functionalities provide the time to deploy to few hours and can be done with minimal or no code.

    Customers can use Amazon Pinpoint to help scale communications across use cases, including real-time notifications. Amazon Pinpoint is a flexible and scalable outbound and inbound marketing communications service. You can connect with customers and stakeholders over channels like email, SMS, push, or voice. Amazon Pinpoint can also be integrated with social messaging such as WhatsApp.

    REFERENCES

    }

    },

    },

    1. Amazon Lex details available [Online]:https://aws.amazon.com/lex/

    2. Amazon Lex developer guide available [Online]:

} https://docs.aws.amazon.com/lex/latest/dg/lex-dg.pdf

}; [3] Amazon PinPoint details available [Online]:

// Send the SMS

pinpoint.sendMessages(params, function(err, data) { if (err) {

console.log(err);

} else { console.log(destinationNumber); console.log(messageContent); console.log("Great Success");

https://aws.amazon.com/blogs/messaging-and-targeting/send-real-time- alerts-using-amazon-pinpoint/

}

});

}

Leave a Reply

Your email address will not be published. Required fields are marked *