Digital Developer Conference: Cloud Security 2021 – Build the skills to secure your cloud and data Register free

Develop an AI-infused automation tool to convert business FAQs to Watson Assistant-ready chatbot input

Developing an automated solution for creating intents, utterances, and entities directly from a business’s frequently asked questions (FAQ) can help developers and software teams save considerable time because they do not have to write it manually. In this article, learn about an artificial intelligence (AI)-infused automation tool to convert a business’s FAQs to Watson Assistant-ready chatbot input. You can then easily integrate the solution with minimal effort to various input channels such as WhatsApp, Telegram, Slack, Facebook Messenger, and Live Chat.

The article assumes that you have a basic understanding of a chatbot application, such as intents, entities, and knowledge corpus training. To understand the impact better, you should have basic development skills in API integration, Python, and the Watson Assistant SDK, as well as fundamental AI knowledge. The article covers:

  • Business context and the use of business FAQs
  • Challenges in building a chatbot from business FAQs when the FAQs are being continuously revised
  • Solution details on how FAQs provided by customers across industry domains can be automatically fed into various components of the Watson Assistant Service
  • Integration with input channels such as Telegram and WhatsApp
  • A sample use case with step-by-step implementation for building an automated tool that converts a business’s FAQ to a ready chatbot solution

Website FAQs and chatbots in business

FAQs are important for any company because they provide clarity on the company, their products, and their services. Most companies prefer to add an FAQ page on their website, and the key benefits of having the FAQs on the website are:

  • Improving customer experiences by providing answers to standard questions.
  • Expanding the company’s online visibility through a search engine (for example, Google search). This in turn also helps Google to understand the business better.
  • Providing customers with knowledgeable, trustworthy, and useful information on the business’s services or products.
  • Addressing common questions and answers gives confidence to the customer to take the next step of purchasing a product or service.

Extending the FAQs and implementing a chatbot solution provides several benefits for a company or enterprise.

  • A single window to reach the customer. It gives customers a more personal experience than a conversation by mail or phone.
  • Support is available 24×7 as compared to traditional customer service.
  • A company can react faster to customer inquiries, which can increase and drive a company’s sales. Additionally, it can help a company to increase customer satisfaction.
  • Chatbots are industry agnostic, that is, they can be used in a variety of industries.
  • Chatbots can give immediate feedback to customers.

Challenges and solutions

Automating customer service tasks lets customer service representatives spend more time on value-added activities, leaving the chatbot to answer standard queries. Converting the available FAQs to chatbot-compatible input can help you automate the solution. To do this, the business FAQ must be enhanced to build various entities and utterances. When the entities and utterances are ready, the FAQ is fed into the AI solution. However, when implementing an FAQ chatbot solution, there can be some challenges.

  • A considerable amount of time must be spent updating the FAQs with entities and utterances.
  • Continuously updating the FAQs requires additional effort to update the input data for the AI solution.

The manual effort of creating entities and utterances in the solution can be avoided entirely by using the auto generation of utterances and intents. You can use the business’s FAQs as input, but you want to be able to provide the right answers even if the question is asked in various ways. This is where the use of AI algorithms comes into play. You can use the algorithms to generate utterances, then ingest them by constructing a Watson Assistant-ready chatbot.

Sample use case

As an example, let’s use a fictitious education institute, FictEDUCO, who wants to develop a chatbot solution that can address their standard queries from students and parents who use Telegram as their input channel. The solution in this use case explains how to implement an automated tool that transforms FictEDUCO FAQs to a chatbot app or digital assistant. It uses AI methods and Watson Assistant, and is integrated with popular input channels like Telegram.

Development journey

The FictEDUCO development team designs and implements the pipeline that automates the entire process to convert the FictEDUCO business FAQs to utterances and intents. It then feeds them to a Watson Assistant-based chatbot that uses Telegram. The following figure shows the design diagram of the pipeline and its implementation steps.

Pipeline for automating FAQs

All of the points that are mentioned in the previous figure are explained below so that you can see and understand the entire design flow and the implementation details.

