Company
Date Published
Author
Matthew Gilliard
Word count
764
Language
English
Hacker News points
None

Summary

Detecting robocalls using the Twilio Lookup API with the Nomorobo Spam Score Add-on is possible in Java. To start, a Twilio account and Java 8 or later are required, along with the Nomorobo add-on installed in the Twilio Console. A new Java project can be created using Maven, and the Twilio Java Helper Library can be added to it. The code initializes the Twilio client with environment variables for the account SID and auth token, then uses the `PhoneNumber` class to fetch data from the Nomorobo add-on for a specific phone number. The response includes a score indicating whether the number is likely a robocaller, which in this case was 1. To make the code more reusable, a method can be created that checks the score and returns a boolean value. This involves using the lower-level TwilioRestClient API to access the JSON response directly and then using JsonPath to read the value out of the JSON. The new code includes the JsonPath dependency in the pom.xml file.