Buildbot lets you easily send notifications via Twitter DM's. It was originally created for sending DM's when a long running build completes, but can easily be used for arbitrary DM's (for example, a daily cron job that DM's the weather).
Alternatively, if you want to receive an SMS when your job completes, check out buildbot_sms.
It is composed of two parts, the bbot script and the Buildbot server.
Prepend bbot to any command to receive a DM with the exit status when it completes.
bbot ant long-running-build
- Follow @buildbot
- You will receive a DM from @buildbot with a token for your account (for example:
"octopusorange"
) - Set
$BBOT_TO
and$BBOT_TOKEN
environment variables
# Add to your sh profile
export BBOT_TO="your_twitter_handle"
export BBOT_TOKEN="octopusorange"
- Put the
bbot
script somewhere in yourPATH
cp ./bbot /usr/local/bin/bbot
chmod +x /usr/local/bin/bbot
GET
requests to bldbt.com/send
require 3 parameters:
to
: twitter handle of the user to send to (ie ladygaga). This user must follow @buildbottoken
: token for the user specified byto
. This token was automatically sent as a DM from @buildbot when you followedtext
: URL encoded text to send
curl -G --data-urlencode "text=This is a test of the emergency buildbot system" bldbt.com/send?to=$BBOT_TO&token=$BBOT_TOKEN
The twitter API limits each account to 250 DM's per day. Want to send a lot? Set up your own instance of Buildbot below.
The twitter API also prevents you from sending the same dm more than once. To get around this, when a send fails because the text has been sent before, buildbot prepends a random hex string to the text.
An instance of the Buildbot server is running at bldbt.com, using the @buildbot account to send DM's. To set up your own server:
- Create a new twitter app, and generate access tokens for it
- Clone the Buildbot Repo
git clone [email protected]:jatenate/buildbot.git
cd buildbot
git remote add upstream git:https://github.com/jatenate/buildbot.git
npm install
- Set
CONSUMER_KEY
,CONSUMER_SECRET
,ACCESS_TOKEN
, andACCESS_SECRET
inserver/modules/twitter.js
- Start redis and buildbot
redis-server
node server/app.js