First, the FictEDUCO engineer sets up a Watson Assistant by:

  1. Logging in to IBM Cloud.
  2. Creating an assistant, the FictEDUCO Assistant, by using the Watson Assistant service.
  3. After the assistant is created, going to the Resource list and selecting Service.
  4. Selecting Watson Assistant, followed by starting the assistant.
  5. Selecting the assistant that they created from the list and opening the settings.
    • The assistant name
    • The Assistant ID
    • The Assistant URL (use up to the slash ‘/’, that is, before ‘v2…’ of the URL) example: https://api.jp-ok.assistant.watson.cloud.ibm.com/instances/xxxxxxxxxxxxxx/v2/assistants/xxxxxxxxxxxxxxxxxxxxxxxxxxx/sessions, https://api.jp-tok.assistant.watson.cloud.ibm.com/instances/xxxxxxxxx
    • The API key
  6. Keeping the credentials in a safe place and sharing the information with the developers.

Next, the FictEDUCO FAQs are kept in a CSV file called FictEDUCO-faq-intents.csv. The following table shows a sample snapshot of the file.

Question Response
Does FictEDUCO provide internship training? Yes, FictEDUCO provides internships to help students understand the profession and to give them firsthand knowledge about the program and the challenges of a career in interior architecture.
Will FictEDUCO guarantee a job if I take a course here? FictEDUCO has a great list of placement providers. Based on our reputation and because our course content as well as our standard and method of training is consistent with industry demands, most students receive job offers.
Are FictEDUCO courses government recognized? Each course provided by FictEDUCO is University Grants Commission (UGC) recognized. The courses are well accepted and recognized by the industry at large.

Utterance Builder

The developer implements the Utterance Builder, which is a Python script. The Utterance Builder takes a CSV file as input and updates the CSV file with utterances of the respective questions. The following image depicts the complete flow design and implementation of the pipeline that generates the utterances of the question using AI-infused algorithms.

Utterance Builder flow

The following steps explain all of the points that are mentioned in the previous figure.

Step 1

The Python scripts take questions from the CSV file as input.

Step 2

For each question, the scripts apply four methods for generating paraphrases:

  • Full back translation
  • Extract theme words
  • Synonym replacement
  • Generate paraphrase

Full back translation: FictEDUCO developers use neural machine translation models for generating paraphrases. The models generate multiple French translations using English sentences as the input. For each of the French translations, the models generate multiple English translations. The German language can also be used to get more variances of the English translations. The following code snippet shows the Python scripts where the googletrans library is used:

def full_backtranslation(txt):
    bt_sents=[]
    #pip install BackTranslation
    from BackTranslation import BackTranslation
    trans = BackTranslation(url=[
          'translate.google.com'
        ], proxies={'http': '127.0.0.1:1234', 'http://host.name': '127.0.0.1:4012'})
    result = trans.translate(txt, src='en')
    bt_sents.append(result.result_text)
    utls= Utils()
    et = utls.back_translation(txt,'fr')
    bt_sents.append(et)
    et = utls.back_translation(txt,'de')
    bt_sents.append(et)
    return bt_sents

class Utils():
def back_translation(self,in_word, mid):
        bt=in_word
        if( mid=='de'):
            #translate english to German
            bt= self.translate_to_de(in_word)
        elif (mid=='fr'):
            #translate english to French
            bt= self.translate_to_fr(in_word)
        #translate german back to english  
        return self.translate_to_en(bt)

When the full back translation is complete, all translated sentences are pushed to a paraphrase pool.

Extract theme words: This function extracts theme words from the questions and appends them to the sentences. The FictEDUCO developers use the Python RAKE (Rapid Automatic Keywords Extraction) library algorithm to determine key phrases in a body of question text by analyzing the frequency of word appearances and their occurrences with other words in the text. The following code snippet shows how FictEDUCO developers implement the extraction of theme words for a given text.

def extract_theme_words(txt):
    retVal=[]
    from rake_nltk import Rake
    rake_nltk_var = Rake()
    rake_nltk_var.extract_keywords_from_text(txt)
    keyword_extracted = rake_nltk_var.get_ranked_phrases()
    from nltk.tokenize import RegexpTokenizer
    tokenizer = RegexpTokenizer(r'\w+')
    #Single keywords of keywords are being appended
    words_appended = []
    for key_words in keyword_extracted:
        tokens = tokenizer.tokenize(key_words)
        if (len(tokens) == 1):
            words_appended.append(tokens[0])
        else :
            retVal.append(key_words)
    if (words_appended):
        if ((len (words_appended) ==1) and retVal):
            #Single word appended contains one word, and its added to first keyword extract string
            retVal[0]=retVal[0] + ' '+ ' '.join(words_appended)
        else:
            retVal.append(' '.join(words_appended))    
    return retVal

After theme words are extracted, all of the words are pushed to the same paraphrase pool.

