This is continuation of the previous article describing how to use adsb_hub to send email notifications triggered by aircrafts entering specific area of 3D space defined by latitude, longitude, minimum/maximum altitudes and radius. If you haven't read it, please do. It contains important bits and pieces that will not be repeated here.
Let's start with creating of brand new Twitter account just for alerts and Twitter application owned by new account. Whole process described here with great details. When it's done and assuming you're having working adsb_hub on Raspberry Pi let's update python with couple additional components:
Some configuration changes are necessary:
Content of file shown below:
Replace /home/pi/realadsb/alerts/sendalerts.sh in "command" with /home/pi/realadsb/tweets/sendalerts.sh Don't forget to save the file and then run commands:
Replace apiKey, apiSecret, accessToken, accessTokenSecret values with information generated for Twitter application. Similarly to email notifications you can update sendalerts.sh to use different types of data for triggering tweets:
Same file contains template for tweet text. Finally start adsb_hub:
After some time you should see new tweets posted to your Twitter account. If template was not changed they will look like this: