Last time using an API and my attempt at creating a Twitterbot

The last time we worked with an API was when we used google’s geolocation to find the postal of a partial address. It came out great I tried it with my location and a few others to see what would come up. When a user enters the partial address they will see the zip code for the address and then the address.


The next thing I worked on was making a twitterbot. I used Abraham/twitteroauth which is a php library that you can use with Twitter OAthu REST API. To make this twitter bot I first had to start by making  an application at appstwitter so you can get your API keys and access tokens which you need to work with. The first thing I learn to do with the twitterbot pull up my account info to make I was connected correctly. After that I made my first post from the twitterbot and made sure that it was working.



After that I went back to the REST APIs to do some research on how I could search tweets about a certain topic or twitter account. I finally manage to figure out how to do this by using the GET function and making a query on what I wanted to lookup. I searched up a few posts about Bungie.



The next thing I wanted to do was learn how you could be able to retweet a post. I started my research and found that you could by using the POST function and using the ID of the post that you wanted to retweet. To find the ID of the post that I wanted to retweet I had to first search up the tweet by using the GET function. After I got the ID of the twitter post I had to go back to using the POSt function to retweet it. I tried to get it to print out what I retweeted but I refresh then all I got was that i had already retweeted the post. When I checked my account I saw that I had.


This is all I manage to get done with the twitter bot. I did do some research on how I might have been able to retweet certain posts every hour or 2 but I wasn’t able to find anything that was helpful to me. So I do wish I had some more time to figure that out which I might in the future.

You may also like...

Leave a Reply

Your email address will not be published. Required fields are marked *