Synonym replacement: This function finds synonyms for words in the input question from synsets, a group of synonymous words that express the same meaning. The Natural Language Toolkit uses the synsets interface to look up words in WordNet and replace the word with its synonym. The FictEDUCO developers use WordNet from The Natural Language Toolkit corpus reader. The following code snippet shows an example of synonym replacement.

def synonym_replacement(words, n):
    words = words.split()
    new_words = words.copy()
    random_word_list = list(set([word for word in words if word not in stop_words]))
    random.shuffle(random_word_list)
    num_replaced = 0

    for random_word in random_word_list:
        synonyms = get_synonyms(random_word)
        if len(synonyms) >= 1:
            synonym = random.choice(list(synonyms))
            new_words = [synonym if word == random_word else word for word in new_words]
            num_replaced += 1
        if num_replaced >= n: #only replace up to n words
            break
    sentence = ' '.join(new_words)
    return sentence

def get_synonyms(word):
    synonyms = set()
    for syn in wordnet.synsets(word):
        for l in syn.lemmas():
            synonym = l.name().replace("_", " ").replace("-", " ").lower()
            synonym = "".join([char for char in synonym if char in ' qwertyuiopasdfghjklzxcvbnm'])
            synonyms.add(synonym)
    if word in synonyms:
        synonyms.remove(word)
    return list(synonyms)

After the list of synonym replacement text is constructed, those are pushed to the paraphrase pool.

Generate paraphrase: FictEDUCO developers use a Python library called Parrot, a paraphrase-based utterance augmentation framework built to accelerate training natural language understanding models. A paraphrase framework is more than just a paraphrasing model. The following code snippet shows an example of generating paraphrases.

def generate_paraphrase(txt):
    #######################Phrase replacement (PPDB)#############################
    #pip install git+https://github.com/PrithivirajDamodaran/Parrot_Paraphraser.git
    retVal = []
    from parrot import Parrot
    import torch
    import warnings
    warnings.filterwarnings("ignore")
    '''
    uncomment to get reproducible paraphrase generations
    def random_state(seed):
      torch.manual_seed(seed)
      if torch.cuda.is_available():
        torch.cuda.manual_seed_all(seed)
    random_state(1234)
    '''
    #Init models (make sure you init ONLY once if you integrate this to your code)
    parrot = Parrot(model_tag="prithivida/parrot_paraphraser_on_T5", use_gpu=False)
    para_phrases = parrot.augment(input_phrase=txt, use_gpu=False)
    for para_phrase in para_phrases:
        #print(para_phrase)
        retVal.append(para_phrase[0])
    return retVal

After the paraphrases are generated, they are pushed into the same paraphrase pool.

Step 3

Using the four methods for paraphrasing generates a large pool of paraphrases that could potentially contain sentences that are semantically different from the input sentence. The pool could also contain redundant and duplicate sentences. This necessitates a method to select the relevant paraphrases.

Step 4

As part of the candidate selection algorithm, FictEDUCO developers first remove the irrelevant sentences by using a filtering mechanism. They also use a deduplication method to remove duplicates by creating set of sentences.

Step 5

The FictEDUCO developers apply the Universal Sentence Encoder (USE)-based duplication method to get vector representations of the input questions and the paraphrases and compute the cosine similarity between them. They discard paraphrases from the pool if the similarity shown is between a specific range. The developers use TensorFlow for this implementation.

Note: If you want to, you can take a look at all of the code (QAToUtteranceAndIntentBuilder.py and Utils.py).

Step 6

Candidates of the utterances are stored in a final paraphrases pool. The Utterance Builder updates the CSV file for the corresponding questions using the paraphrases pool. The CSV file with utterances is generated for corresponding questions. The following table shows an example of the file.

