Build SMS-based Bot Using Laravel: Track COVID-19 Data without the Internet

World Health Organization (W.H.O.) recently declared the worldwide spread of Novel Coronavirus – a pandemic. While you stay at your home during these lockdowns, the information concerning the virus can be found on the internet. But, there are some people who don’t have easy access to the internet. In countries like Uganda, getting access to the internet is not easy. Fortunately, text messages are still alive and can help build communication in such countries.

Here is a useful guide that will help you build a simple SMS-based bot to get information about the Novel Coronavirus cases using Twilio Programmable SMS. Take a closer look at information shared by a reputed TokBox developer:

1. Create A New Laravel Project

The very first step is to create a new Laravel project. Open your terminal and then run the desired command using the Laravel installer. Now install the Twilio PHP SDK, which will be used for sending out SMS from the application.

Next, head over to your Twilio dashboard and copy your Account SID and Auth Token that are credentials used for authorizing requests made using the Twilio PHP SDK. You can save these credentials in your application in the project root directory.

2. Build the Bot Logic

The next part is writing out the application logic. Create a Controller to hold the application business logic and then open up a terminal in the project directory. Now, run the desired command to generate a new controller class. You can also seek help from a Twilio developer.

3. Create A Route

The third step is to create an entry point for your application. To do this, open up the file and make the required changes.

4. Set up the Twilio Webhook

Before testing the bot, you must update your Twilio phone number webhook settings with a publicly accessible route to your application. This will enable Twilio to know what to do whenever a new message is received.

5. Make Application Publically Accessible

Your application needs to be accessible via the internet in order to allow access to your Laravel project through a webhook. This can be achieved easily by using ngrok.

6. Update the Twilio Phone Number Configuration

Now select the active phone number section on your Twilio console for your application, then scroll down to the Messaging segment and update the webhook URL.

7. Test The Bot

After updating your webhook, you are now ready to test your application. Send a text with a country name to your active Twilio phone number. You should receive a response or an error message if otherwise.

With the help of this tutorial, you can successfully develop an SMS-based bot. This bot is highly responsive and effective in data gathering. In countries where the internet is not easily accessible, this bot can play a crucial role in this fight against Novel Coronavirus.  

Stay safe at your home! Remember, we will get out of this pandemic very soon!

Summary: Want to track COVID-19 data without using the internet? Well, here is a useful tutorial! Learn how to build a SMS-based bot to track COVID-19 data using Laravel.

Detailed tutorial is available on the official website of Twilio: