Upgrade to Pro — share decks privately, control downloads, hide ads and more …

PyLadies Dublin Sep Meetup: Building Conversational Bot using Twilio & Python

PyLadies Dublin
September 15, 2020
47

PyLadies Dublin Sep Meetup: Building Conversational Bot using Twilio & Python

We are delighted to have Mridu Bhatnagar talking about "Building Conversational Bot using Twilio and Python".

I'd like to thank all those who have been attending and watching our videos, we appreciate your support as it took a lot of work to set it up, if you are curious, you can read Vicky's post about it: https://dev.to/pyladiesdub/live-streaming-from-zoom-meet-via-obs-to-youtube-2l3h - any feedback would be helpful to make this process smoother and easier to manage. 🥰

Any announcements, events, call to actions, resources, projects, ideas, please add to https://cryptpad.fr/pad/#/2/pad/edit/mWZs+zlZOqA2fuP4UOhU9Xcn/ - I will be using this for announcements before the talk(s).

Event Details: https://www.meetup.com/PyLadiesDublin/events/272547215/

Youtube video of talk: https://youtu.be/IVJGnzD_mBU

Building Conversational Bot using Twilio and Python by Mridu Bhatnagar
---------------------------------------------------------------------
Length: 45 mins
Description:
The talk provides a walkthrough to build a vocabulary bot for WhatsApp using Python and Twilio. On querying the bot the bot returns word definition, synonyms, antonyms, examples.

About Mridu Bhatnagar:
I am a Python Developer. I enjoy converting ideas into applications. I love speaking at various meetups and conferences.
https://www.twilio.com/blog/build-vocabulary-bot-whatsapp-python-twilio

=========================================

SCHEDULE (*subject to change)
--------------------------------------------
18:30 - 18:35 Event Starts / Settle down with cup of tea/coffee
18:35 - 18:45 Welcome & Announcements by Vicky
18:45 - 19:30 Building Conversational Bot using Twilio and Python by Mridu Bhatnagar
19:30 Event ends

=========================================

CALL FOR SPEAKERS 📢

Interested in speaking at our upcoming meetups, please submit talk details to: https://pyladiesdublin.typeform.com/to/Rr6hVJ

If you have referrals of speakers you want us to invite, let us know also, being a virtual event helps close the boundaries of inviting speakers further afield than Ireland. 😊

QUESTIONS Email [email protected].

=========================================

FAQ
-----
Q. I'm not female, is it ok for me to attend?
A. Yes, PyLadies Dublin events are open to everyone at all levels.

Q. What do you do at PyLadies Dublin Meetups?
A. We have short (or long talks), demos, folks working on their own projects, ask questions on Python-related topics, work on projects together or generally chit-chat and meet like-minded people.

Q. Do you have a Code of Conduct?
A. Yes, you can find it at dublin.pyladies.com

PyLadies Dublin

September 15, 2020
Tweet

Transcript

  1. Building a Conversational
    Bot for WhatsApp
    - Mridu Bhatnagar

    View Slide

  2. Vocabulary Bot (Vocab Bot)
    - Features
    1. Word definition
    2. Synonyms
    3. Antonyms
    4. Examples

    View Slide

  3. Requirements
    - Python Version 3.6+
    - Flask
    - ngrok
    - A smartphone with active phone number and WhatsApp installed.
    - Twilio Account - https://www.twilio.com/try-twilio?promo=d34aPv

    View Slide

  4. Configure the Twilio WhatsApp Sandbox
    - Open the Twilio WhatsApp Sandbox -
    https://www.twilio.com/console/sms/whatsapp/learn

    View Slide

  5. View Slide

  6. Configure the Twilio WhatsApp Sandbox
    - Check your WhatsApp contact list. Newly saved number
    would appear in contacts.
    This is our Bot: Vocab Bot :-)

    View Slide

  7. Create a Python Virtual Environment

    View Slide

  8. For Mac/Linux Users

    View Slide

  9. For Windows Users

    View Slide

  10. Create a Flask ChatBot Service

    View Slide

  11. Create a Webhook

    View Slide

  12. Receiving the incoming message from
    user

    View Slide

  13. View Slide

  14. TwiML Message Response Object

    View Slide

  15. Bot Response Logic
    Incoming message format - “Hi”
    Output message - “Hello hi”

    View Slide

  16. View Slide

  17. Twilio’s Response Template Format

    View Slide

  18. Running the application

    View Slide

  19. Run ngrok

    View Slide

  20. Output of ngrok terminal

    View Slide

  21. Twilio Sandbox for WhatsApp
    NOTE - Add your ngrok forwarding url in the textbox corresponding to When
    a message comes in field.

    View Slide

  22. Sending Dynamic Responses

    View Slide

  23. Data Source - API
    - Either create your own API or you can use any public APIs that
    are available.
    - Example Use Cases
    - Google Maps API
    - Cat Pictures API
    - Twitter API
    - Google News API
    - Github API

    View Slide

  24. Integrating a API using Python

    View Slide

  25. View Slide

  26. Detailed Resource Link for Building your own Bot
    - Tutorial - Build a Vocabulary Bot for WhatsApp with Python and Twilio
    - Flask 101 - https://flask.palletsprojects.com/en/1.1.x/
    - List of Public APIs - https://github.com/public-apis/public-apis

    View Slide

  27. View Slide