Question Utterances
Does FictEDUCO provide internship training? does the company provide internship training?; does the company offer internship training?; does companion ply internship training?; does a company give internship training?; does the company provides internship training?; does any company provide internship training?; company provide internship training; does company provide internship training?; does the company provide training?
Will FictEDUCO guarantee a job if I do a course here? will the company guarantee a job if i do a course here?; will society guarantee a job if i do a course hero?; will the company guarantee a job if i do a course held?; will company guarantee a job if i do a course here?; company guarantee; will i get a job here if i do courses here?; will the company give me a job if i start a course here?; job course; if i do a course hero, will the company guarantee work?; will the company assure me a job if i do a course here?; will the company give me a job if i sign up for a course here?; will troupe guarantee a job if atomic number do a course here?
Are FictEDUCO courses government recognized? are business courses govt.cononnu?; are company courses recognized by the govt?; company courses govt recognized; constitute company courses govt. recognize? ; are company courses recognized by govt?; are company courses govt. recognized?; are company courses recognized by the government?; are company courses govt.and?; it is the company’s curriculum government course.recognize?; are company courses recognized?; are company courses recognized by the state?
How can we reach out to FictEDUCO? how can we strive out to company?; how do we contact the company?; how can we reach the company?; how can we reach out to companies?; how do i contact companies?; how can we reach a business?; reach company; tell me the best way to reach out to a company?; how can we reach out to company?; how do i contact a company?; how do we contact my company?
Where are FictEDUCO locations? where is the entire company located?; where the company is located; where any company is located; where is all the company located?; where is the whole company located?; where all companionship is locate; where all the company is located; located company; places where all companies are; where all of the companies are located; where all company is located
What is the time to get counseling? what is the time to get counselling? ; what is the time to get advice?; what’s the best time to get counseling?; is it the right time for counseling?; what time is best to do counseling?; which is the right time to get counseling?; what is the clip to begin counselling? ; get counseling time; can you list the best times to get counseling?; tell me the best time to get counseling?; when will i consult?; when is the right time to get counseling?; tell me the best time for counseling?

The Intent Identifier Builder

The developer implements the Intent Identifier Builder, a Python script that takes a CSV file as input and updates the CSV file with the intent of the respective question. The following figure shows the complete flow design and implementation of the pipeline that generates the intent identifier of the question using AI-infused algorithms. The Intent Identifier is the unique identifier of core information (a small set of data with no noise and redundancy) of the question (set of words).

Intent builder

All of the points mentioned in the previous figure are explained below to understand the entire design flow and the implementation details.

Step 1

The FictEDUCO FAQs CSV file contains questions that the Python scripts take as input.

Step 2

The Python scripts run the following steps serially. The Intent Identifier Builder:

  1. Gets the top scored lemma text of the questions. For this, developers use the expertai-nlapi Python library for lemmatizing (or converting the word to its base form) and getting the text with the maximum score of the lemma text list. This client library is used for the expert.ai Natural Language APIs that add natural language understanding capabilities to the Python scripts. Finally, they remove the stop words and company name (if any) from the lemma text and then add them in the word buffer (3).

  2. Gets the top scored syncon (that is, main concepts) text for the questions. For this, developers use the expertai-nlapi Python library for syncon and get the text with the maximum score of the syncon text list. Finally, it removes the stop words and company name (if any) from the syncon text and then adds them in the word buffer (3).

  3. Gets the top scored phrase text of the questions. For this, developers use the expertai-nlapi Python library for key phrase extraction and get the text with the maximum score of the phrase text list. Finally, it removes the stop words and company name (if any) from the phrase text and then adds them in the word buffer (3).

Note: All of the previous script implementations need developers to create an account with credentials in expert.ai.

Step 3

The word buffer contains the list of words that are extracted from questions after getting the top scored lemma, syncon, and phrase text using the expertai-nlapi Python client library.

Step 4

The Intent Identifier Builder removes duplicate words from the word buffer.

Step 5

The Builder concatenates all of the words with a separator and gets the potential intent identifier. The following code snippet shows an example of this.

def get_intent (questionTxt):
    #pip install expertai-nlapi==2.3.1
    intent= []
    import os
    os.environ["EAI_USERNAME"] = "developer_email@<fictEDUCO DOMAIN>"
    os.environ["EAI_PASSWORD"] = "XXXXXXX"
    from expertai.nlapi.cloud.client import ExpertAiClient
    client = ExpertAiClient()
    language= 'en'
    document = client.specific_resource_analysis(
        body={"document": {"text": questionTxt}},
        params={'language': language, 'resource': 'relevants'})  

    concepts={}
    for main_concept in document.main_syncons:
        concepts[main_concept.lemma]=main_concept.score
    if concepts:
        max_key = max(concepts, key=concepts.get)
        intent.extend( max_key.split()  )

    phrases={}
    for main_phrase in document.main_phrases:
        phrases[main_phrase.value]=main_phrase.score
    if phrases:
        max_key = max(phrases, key=phrases.get)
        intent.extend( max_key.split()  )

    lemmas={}
    for main_lemma in document.main_lemmas:
        lemmas[main_lemma.value]=main_lemma.score
    if lemmas:
        max_key = max(lemmas, key=lemmas.get)
        intent.extend( max_key.split()  )

    intent_max_word=10
    return "_".join(set(intent[:intent_max_word]))

