Month: June 2022

  • Working & Collaborating with RPA Bots: Top 5 Ways to Succeed

    It is easy to get spooked by the fiction of robots taking over the human world when in reality robots being a part of the human workforce is great.

    Robotic process automation eliminates the barrier of employees’ need of performing mundane tasks and enables them to focus on other productive business activities.

    Working and Collaborating with RPA Bots

    In this article, we are going to discuss the top 5 ways that keep you on the right track for RPA bots collaboration.

    But first, what are RPA bots?

    RPA bots are software robots that perform tasks in a digital environment. These bots aim to automate repetitive tasks and therefore, they are also known as the “digital workforce”.

    RPA in Organizations

    In traditional automation tools, software developers have to create a list of actions to automate the tasks and interface to back-end systems using application programming interfaces (APIs).

    In contrast, robotic process automation develops the action list by performing the task in the graphical user interface (GUI), and then automatically repeating these tasks directly in GUI.

    But integrating daily standard operating procedures (SOP) and establishing an SOP for maintaining, updating, and re-evaluating automation is challenging. Once this is achieved both companies and employees will reap the benefits of automation.

    Image source

    Introducing employees to the present and future of work and automation can help businesses grow leaps and bounds. For instance, imagine the benefits if an employee can shift their focus from analyzing the spreadsheets to developing several pivot suggestions based on AI’s analysis!

    Related Read: What is RPA? A Detailed Guide for Business Owners

    5 Ways to Foster Collaboration between Humans and Robots

    1. Understanding RPA benefits

    There are various reasons organizations are implementing RPA as a solution to increase productivity and efficiency for their business. Working with robots and sharing their benefits would help your employees access the importance of automation in the workforce.

    Of the most cited benefits of RPA, customer satisfaction & speed to market are the best ones after productivity and product quality.

    Here are a few reasons employees can look forward to benefiting from their digital co-workers:

    • Boosted productivity: By taking advantage of the automation provided by RPA bots, the human workforce can get back their time to focus on more valuable tasks.
    • Better accuracy: RPA bots act as helping hands in tasks that have an added risk of human errors, such as in data entries.
    • More reliability: Bots react and respond to events in real-time performing processes while employees focus on other things, to keep their workflows running 24/7.

    2. Accessing business needs for RPA

    Overview your existing tasks, workflows, and processes, and understand what can be changed to optimize these processes? When starting with RPA, identify your systems that need to change so that your human employees can spend time on tasks suited to them.

    Image source

    The time wasted on repetitive tasks, and the money lost per year as shown in the statistics above are the two solid reasons why your business needs RPA, along with human resources.

    No matter how great the bots are, humans are still better at critical thinking, strategizing, and problem-solving. So, RPA bots are not here to replace employees, but to assist them with efficiently getting their jobs done.

    To get the best experience with collaborative robots, focus on your human employees, and when you have learned the benefits you can jump right in and automate everything.

    3. Find your Automation Approach

    Not all bots are created equal, different bots serve different purposes. There are mainly two types of RPA bots, attended and non-attended, and the third one, Intelligent process automation still in its infancy.

    Attended bots help you complete your everyday tasks easier but with human intervention. These tasks go into action when a user commands them. On the other hand, unattended automation work behind the scenes. These bots get triggered when an action such as a file being added into the folder is performed.

    Both of these automation types are important for human collaboration with robots, and companies can use one type of mix, whichever suits the employee’s needs better.

    4. Automate Processes with RPA Bots

    As you start implementing RPA and automation in your organization grows, you’ll be able to provide an RPA bot for all your employees. A great RPA solution is that which can provide bots for the right optimization.

    Here are a few real-life examples of RPA implementation and collaboration in the workplace:

    → RPA in Banking (Carter Bank & trust)

    Problem: Too much wasted time on routine, manual tasks from employee on-boarding to customer account management.

    RPA Solution: After bringing RPA culture to the organization, these processes were streamlined and over 300,000 customer accounts were migrated to the new system within 24 hours.

    Benefit: Achieved 3,800% ROI within 5 months

    RPA in Telecommunications

    Problem: Manual logging into websites to capture and consolidate customer billing information, more than 40 employees were assigned to this tedious error-prone task.

    RPA Solution: Software bots are taking over these repetitive and manual tasks. MetTel also combined automation with remediation to improve the response times.

    Benefit: Replaced 75% of their manual efforts with software robots.

    RPA in Healthcare

    Problem: The traditional claim management system accepted only one claim file each day from 837 daily generated files.

    RPA Solution: Baptist Health automated the daily transfers of these files to the FTP server which resulted in greater centralized control over thousands of file transfers that occur each day.

    Benefits: Saved 40 hours a month in manual tasks.
    Related Read: RPA Use Cases In The Real World [Updated 2022]

    5. Maximize the Collaboration

    The final step for reaping benefits from collaboration between the human workforce and bots is to maximize the collaboration and make the most out of the RPA bots. RPA bots can give your employees more time while improving their work-life balance. Collaborative robots can fill in and work 24/7 with a little time off allowing your employees to enjoy their freedom.

    RPA bots can also help you automate your tasks such as website monitoring, that require 24/7 attention, so instead of having a human employee monitor the status of the webpages, you can implement website automation for the same.

    Transform your Business with RPA

    We all are already familiar with the idea of automation, it has made our lives easier, and better.

    Streamlining your business tedious tasks helps you save time, reduce costs and increase efficiency in your business processes. Introducing RPA bots in your business doesn’t mean that you are taking their jobs away, but simplifying them by automating repetitive and mundane tasks.


    Working & Collaborating with RPA Bots: Top 5 Ways to Succeed was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Noodle Factory partners with Vygo to empower students and educators with tools and mastery to champion each other

    Singapore, 9 May 2022 – Noodle Factory, Singapore’s leading AI-powered EdTech platform, is pleased to announce their partnership with Vygo, an Australian-based one-stop hub for student support, offering complementary pilot programmes for educational institutions. While Noodle Factory leverages AI to scale exam preparation and tutoring, helping educators save up to 400 hours a year, Vygo hosts all sorts of peer and student support initiatives for universities and higher education institutions, engaging students and transforming student experiences, and is on track to champion 1,000,000 students before the 2020 student cohort graduates in 2023. Together, they allow higher education institutions to scale experiences for both audiences to new heights.

    “We believe that EdTech plays an essential role in education. Thus, developing a paradigm for EdTech to instil flexibility and resilience into the system is key. With this partnership with Vygo, we are able to move the needle and meet the needs in developing longer-term strategies, contributing to the EdTech ecosystem and creating a robust and dynamic learning environment for all,” said Yvonne Soh, co-founder and CEO of Noodle Factory.

    Addressing needs of educators and students as institutions rethink edtech strategies

    As higher education institutions transition to a post-pandemic era, more are rethinking their long-term strategies for deploying EdTech. The pandemic has prodded educators and students to make major decisions and changes in their approach to teaching and learning, finding solutions to meet the needs and expectations of learning. This partnership enriches the long-term strategies for EdTech as Noodle Factory and Vygo are able to achieve this by streamlining the learning and teaching process, while providing expert mentorship for student support and career success. Together, this collaboration value-adds to the education landscape whereby students and educators can both benefit from this approach.

    The need for education is constant. Thus, the need to rethink longer-term strategies for EdTech to re-imagine learning will become an integral part of education, resulting in a more responsive and adaptable learning environment. It is crucial to think ahead based on the current approach, distribution, and pedagogy in education for greater heights of success in the Edtech space.

    “For us at Vygo, we put personalised support at the fingertips of every student. We ensure no student would be ever left behind as we aim to empower students to support one another and higher education institutions to create impactful peer mentoring and student support programs. We are excited to partner with Noodle Factory to establish a stronger ecosystem in EdTech,” shared Ben Hallett, co-founder and CEO of Vygo.

    This partnership will offer them the means to do so and move forward on an upward trajectory, scaling optimised and engaging experiences for educators and students alike.

    There is a need for an innovative approach to make headway and identify key elements of the EdTech evaluation process. This alliance between Noodle Factory and Vygo offers the opportunity to narrow the gap and immerse themselves in modern technologies while taking it one step further.

    Furthermore, there may be opportunities for this alliance to be extended to other complementary EdTech companies. This will create and build a collaborative and thriving EdTech ecosystem that benefits not just educational institutions but also all educators and students as they enter the classroom of the future.

  • Why the Metaverse Needs AI, and AI Needs the Metaverse

    At Bot Libre we have always been developing artificial intelligence for the Metaverse, we just did not have a name for it. The Bot Libre AI engine has always been designed to have a mind with multiple senses, it’s just that with plain chat user interfaces, those senses could not be truly actualized. The Metaverse now provides a rich multi-sensory environment, and we are extremely excited to evolve the Bot Libre AI engine and platform to navigate the Metaverse.

    We are developing new 3D and VR apps and SDKs to integrate the Bot Libre platform with the evolving Metaverse. We are integrating Bot Libre’s NLP, vision, and spatial artificial intelligence algorithms into the Metaverse environment.

    What is the Metaverse

    The Metaverse is a term used to describe a new vision for the Internet as a decentralized 3D space. The Metaverse includes various technologies including:

    • 3D — 3D Worlds and Spaces
    • VR — Virtual Reality
    • AR — Augmented Reality
    • AI — Artificial Intelligence
    • Web3 — Crypto Currencies, NTFs, Block Chain

    Why the Metaverse Needs AI

    The Metaverse needs chatbots and AI to enable immersive interactions with users.

    • VR/AR user interfaces are based on speech, chat, and 3D interaction, blending well with chatbots
    • Metaverse is 24/7, businesses, events, online schools, and games that engage users in this space require chatbots and automated interactions
    • The Metaverse is multi-sensory, AI bots need to integrate NLP, vision, audio, spatial awareness, and navigation.

    Why AI Needs the Metaverse

    To evolve, AI needs an immersive multi-sensory environment which is the Metaverse. Existing AI models are single-purpose, single-sensory. True intelligence requires multi-sensory learning and a rich environment to interact with other intelligence entities.

    The Bot Libre OMNI Deep Learning Model

    The human brain is not a single neural network, but a kludge of multiple networks all interacting with each other at multiple levels. The concept of the Bot Libre OMNI model is that if you feed the output nodes and deep links from multiple deep learning models, actively processing continuous input from multiple senses into OMNI meta models, you can achieve a higher level of intelligence than possible from a single model.

    Join Us

    We are looking for businesses, organizations, and developers that are interested in being early adopters of the Metaverse technologies, in order to shape, play, participate, and even profit from the Metaverse, by working with us to drive our open source metaverse AI solution.

    We will be starting our Bot Libre Metaverse Beta Program soon. If you are interested in applying to be part of the program please contact sales@botlibre.biz.


    Why the Metaverse Needs AI, and AI Needs the Metaverse was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Alexa and Cortana end their partnership quietly.

    Now, if you ask Alexa to use Cortana for some reason you will just hear Alexa says “sorry, the service is no longer available”. The main reason behind this is the removal of the deal that Alexa had made with microphone Cortana a few years ago. Both of them wiped the integration away without making much noise among fans. Officially the climax of this connection was made on September 18 but didn’t get much spotlight.

    Cortana and Alexa

    Cortana and Alexa tied their connection for Cortana to reach a much wider audience than it had with their own Cortana products. But now, there’s nothing to wonder about the decision behind this disconnection as it’s pretty obvious. However, the importance of the deal always remains iconic as back then Alexa was just a new platform that was providing the ability to run Microsoft programs like Outlook through Cortana. It’s not like they have disconnected themselves from other integration as Alexa can still work on Windows PCs.

    However, it’s not the time for Cortana to dissolve because it’s still available in other terms, it’s just done with its smart speaker abilities. You can still use it via Microsoft Outlook to set up any conference or join just by commanding.

    Don’t forget to give us your 👏 !


    Alexa and Cortana end their partnership quietly. was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Nvidia and kore.ai tie-up for Voice AI customer service.

    Conversational AI startup platform Kore.ai crosses $73.5 million series C funding round as Nvidia has added $3.5 million to their funding round. And this investment is indicating the sign of teaming up for the integration of Voice AI technology for customer service centers.

    Kore.ai and Nvidia

    Kore.ai has made its name by creating a wide virtual assistant platform to build, test and deploy voice and text-based customer service. As soon as their name spreads, the company claims to be a giant tech who has managed more than a billion interactions. However, the company has already funded $73.5 million where an extra of 3.5 million has been added by Nvidia. The investment has been made to tie up with kore.ai and work for advanced conversational Ai projects and platforms.

    According to Kore.ai, Nvidia Riva’s specially designed SKD will help to build an advanced technology AI brand voice to enhance customer service and other relations. Riva is the part of expanded conversational AI of Nvidia.

    Nvidia’s GPU also makes any Ai much accurate and faster than others to provide a more instant and effective response to customers.

    “This relationship will allow us to further optimize the contact center experience for customers and agents thereby improving the speed of business for enterprises, large and small,” Kore CEO Raj Koneru stated.

    Nvidia is gradually extending their advanced Ai technological services from allowing cars to park themselves automatically to virtual humans whereas, kore.ai helps to boost enterprise’s business by optimizing customer service experience. Thus the tie-up between these two companies is quite significant.

    Don’t forget to give us your 👏 !


    Nvidia and kore.ai tie-up for Voice AI customer service. was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • How to Create a AI Chatbot in Python Framework

    Chatbots are software tools created to interact with humans through chat. The first chatbots were able to create simple conversations based on a complex system of rules. Using Flask Python Framework and the Kompose Bot, you will be able to build intelligent chatbots.

    In this post, we will learn how to add a Kompose chatbot to the Python framework Flask.

    Pre-requisites:

    You will need a Kommunicate account for deploying the python chatbot.

    Kommunicate is a no-code, hybrid chatbot platform that is built over a powerful Conversational AI system.

    Also, you will need Python and the Flask framework installed on your system. To read more info about the Flask framework, please follow this link.

    We will be using Flask in this tutorial. If you are looking to add Dialogflow chatbot to the Django framework, you can see this tutorial.

    Steps to Create a Chatbot using Kompose and Flask Python Framework:

    Step1: Login to your Kommunicate dashboard. If you don’t already have a Kommunicate account, you can create one here.Navigate to the Kompose bot builder category and create a new bot by selecting the “Create Bot” button.

    Step 2: Navigate to the Kompose Bot Builder, select your bot and click on the “Settings” option present at the top right corner.

    Click on the Webhook option present on that page. Here, we need to put the Webhook Name and Webhook URL.

    Step3: Create Webhook URL using Python with Flask and enable the webhook server using ngrok

    The webhook requires a URL, and it should be an HTTPS protocol. The webhook URL will receive a POST request from the Kompose Bot every time an intent triggers the webhook.

    We are using the Python programming language and the Flask framework to create the webhook.

    Create a file (for example — app.py). Import all the necessary libraries (ex: os, JSON, flask_ngrok, request) needed for Python. Please check if you have Flask on your system. If not, install it using pip, and here’s the documentation for the same.

    To handle all the agent webhook requests, we need to define and add a route/webhook method with a POST request. This URL /webhook will receive a POST request. It executes all the methods inside the method.

    After setting up the Python process, let’s use flask ngrok to create a public URL for the webhook and listen to port 5000 (in this example). For Kompose webhook, you will need an HTTPS secured server since the local server (localhost) will not work. You can also use a server and point a domain with HTTPS to that server.

    You will get the following URL:

    https://85e6-203-189-248-8.ngrok.io/webhook , where the webhook is the POST route for Kompose we mentioned in the Python file.

    Step 4: Configure Webhook inside Kompose Settings Page

    Copy the URL you created (https://85e6-203-189-248-8.ngrok.io/webhook) — in this example and paste it into the Kompose webhook URL field. Here, I have written the Webhook name as “Test.”

    Step 5: Create an intent by clicking on the +Add button under the “Answer” section and “Train the Bot.”

    Here, I have created Flask intent and added a training phrase as “What is Flask?”

    Step 6: Click on the “Bot Says” option and select the webhook that you created earlier. Here, I have selected the Test webhook created earlier. Now, click on “Train Bot.”

    Step 7: Testing

    Once the setup is done, you can easily add it to your website or apps using Kommunicate.

    & test if the Python chatbot is working.

    There you have it, a Python chatbot for your website created using the Flask framework. If you want to read more about how to build a chatbot, you can visit our blog post here.

    Originally Published at https://www.kommunicate.io/ on 26/05/2022


    How to Create a AI Chatbot in Python Framework was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Twitter Bot Investigation

    I started to dive into the shit show that involves Twitter misleading Texans on the number of bots on the website. If you want to read all…

  • Create WhatsApp Bot with Twilio Using Python Tutorial with Examples

    WhatsApp is unarguably the most popular messaging app which helps people to connect across the globe. It is absolutely fair to say WhatsApp is becoming an integral part of our life. The Platform has more than two billion monthly active users. With this much potential user base, any business cannot afford to ignore WhatsApp. We all are experiencing how beautifully businesses are leveraging platforms to engage with their customers.

    Furthermore, many businesses are using a WhatsApp Chatbot to automate various business operations to provide a better experience to users. There are many platforms such as Twilio which allow businesses to integrate the chatbot on WhatsApp.

    In this tutorial, we will learn how to connect our WhatsApp account with Twilio sandbox and further how we can send different responses through Twilio. Moreover, when we send any file to the Twilio Whatsapp account then get that file at the server.

    Chatbots, AI & VOICE Conference 2022 (chatbotconference.com)

    Here we learn how we can get different types of responses from the bot such as:

    • Text
    • Image
    • Video
    • Document
    • Audio

    Steps to create a WhatsApp Bot

    Step 1: Create a Twilio account by visiting the website.

    Step 2: Go to the Twilio WhatsApp website.

    Step 3: Connect Twilio with WhatsApp.

    Then we need to go to WhatsApp and send the message to the given number as described in shown above screenshot. When we send the message, it appears as shown in the below screen.

    On the Twilio sandbox, we will also get a note of congratulations.

    Step 4: Install some libraries.

    $ pip install flask 
    $ pip install twilio

    Step 5: Create a flask app.

    Add below code below to create a simple flask app and run it.

    from flask import Flask 
    app = Flask(__name__)
    @app.route("/")
    def wa_hello():
    return "Hello, World!" if __name__ == "__main__":
    app.run(debug=True)

    After running the code we will find the localhost link in our terminal such as http://127.0.0.1:5000/ and when we visit that link, we can see the “Hello, World!” message there.

    Step 6: NGROK setup.

    First download ngrok in the local system.

    Go to the Ngrok and type the command “ngrok http 5000” after running this command you will get the links.

    From that Ngrok links, copy the HTTPS link and paste it to your browser. We can see the response is the same as we got for the local host.

    Step 7: Twilio connection.

    Copy the below code and prepare the python script.

    from flask import Flask, request 
    from twilio.twiml.messaging_response import MessagingResponse
    app = Flask(__name__) 
    @app.route("/wa")
    def wa_hello():
    return "Hello, World!"
    @app.route("/wasms", methods=['POST'])
    def wa_sms_reply():
    """Respond to incoming calls with a simple text message."""
       # Fetch the message 
    msg = request.form.get('Body').lower()
       # Reading the message from the whatsapp      
    print("msg-->",msg)
    resp = MessagingResponse()
    reply=resp.message()
    # Create reply
    if msg == "hi":
    reply.body("hello!")
    return str(resp)
    if __name__ == "__main__": app.run(debug=True)

    With this code, we are reading the message sent by the user to the Twilio number and if it reads the “hi” message then it responds with the “hello!” message.

    Now we need to run the above code script. For the link which we will get from the Ngrok, we need to copy that link and paste it to the Twilio account.

    To paste the Ngrok link into the Twilio account, go to the website.

    Paste your link in the given section with the endpoint that you have decided. In this section we are adding ‘/wasms’ with Ngrok URL, the endpoint we are using for the flask app.

    And then scroll down and click on save.

    Now go to WhatsApp and message the Twilio bot with a “hi” message.

    The bot will respond with the “hello” message.

    Step 8: Send different forms of files through the bot.

    We can also get the different files such as images, videos, audio, and document files through our chatbot. This can be done by sharing the file URL in the media section.

    By running the following code we can also get files through the bot.

    from flask import Flask, request 
    from twilio.twiml.messaging_response import MessagingResponse
    app = Flask(__name__)
    @app.route("/wa")
    def wa_hello():
    return "Hello, World!"
    @app.route("/wasms", methods=['POST'])
    def wa_sms_reply():
    """Respond to incoming calls with a simple text message."""
        # Fetch the message 
    msg = request.form.get('Body').lower()
        # Reading the message from the whatsapp 
    print("msg-->",msg)
    resp = MessagingResponse()
    reply=resp.message()
        # Create reply 
    # Text response
    if msg == "hi": reply.body("hello!") # Image response elif msg == "image":
    reply.media('https://raw.githubusercontent.com/fbsamples/original-coast-clothing/main/public/styles/male-work.jpg',caption="jj ccp")

    # Audio response
    elif msg == "audio": reply.media('http://www.largesound.com/ashborytour/sound/brobob.mp3')
    # Video response
    elif msg == "video": reply.media('https://www.appsloveworld.com/wp-content/uploads/2018/10/640.mp4')
       # File response
    elif msg == "file": reply.media('http://www.africau.edu/images/default/sample.pdf'
    )
    # resp = MessagingResponse()
    # resp.message("You said: {}".format(msg))
      else: 
    reply.body("from you") return str(resp)
    if __name__ == "__main__": 
    app.run(debug=True)

    In the media section, we can pass the URL of the file and in the body section, we are passing the text that we want to send.

    It will try to read the message sent by the user and when it encounters a specific message then it will respond to it with the reply that we had fed to it.

    We need to type an image and the bot will respond with the image. Similarly, we can do with other forms of files.

    Step 9: Upload an image and get it at the backend.

    First, we will upload an image to the bot.

    And see what type of JSON we are getting at the backend.

    From this response, we will try to get the URL from the file and the extension for the file and save it to our computer.

    For that, we need to add the following code to our previous code.

    from flask import Flask, request 
    from twilio.twiml.messaging_response import MessagingResponse
    app = Flask(__name__)
    @app.route("/wa")
    def wa_hello():
    return "Hello, World!"
    @app.route("/wasms", methods=['POST'])
    def wa_sms_reply():
    """Respond to incoming calls with a simple text message."""
    # Fetch the message
    Fetch_msg= request.form print("Fetch_msg-->",Fetch_msg)
    try:
    # Storing the file that user send to the Twilio whatsapp number in our computer
    msg_url=request.form.get('MediaUrl0')
    # Getting the URL of the file
    print("msg_url-->",msg_url)
    msg_ext=request.form.get('MediaContentType0')
        # Getting the extension for the file 
    print("msg_ext-->",msg_ext)
    ext = msg_ext.split('/')[-1]
    print("ext-->",ext)
    if msg_url != None:
    json_path = requests.get(msg_url)
    filename = msg_url.split('/')[-1]
    open(filename+"."+ext, 'wb').write(json_path.content)
       # Storing the file except: print("no url-->>") 
    msg = request.form.get('Body').lower()
       # Reading the messsage from the whatsapp 
    print("msg-->",msg)
    reply=resp.message()
    # Create reply
    # Text response
    if msg == "hi":
    reply.body("hello!")
        # Image response 
    elif msg == "image": reply.media('https://raw.githubusercontent.com/fbsamples/original-coast-clothing/main/public/styles/male-work.jpg',caption="jj ccp")
      # Audio response     
    elif msg == "audio": reply.media('http://www.largesound.com/ashborytour/sound/brobob.mp3')

    # Video response
    elif msg == "video":
    reply.media('https://www.appsloveworld.com/wp-content/uploads/2018/10/640.mp4')
      # Document response     
    elif msg == "file": reply.media('http://www.africau.edu/images/default/sample.pdf')
    else:
    reply.body("from you")
      return str(resp)   

    if __name__ == "__main__":
    app.run(debug=True)

    After getting the URL from the response we will save the URL in another variable and then we will also extract the extension for the file which we have uploaded. Then we are trying to get the name for the file on which we will be saving the file on our computer. For that, we are getting the file name through the URL which we have got in response. After getting all the information we are saving the file with the help of the file name and the extension for the file.

    After running the code we can find that the image that we send to the bot is saved to our computer.

    We can also try another file because for that file also we are getting the URL and through the URL we are saving the file to our computer.

    Here any message is detected which is not defined then it will respond with the “from you” message.

    By following the above tutorial, we have learned that with the help of Twilio sandbox connect and WhatsApp how we can get text messages, images, videos, audios, and files from the Chatbot. Then, how we can upload the different types of files that we need to send to the chatbot, to store them on our computer. You can find the full integration code in our Github Repository.

    Hope you liked our tutorial! You can try it on your own and if you face any difficulty then do let us know in the comment.

    Want to learn how to build a chatbot for other platforms? Well, you can follow our Chatbot development tutorial to build Telegram Bot, Slack Bot, and Discord Bot.

    Originally published at Create WhatsApp Bot with Twilio Using Python Tutorial with Examples on April 19, 2022.


    Create WhatsApp Bot with Twilio Using Python Tutorial with Examples was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • Create Slack Bot Using Python Tutorial with Examples

    Introduction

    Slack is a useful tool for remote teams to interact more quickly and keep documents in one location. Slackbot is helpful for creating automatic messages for many purposes.

    Here in this tutorial, we will learn how we can create a bot in slack and add it to our channel and get the text response from the bot, and further how we can get an image, video, audio, or file through the bot.

    Chatbots, AI & VOICE Conference 2022 (chatbotconference.com)

    In addition to that, we will also learn how to save the file sent by the user in the channel to the bot on the server-side. Here we will also learn how we can get customized responses from the bot such as buttons and polls.

    Here we learn how we can get different types of responses from the bot such as:

    • Text
    • Image
    • Video
    • Document
    • Audio
    • Buttons
    • Poll

    Steps to create a Slack Bot

    Step 1: Open slack API console. ( https://api.slack.com/).

    Step 2: Click on “Your apps”.

    Step 3: Click on “Create New App”.

    Step 4: Click on “From scratch “.

    Step 5: Now give your app name and select workspace then click on the “Create App” button.

    Step 6: Click on the “App Home” button and click on “Review Scopes to Add”.

    Step 7: After clicking on the “Review Scope to Add” button, scroll down and find the Scope section. Then click on the “Add an OAuth Scopes” Button and add “chat: write” as shown in the below image.

    Step 8: Now click on “Install to Workspace” and press on “Allow” to generate an OAuth token.

    Step 9: Now create a python file (bot.py) and copy the above “OAuth Token” and paste it into the .py file as shown below image.

    SLACK_TOKEN="<Your Token>"

    Step 10: Now we install slack client python packages using “pip install slackclient” in our virtual environment.

    Step 11: Now we create the channel in slack and add our app to it. To open your slack account go to the channel bar and click on the “+” sign. Then click on “Create a new channel”.

    Step 12: Now type your channel name and click on the “Create” Button.

    Step 13: Now Add your app to the channel by just typing “/invite @Your_App_Name” (use the app name that you want to connect with the channel) in channel chat.

    Step 1 4: Now import the slack module and follow the code shown in the image below. Using this code we can send a “Hello” message to our “#test” channel. Also, we will discuss how to create a channel in the next step.

    import slack

    SLACK_TOKEN="<Your Token>"

    client = slack.WebClient(token=SLACK_TOKEN)
    client.chat_postMessage(channel='#justtest',text='Hello')

    Step 15: Now we will see how we can respond to the “Hi” message from the user with a “Hello” message from the bot.

    First off, all go to the Slack Developer Console in that go to event subscription and Enable Events.

    Step 16: Now install some packages.

    $ pip install flask 
    $ pip install slackeventsapi

    Step 17: Now just create a simple flask app like shown below.

    import slack
    from flask import Flask
    from slackeventsapi import SlackEventAdapter

    # This is slack token
    SLACK_TOKEN="<Your Token>"

    app = Flask(__name__)

    client = slack.WebClient(token=SLACK_TOKEN)
    client.chat_postMessage(channel='#justtest',text='Hello World!')


    if __name__ == "__main__":
    app.run(debug=True)

    The channel name and channel=’#justtest’ string should be matched otherwise, it will not work.

    Step 18: Now again go to the Slack Developer Console. In that go to “Basic Information” in the left panel, then scroll down to “Signing Secret” copy it, and add it to the code.

    Step 19: Now after adding Signing Secret to our code we need to pass it to the slack event adapter.

    import slack
    from flask import Flask
    from slackeventsapi import SlackEventAdapter

    SLACK_TOKEN="<Your Token>"
    SIGNING_SECRET="<Your SIGNING SECRET>"

    app = Flask(__name__)
    slack_event_adapter = SlackEventAdapter(SIGNING_SECRET, '/slack/events', app)

    client = slack.WebClient(token=SLACK_TOKEN)
    client.chat_postMessage(channel='#justtest',text='Hello World!')


    if __name__ == "__main__":
    app.run(debug=True)

    Step 20: Now we need to run this code and we will notice that now we will have a webserver running on http://127.0.0.1:5000/.

    Now we will need NGROK for running that program and get the public IP address by running the code “ngrok http 5000” on NGROK and then we will get a public IP address.

    Now we need to again go to the Slack Developer Console, then go to Event Subscription and paste Ngrok URL with the endpoint that we define in the code.

    Step 21: After that scroll down and go to the “Subscribe to bot events” then go to “Add Bot User Events” and then add a message. channels to it.

    After that click on Save Changes.

    Step 22: Now go to “OAuths and Permission” and scroll down to “Scopes” there you will see that a scope name “channels: history” is added, if not then add it to the “Scopes”.

    Now Just Scroll up to “OAuth Tokens” & “Redirect URLs”. Click on Reinstall App and then click on Allow.

    Step 23: Now we need to create a route, create a function that can handle all these events.

    Here in the code, we can get the event information about what that event was about like the message that was sent in the text and all of that.

    Channel_id will return the channel id in which the message was sent.

    User_id will return the id of the user who sends the message.

    Text will give us the text which was written by the user.

    Then below is the code to check the message when the user says “hi” and the slack bot responds with “Hello”.

    import slack
    from flask import Flask
    from slackeventsapi import SlackEventAdapter

    SLACK_TOKEN="<Your Token>"
    SIGNING_SECRET="<Your SIGNING SECRET>"

    app = Flask(__name__)
    slack_event_adapter = SlackEventAdapter(SIGNING_SECRET, '/slack/events', app)

    client = slack.WebClient(token=SLACK_TOKEN)

    @ slack_event_adapter.on('message')
    def message(payload):
    print(payload)
    event = payload.get('event', {})
    channel_id = event.get('channel')
    user_id = event.get('user')
    text = event.get('text')

    if text == "hi":
    client.chat_postMessage(channel=channel_id,text="Hello")

    if __name__ == "__main__":
    app.run(debug=True)

    After running the code when we type “hi” in our channel, we will get the reply “Hello” from the bot.

    Step 24: Get an image through the bot.

    Now to get the image through the bot we need to store the image at the specific path which we want to send to the user and give that path of the image in the file section.

    Now by adding the following code to the above code we can get an image through the bot.

    if text == "hi":
    client.chat_postMessage(channel=channel_id, text="Hello")

    if text == "image":
    try:
    response = client.files_upload(
    file='/home/pragnakalpdev23/mysite/slack_file_display/download (2).jpg',
    initial_comment='This is a sample Image',
    channels=channel_id
    )
    except SlackApiError as e:
    # You will get a SlackApiError if "ok" is False
    assert e.response["ok"] is False
    # str like 'invalid_auth', 'channel_not_found'
    assert e.response["error"]
    print(f"Got an error: {e.response['error']}")

    Here we can also send the caption with the text so to send the text with the image we need to pass the text in the “initial_comment”.

    After running the code when we type “image” in our channel, we will get a reply from the bot with an image that we have passed.

    Step 25: Get avideo from the bot.

    To get the video from the bot we need to do the similar thing as we have done in the image and we also need to specify the path where the video is stored.

    First, we will need to import the following library to our code.

    from slack.errors import SlackApiError

    Now add the below code.

    if text == "video":
    try:
    response = client.files_upload(
    file='/home/pragnakalpdev23/mysite/slack_file_display/sample-mp4-file-small.mp4',
    # initial_comment='This is a sample video',
    channels=channel_id
    )
    except SlackApiError as e:
    # You will get a SlackApiError if "ok" is False
    assert e.response["ok"] is False
    # str like 'invalid_auth', 'channel_not_found'
    assert e.response["error"]
    print(f"Got an error: {e.response['error']}")

    Here also get the caption with the video by passing the caption in “initial_comment”.

    After running the code, if we type “video” in our channel then we will get a reply from the bot with the video that we have passed.

    Step 26: Get audio and document through the bot.

    In a similar way, we can get the audio and document through the bot by passing the file for audio and video.

    Here also we add a caption with audio and document that we are sending by passing the text in the “initial_comment”.

    if text == "file":
    try:
    response = client.files_upload(
    file='/home/pragnakalpdev23/mysite/slack_file_display/sample.pdf',
    # initial_comment='This is a sample file',
    channels=channel_id
    )
    except SlackApiError as e:
    # You will get a SlackApiError if "ok" is False
    assert e.response["ok"] is False
    # str like 'invalid_auth', 'channel_not_found'
    assert e.response["error"]
    print(f"Got an error: {e.response['error']}")

    if text == "audio":
    try:
    response = client.files_upload(
    file='/home/pragnakalpdev23/mysite/slack_file_display/file_example_MP3_700KB.mp3',
    # initial_comment='This is a sample audio',
    channels=channel_id
    )
    except SlackApiError as e:
    # You will get a SlackApiError if "ok" is False
    assert e.response["ok"] is False
    # str like 'invalid_auth', 'channel_not_found'
    assert e.response["error"]
    print(f"Got an error: {e.response['error']}")

    Now run the code, when we type “audio” in our channel then we will get the reply from the bot with audio that we have passed and when we type “file” in our channel then we will get the reply from the bot with a file that we have passed.

    Step 27: Get Images with different methods.

    We can also get images by passing the image in different formats. Go to the website for the Slack Block Builder. There we can see a screen like this.

    Here on the Left side scroll to the image and click on “no title”. After that, you will see the block of code which is generated. So copy that block of code.

    Now merge the below code with the previous code and run it.

    if text == "img":
    message_to_send = {"channel": channel_id, "blocks": [
    {
    "type": "image",
    "image_url": "https://i1.wp.com/thetempest.co/wp-content/uploads/2017/08/The-wise-words-of-Michael-Scott-Imgur-2.jpg?w=1024&ssl=1",
    "alt_text": "inspiration"
    }
    ]}


    try:
    return client.chat_postMessage(**message_to_send)
    except:
    print("No hi found")

    After running the code when we type “img” in our channel, we will get the reply from the bot with an image which URL we have passed in the URL section.

    Step 28: To get the radio button.

    Now to get the radio button from the bot we need to again go to the website.

    Now again scroll down to the “Input” and select “radio buttons” and then copy that payload of code.

    Now we need to add the below code in our previous code of the “blocks” section.

    if text == "radiobtn":
    message_to_send = {"channel": channel_id, "blocks": [
    {
    "type": "input",
    "element": {
    "type": "radio_buttons",
    "options": [
    {
    "text": {
    "type": "plain_text",
    "text": "*this is plain_text text*",
    "emoji": True
    },
    "value": "value-0"
    },
    {
    "text": {
    "type": "plain_text",
    "text": "*this is plain_text text*",
    "emoji": True
    },
    "value": "value-1"
    },
    {
    "text": {
    "type": "plain_text",
    "text": "*this is plain_text text*",
    "emoji": True
    },
    "value": "value-2"
    }
    ],
    "action_id": "radio_buttons-action"
    },
    "label": {
    "type": "plain_text",
    "text": "Label",
    "emoji": True
    }
    }
    ]}

    try:
    return client.chat_postMessage(**message_to_send)
    except:
    print("No hi found")

    After running the code when we type “radiobtn” in our channel then we will get a reply from the bot with a radio button.

    We can also add more responses and combine many responses together. To get the response we just need to create the payload from the website, copy the payload and paste it in the “blocks” section as we have done in the above code.

    Step 29: Get an image at the server-side if we send the image to the bot.

    First, send the image to the bot.

    Now check at the terminal we will get the JSON response as shown in the below screenshot when we send an image to the bot.

    Now we need to get the file name, URL for the file, and user id for the image that we have uploaded by adding the given code in our previous code.

    We will get the response like the following in our terminal.

    try:
    img_name = payload['event']['files'][0]['name']
    print("img_name:-->", img_name)
    img_url = payload['event']['files'][0]['url_private']
    print("img_url:-->", img_url)
    user_n = payload['event']['files'][0]['user']
    print("user_n:-->", user_n)
    file_name = img_url.split('/')[-1]
    print("file_name:-->", file_name)
    except:
    print("not found 1-->>")

    Now we have saved the image that we send by passing the URL and saving the file in our current directory at our server-side.

    For that, we need to add the following code to our previous code.

    try:
    img_name = payload['event']['files'][0]['name']
    print("img_name:-->", img_name)
    img_url = payload['event']['files'][0]['url_private']
    print("img_url:-->", img_url)
    user_n = payload['event']['files'][0]['user']
    print("user_n:-->", user_n)
    file_name = img_url.split('/')[-1]
    print("file_name:-->", file_name)
    try:
    json_path = requests.get(img_url)
    except:
    print("nnnn mm ")
    if user_n != "<Your Bot User Id>":
    with open(file_name, "wb") as f:
    f.write(json_path.content)
    except:
    print("not found 1-->>")

    Here in the code, we are specifying the user id of the bot because when any file such as an image, video, etc is being sent by the bot then also we are getting a similar type of JSON at the backend which we get when a user sends any file. So we only want the files that have been sent by the user not by the bot to be stored on our server-side. Therefore we are specifying the user id for the bot and if the user id is not equal to the bot user id then only the file would be saved.

    After adding the code and running it we can see that our image will be saved on our server-side.

    Step 30: Get video at the server-side if we send video to the bot.

    First, send the video to the bot.

    We will get the following JSON at the backend.

    Similarly, we need to extract the file name, URL, and user id. Then run the code in the similar way we get in the video at our server-side.

    Similar way we can also get audio and file on our server-side.

    We have implemented the code to get the image, video, and audio from the file and also the same on the server-side if we send the file to the bot. In this Github Repository, you can find the full code implementation with all functionalities that we discussed in the above tutorial.

    With the tutorial, we learned about the creation of the slack bot and getting the response through the bot such as text, image, video, audio, and file. Moreover, when a user sends any type of file to the channel bot we can get it saved at the server-side in our computer.

    Try to build Slack Bot by yourself with the tutorial. Please comment below if you will face any difficulty while following the tutorial. You can also implement such a bot on the Telegram channel. You may do this by following our Telegram Bot instructions given in the tutorial.

    Originally published at Create Slack Bot Using Python Tutorial With Examples on April 13, 2022.


    Create Slack Bot Using Python Tutorial with Examples was originally published in Chatbots Life on Medium, where people are continuing the conversation by highlighting and responding to this story.

  • 20 Tipps zur Entwicklung & Optimierung von Voice & Chatbots