Whilst not using the Twitter API, there is a really easy way to do this just using the Javascript console in a web browser.
- Open the Javascript console in your browser's developer tools
- Scroll to the bottom of the page using the below code
setInterval(function() { window.scrollTo(0, document.body.scrollHeight); }, 2000);
- Use this code to automatically unfollow anyone who doesn't follow you
$('.ProfileCard-content').each(function(){
var status = $(this).find('.FollowStatus').text();
var unfollowButton = $(this).find('.user-actions-follow-button');
if(!status){unfollowButton.click();
}});
Sorry as I know this doesn't involve the Twitter API, but thought I'd post it here as it is a solution.
Courtesy of https://realsocialseo.com/unfollow-twitter-users-dont-follow-back/