Step 6

The Python scripts update the FAQ CSV file with the generated intent identifier in the CSV file itself.

Step 7

The CSV file gets updated with the intent identifier of the corresponding question. The following table shows an example of the CSV file.

Intent Question
training_internship Does FictEDUCO provide internship training?
work_company_job_guarantee Will FictEDUCO guarantee a job if I do a course here?
company_courses_govt._governance Are FictEDUCO courses government recognized?
company_reach_to_out How can we reach out to FictEDUCO?
company_set Where are the FictEDUCO locations?
get_counselling What is the time to get counseling?
company_address What is the FictEDUCO address?
career_course How will a FictEDUCO course will benefit my career?
training_certificate Does the institute provide training certificates?

You now have all the autogenerated utterances and intent identifiers available in the same FAQ CSV file. This file is used as input for the Watson Assistant Chatbot builder.

Watson Assistant Chatbot Builder

The developer implements the Watson Assistant Chatbot Builder, a Python script that takes the CSV file prepared as input and creates a Watson Assistant-ready chatbot application. The following image shows the complete flow design and implementation of the pipeline that creates the Watson Assistant chatbot or digital assistant using the ibm-watson Watson Assistant Python SDK. The FictEDUCO developer uses both the Watson Assistant API classic experience for authoring the Watson Assistant workspace and the new experience for runtime methods.

Watson Assistant chatbot builder

All of the points that are mentioned in the previous figure are explained for you to understand the entire design flow and the implementation details.

Step 1

The FictEDUCO engineer creates an assistant using the Watson Assistant Service as stated previously.

Step 2

The developer creates an ibm-watson API Python client by using the new assistant API key and URL (shared by the engineer) to connect to the Watson Assistant Service. The following code shows an example.

def get_watson_assistant_client():   
    watson_assistant_instant_name="Watson Assistant-10"
    assistant_name="FictEDUCO Assistant"
    assistant_id = "xxxxxxxx"
    api_key = 'xxxxxxx'
    url = 'https://api.jp-tok.assistant.watson.cloud.ibm.com/instances/xxxxxxx'
    wac = WatsonAssistantClient(api_key,url)
    return wac

Step 3

The developer creates a skill for a given skill name using the client object.

Step 4

The developer uses the client to get the skill ID for the skill name.

Step 5

The developer creates a default fallback dialog node using the skill ID. This dialog node uses conditions='anything_else'. The following code shows an example.

def create_fallback_dialog_node(self, skill_id):
        #Create Dialog Node for default fallback
        '''Declare Response text'''
        resp_dict = {
                "values": [
                  {
                    "text": "Did not get that."
                  },
                  {
                    "text": "Sorry I could not get you."
                  }
                ],
                "response_type": "text",
                "selection_policy": "random"
              }
        dialog_response = DialogNodeOutputGeneric.from_dict(resp_dict)
        dialog_response= DialogNodeOutput(generic=[dialog_response])
        dialog_node_obj=self.assistant_v1.create_dialog_node(
            workspace_id=skill_id, #self.workspcae_obj['workspace_id'],
            dialog_node="Anything else",
            conditions='anything_else',
            title="Anything else",
            output=dialog_response
        ).get_result()
        print("Dialog Node for default fallback Created ==",json.dumps(dialog_node_obj, indent=2))
        return dialog_node_obj

Step 6

The developer creates an intent using the parameters (that is, utterances) intent name from the CSV file for the skill ID.

Step 7

The developer creates a dialog node using the response of the intent for the skill ID and the CSV file.

Step 8

The automated FictEDUCO chatbot is ready for use after using the Watson Assistant Service API Python client and taking inputs from the CSV file containing questions, utterances, intents, and responses.

The following code snippet shows the Watson Assistant Chatbot Builder and covers all of the points detailed previously.

