Categories: Softprodigy

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: https://bit.ly/2xYDpie

Anirudh Sharma

Anirudh Mohan Sharma has been working at SoftProdigy since 2016. He is a Senior Software Engineer and has over 5 years of technical experience in the niche. He possesses a strong understanding of technologies like Java, Kotlin, React-Native, and Android. He is passionate about his work and loves to learn about new technologies. Apart from technical stuff, he likes watching Basketball and playing online multiplayer games.

Recent Posts

Automating Data Analysis: Why Should Midsize Companies Care?

Did you know that there are more than 30 million small and medium businesses in…

4 years ago

Building a Ride-sharing App like Uber: Everything You Need to Know

The on-demand apps development industry is growing at the fastest pace. It is because the…

4 years ago

Building a Hyperlocal Sports Streaming App: How to Choose the Right Tech Stack?

With the changing time, the market also changes to keep up with the current needs…

4 years ago

How to Build a Multi-Vendor Marketplace: A Guide to Create Your Own Amazon

Back in 1991, purchasing products with a few clicks was an extraordinary thing. But today,…

4 years ago

Connected Enterprise Planning: What is it, and why do you need it?

Ever since the pandemic thrashed the world economy and left enterprises helpless, planning and forecasting…

4 years ago

Some Effective CSS Solutions to Solve Common UI Challenges

Modern CSS has numerous use cases, like solving UI challenges. In the past, developers faced…

4 years ago