Authenticate chatbot users with SMS one-time passcode

Source Node: 837401

Summary

In this code pattern, learn how to authenticate users on your chatbot with an SMS one-time passcode (OTP).

Description

Chatbots are prevalent everywhere. And, some conversations are confidential, so chatbots must verify the authenticity of its users. One example of this is a customer who holds an insurance policy who uses a chatbot to get more information about that insurance policy. Sending a one-time passcode through SMS is a popular way to identify a user.

This code pattern shows how to build a chatbot that authenticates users through an SMS one-time passcode. You also learn to use IBM Watson Assistant, IBM Cloud Functions, and custom APIs to build this application.

After you have completed this code pattern, you understand how to:

  • Build conversational interfaces into any application, device, or channel
  • Run your application code without servers
  • Build APIs to authenticate users on your chatbot
  • Make external API calls through Watson Assistant

Flow diagram

Authenticate users on your chatbot flow diagram

  1. The user registers for a policy on the portal.
  2. User data is stored in the database, and policy details are sent to the user’s phone number in an SMS through the Twilio Messaging API.
  3. The user interacts with the chatbot and asks for confidential information that is related to the policy. Watson Assistant prompts the user to enter the OTP.
  4. The query is sent to Watson Assistant, which in turn invokes IBM Cloud Functions to make an API call to the user-defined, back-end API for retrieving information.
  5. The database is searched for the user’s phone number, and the OTP generated by the back-end API is sent to the user through Twilio.
  6. The user enters the OTP in the chat application to authenticate themselves.
  7. Watson Assistant validates the OTP by interacting with the back-end API.
  8. The user-requested confidential information is fetched from the database if the OTP is valid.
  9. IBM Cloud Functions returns the confidential information to Watson Assistant.
  10. Watson Assistant displays the user-requested confidential information.
  11. The user can see the confidential information in the chatbot.

Instructions

Find the detailed steps in the README file. Those steps explain how to:

  1. Clone the repository.
  2. Set up the Twilio messaging service.
    1. Create the Twilio service.
    2. Create the Twilio Trial Number.
    3. Verify caller IDs.
  3. Deploy custom APIs.
  4. Create an IBM Cloud Functions action.
  5. Create Watson Assistant services.
  6. Import the Watson Assistant workspace.
  7. Configure Watson Assistant with the IBM Cloud Functions URL.
  8. Deploy and run the web application.
Source: https://developer.ibm.com/patterns/authenticate-users-on-your-chatbot-with-sms-one-time-passcode-otp/

Time Stamp:

More from IBM Developer