def watson_assistant_builder(wac,faq__intent_phrases_response_file):
    rslt = wac.delete_skill ("FictEDUCO" )
    skill_name = "FictEDUCO"
    skill_description= "FictEDUCO Skill for support user query on educational training"
    csvfile = open(faq__intent_phrases_response_file,errors="backslashreplace")
    csvfileDf = pd.read_csv(csvfile, sep=',', quoting=csv.QUOTE_MINIMAL)
    csvfileDf = csvfileDf.fillna('')
    csvfileDf.columns = csvfileDf.columns.str.strip(
    #Create records from csvDF file
    for index, row in csvfileDf.iterrows():
        question = row['question']
        intent_name = row['intent']
        utters_with_pipe = row['utterances-seperated_by_pipe']
        utterance_array = utters_with_pipe.split('|')
        response_array =  [row['response']]
    create_wa_chatbot(wac, skill_name, skill_description, intent_name, utterance_array, response_array)

The Watson Assistant Chatbot Builder is ready to use. The following image shows the details.

FictEDUCO chatbot

Implement TelegramBot Listener

Next, the developer implements the TelegramBot Listener, a Python script that uses the pyTelegramBotAPI Python library for the Telegram Bot API. This library uses the HTTP API token of BotFather when created using Telegram. You can read more details about how to create a bot using BotFather from a Telegram App and how to get the HTTP API token. The FictEDUCO developer created the FETelegramBot bot using BotFather as shown in the following image.

TelegramBot listener

The following code snippet shows the Telegram listener that starts the bot for listening and receiving the Telegram message that is sent by the user.

#pip install pyTelegramBotAPI
import telebot
from telebot import types
from WatsonAssistantBuilder import WatsonAssistantClient
#FETelegramBot
HTTP_API_TOKEN= "000000000000000000:XXXXXXXXXXXXXXXXXXXXXXXX"
bot = telebot.TeleBot(HTTP_API_TOKEN, parse_mode=None)
def get_fulfilment_text(skill_name, query_text):
    #Watson Assistant Instance API Key
    api_key = 'XXXXXXXXXXXXXXXXXXXXXXXXXx'
    url = 'https://api.jp-tok.assistant.watson.cloud.ibm.com/instances/XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
    wac = WatsonAssistantClient(api_key,url)
    skill_id = wac.get_skill_id_by_name(skill_name)
    #Get fulfilment text
    ft= wac.detect_intent_from_skill(skill_id, query_text )
    return ft
#if you want specific chat handler with qualifier text then you can implement message handler
#Example : In Chat, if user type with /start or /help, then send_welcome message will be invoked
@bot.message_handler(commands=['start', 'help'])
def send_welcome(message):
    print("message_handler.message.chat.id-->",message.chat.id)
    bot.reply_to(message, "Hey, how are you doing? How may I help you?")
#Bot send send response on user's query
@bot.message_handler(func=lambda m: True)
def echo_all(message):
    chat_id = message.chat.id
    query_text= message.text
    answer_text = get_fullfillment_text("FictEDUCO", query_text)
    bot.send_message(chat_id, answer_text)
if __name__ == '__main__':
    print("FictEDUCO Telegram Bot Started")
        bot.polling()

The Telegram listener uses the WatsonAssistantClient class (a custom Python adapter class that is created to access various Watson Assistant APIs) to get the fulfillment text for the query message sent by the user in the Telegram App. The WatsonAssistantClient class uses the skill name and the API key to connect to the Watson Assistant instance service. When connected, the client uses the get_result() method of the assistant_v1 message with query text to get the response text.

The FictEDUCO customer can use the FETelegramBot to start a chat with various queries as in the business FAQs and get an immediate response. The following image shows sample interactions.

FictEDUCO TelegramBot

You are done! You should now have an understanding of how to automatically convert a business’s FAQs to Watson Assistant chatbot-ready input using the Watson Assistant SDK. The process can be used by using Telegram as the input channel, developed by FictEDUCO development and engineering teams.

If you want to, you can take a look at all of the code (WatsonAssistantBuilder.py, TelegramBotListner.py, and Utils.py).

Note: The code snippets that are shown in this article are not production-ready. There are areas where you can apply your AI skills in the code to improve the user utterances quality (see an example). Similarly, you can make the intent identifier names more meaningful so that your Watson Assistant bot gets trained effectively.

Future enhancements

Many businesses can face challenges keeping their FAQs and chatbots up to date as well as having continuous updates to keep the knowledge relevant. This automation can help by having the company subject matter expert update the FAQ CSV file with unanswered questions. This can increase customer satisfaction when users have their questions answered.

Conclusion

This article explained how to build an AI-infused automation tool to convert a business’s FAQs to Watson Assistant-ready chatbot input. You can then easily integrate the solution with minimal effort to various input channels such as WhatsApp, Telegram, Slack, Facebook Messenger, and Live Chat.

Acknowledgement

The authors would like to acknowledge Rajeev Ranjan for his exclusive review of the article.

References