I've written many "how-to" guides for the Raspberry Pi in my quest to learn this platform.

One of my art projects for 2014 has been Bot Collective— an ongoing project where I make Twitterbots that "live" on the Raspberry Pi and have physical bodies. I've defintely become familiar with how to make a Pi into a Twitter engine and want to share my knowledge.

I'd like to see many Bot Friends in the Twitterverse.

This Instructable will show you how to set up your Raspberry Pi to send Twitter messages. 

I learned most of this from this makeuseof guide, which was nearly complete. I wanted to cover the additional steps of setting up your application via Twitter. But the rest of this guide has been invaluable to me.

Before doing this Instructable, please make sure you have your Raspberry Pi up and running, which you can do with The Ultimate Raspberry Pi Configuration Guide Instructable.

I'm using the Mac OS for this guide, but you can extend the principles to other operating systems.

Step 1: Install Twython Packages

I'm using ssh to access to Raspberry Pi. My IP address for the SD card for this is Your IP address may be different — just change the address accordingly.

Open the Terminal window and on the command line, type:
ssh pi@
If you are running directly hooked into the monitor, you can skip this step.

Run the latest package updates and upgrades, just to make sure everything is current — you will have to have wifi access for this step. Type in the commands:
sudo apt-get update

sudo apt-get upgrade
There will be a lot of waiting and Linux garble, so take break and pet your cat. Now, install the Twython libraries, which will let you use Twitter from Python using these three commands:
sudo apt-get install python-setuptools
sudo easy_install pip
sudo pip install twython
You'll see more Linux stuff and then you should be good to go.
<p>I would like to say thanks for providing this valuable stuff and this one is perfect post which told me the perfect way to control Raspberry Pi Twiiterbot. </p><p><a href="https://www.promoocodes.com/" rel="nofollow">https://www.promoocodes.com/</a></p>
Huge thanks for this article, it formed the foundation for what became @NixieBot on Twitter. Coming up on 50k tweets any day now! More details here: https://hackaday.io/project/9155-nixiebot <br>Source here: https://github.com/Zedsquared/NixieBot<br>Command list etc here: http://nixiebot.tumblr.com/ref
<p>question please,</p><p>I tried as you wrote but some error appear :</p><blockquote>File &quot;tweet_test.py&quot;, line 2, in &lt;module&gt;</blockquote><blockquote>from twython import Twython</blockquote><blockquote>File &quot;/usr/lib/python2.7/dist-packages/twython/__init__.py&quot;, line 23, in &lt;module&gt;</blockquote><blockquote>from .api import Twython</blockquote><blockquote>File &quot;/usr/lib/python2.7/dist-packages/twython/api.py&quot;, line 14, in &lt;module&gt;</blockquote><blockquote>from requests_oauthlib import OAuth1, OAuth2</blockquote><blockquote>ImportError: No module named requests_oauthlib</blockquote><p>Can you help please.</p><p>thanks</p>
<p>I found the solution</p><p>it's should to do this :</p><blockquote>sudo apt-get install -y python3-oauth python3-oauth2client python3-oauthlib python3-requests-oauthlib</blockquote>
Great idea, great Instructable!
<p>Hey guys, great article! What are your thoughts on tools like https://www.tweetfavy.com and similar sites? I've been using their service to get more followers on my Twitter account, great stuff!</p>
<p>i wonder how can i tweet the picture by using this method ?</p><p>and if i can what is the thin that i need to do?</p>
Yes, you can. It's been awhile since I've done this, so I can't remember off the top of my head.<br /><br />But, my SelfiesBot project does this and here is the code on my GitHub repo, which you are welcome to adapt and try out.<br /><br />https://github.com/scottkildall/SelfiesBot<br /><br />Good luck!<br />Scott
<p>So i want to make the bot tweet random quotes i set up, How may i do that? Im a beginner in coding and i cant find this anywhere!</p>
<p>Still kinda curious, how can I get what someone said on a website, and tweet that?</p>
<p>Also, can I tweet images?</p>
yes indeed, check out these examples (both mine)<br /><br />JustDiedBot - a Twitterbot that scrapes Wikipedia and tweets RIPs for recent deaths:<br />https://github.com/scottkildall/justdiedbot<br /><br />SelfiesBot - a Twitterbot that tweets images of itself<br />https://github.com/scottkildall/SelfiesBot<br /><br />have fun!
<p>This is awesome! I made a bot to tweet whether my apartment complex got electricity or not! :) Thank you!</p>
<p>Thanks for the instructable, got it running quick. I do get warnings &quot;InsecurePlatformWarning&quot; and &quot;SNIMissingWarning&quot; but the tweets get posted. installed various libraries/updates but still warns, but its working.</p><p>Modified the script to accept message from argument. I'll use it on my startup script to send me when it powers up, might also set it up for the ncid server, motion and temperature tweets :)</p>
<p>Great tutorial! I have a question though. Do you have any thoughts on how to address what twitter says:</p><p>Keep the &quot;Consumer Secret&quot; a secret. This key should never be human-readable in your application.</p>
<p>This is awesome</p>
<p>Hi Scott,</p><p>I made this, but I want to add a times tamp to the tweet it sends . What would be the best way to incorporate this in to the script?</p><p>Thanks</p><p>M </p>
Hi, the various threads on Stack Overflow will be help answer this question:<br><br>This one is pretty good:<br>http://stackoverflow.com/questions/13890935/timestamp-python<br><br>Best,<br>Scott<br>
<p>So have to try this. Have you gotten a chance to &quot;publish[ing] the code and an Instructable on Twitter-scraping&quot;</p>
<p>Hey. Awesome tut. But is there a way to let him favorite every tweet from the people he follows?</p>
awesome tutorial
<p>wow, great tutorial! I'm going to use it for my ipcam notifications!</p>
<p>Hello! I love your twitterbot idea. I came across your post looking for info on a project of my own. I am trying to create a Pi that will perform GPIO activity (blink LED, turn on sprinklers, whatever) when a twitter account receives a certain direct message.</p><p>My ultimate goal is to use Google Calendar, through IFTTT, to tweet my sprinklers on.</p><p>I hate my stupid commercial sprinkler controller this much.</p>
<p>Hi!</p><p>thank you for the great HOWTO, i made i small BOT that scrape the wikiquote of the day from the wikiquote atom feed service and tweet it every day! By now it is only for Italian, but well if you want follow me @RaspzenBOT.</p><p>Thank you!</p><p>Luca</p>

About This Instructable




Bio: Scott Kildall is an new media artist and researcher. He works at Autodesk, Pier 9 and is an artist-in-residence with the SETI Institute
More by scottkildall:Pier 9 Guide: Fusion 360 to OMAX Waterjet Strewn Fields: Waterjet Etching Into Stone Pier 9 Resource: Setting up 2D profiles for CNC in Fusion 360 
Add instructable to: