Hello readers, I am back with another article in which I am showing you how you can create a Whatsapp Bot using Python, Flask, NGrok, and Twilio.
So let's start
So let's see the steps of Implementing the project.
Create a free account in Twilio for accessing the Whatsapp SandBox.
Verify your mobile number in Twilio to access WhatsApp Sandbox.
Install all the requirements in the system.
Create Flask code (API) for the chatbot.
Create NGRok server.
Copy NGRok URL and paste in WhatsApp Sandbox.
Send the message to the Twilio Whatsapp number.
You will get a response from the WhatsApp bot. (If everything fines)
Follow these steps
I assumed that you have created an account in Twilio.
Now install the following requirements into your system using PIP.
flask twilio pyngrok requests
Now we need to create the flask application for it, we are creating the simple application.
For more explanation of this code, see the video tutorial. The link is given below.
Now we need to run this Flask Code.
You will get the output like this.
Now open another CMD, make sure you have installed NGRok, now write the following command. You can use the port number in command according to yours.
ngrok http 5000
You will get the output like this. This CMD will be your log also, so don't close it.
Do copy this URL, add '/bot' into the URL, and copy it. Your URL should be like this.
Now, open Whatsapp Sandbox in Twilio, Go & paste copied URL into the " When a message comes in" section. You can see below.
Click on "Save"
Now let's see it is working or not.
Open Whatsapp, send the message to a number that you have used in the verification process of WhatsApp Sandbox. If everything is fine then you will get the output.
It is done here, if you didn't get anything please refer to this tutorial.
Like, Share & Subscribe Machine Learning Hub
Thanks for reading, give a like to our blog.
Donation Here we are just asking for the donations, if you want to donate us something then my UPI id and Paypal ID are mentioned below. We are creating quality content on youtube and making blogs for the same and publishing code openly. We are doing an open-source contribution. UPI ID - kushalbhavsar58@ybl Paypal - https://paypal.me/spidy1820 Wise - firstname.lastname@example.org Note - We are just asking for donations. Thanks & Regards Machine Learning Hub