Home / Companies / Twilio / Blog / Post Details
Content Deep Dive

How to Read Top Live News Headlines Using the News API and Twilio SMS

Blog post from Twilio

Post Details
Company
Date Published
Author
David Mbochi
Word Count
1,669
Language
English
Hacker News Points
-
Summary

To fetch the latest news headlines from the US using News API and Twilio SMS, you need to know your personal phone number, a valid News API key, and your Twilio account credentials. The `BBCNewsSMS` class is used to send an SMS with the most recent top news headline from the US. This class uses the `HttpClients` and `HttpClient` classes to make a GET request to the News API URL, parses the JSON response, extracts the necessary information, formats it into a string, and sends it via Twilio SMS. The program must be run on an IDE like IntelliJ IDEA with the required dependencies installed, including Maven, Java development kit (JDK) 8 or above, and Twilio account trial credits.