Browse files

first commit

  • Loading branch information...
0 parents commit e44fe3b6b4fab34da0422bba78aaaebe564febaa @chadsmith committed Jun 22, 2010
0 README
No changes.
8 applets/twitter/applet.json
@@ -0,0 +1,8 @@
+{
+ "name" : "Twitter",
+ "sms_name" : "Twitter",
+ "voice_title" : "Latest Tweet",
+ "sms_title" : "Latest Tweet",
+ "description" : "Returns the latest tweet from the specified user.",
+ "type" : ["sms", "voice"]
+}
BIN applets/twitter/icon.png
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 applets/twitter/twiml.php
@@ -0,0 +1,23 @@
+<?php
+$name = AppletInstance::getValue('name');
+
+$ch = curl_init();
+curl_setopt($ch, CURLOPT_URL, 'http://api.twitter.com/1/users/show.json?screen_name=' . $name);
+curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, 2);
+curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, false);
+$tweet = json_decode(curl_exec($ch));
+curl_close($ch);
+
+$response = new Response();
+
+if(AppletInstance::getFlowType() == 'voice'){
+ $response->addSay($tweet->status->text);
+ $next = AppletInstance::getDropZoneUrl('next');
+ if(!empty($next))
+ $response->addRedirect($next);
+}
+else
+ $response->addSms($tweet->status->text);
+
+$response->Respond();
16 applets/twitter/ui.php
@@ -0,0 +1,16 @@
+<div class="vbx-applet">
+ <div class="vbx-full-pane">
+ <h3>Twitter username</h3>
+ <p>Must not be a protected account.</p>
+ <fieldset class="vbx-input-container">
+ <input type="text" name="name" class="medium" value="<?php echo AppletInstance::getValue('name','chadsmith'); ?>" />
+ </fieldset>
+ </div>
+<?php if(AppletInstance::getFlowType() == 'voice'): ?>
+ <h2>Next</h2>
+ <p>After this applet is tracked, continue to the next applet</p>
+ <div class="vbx-full-pane">
+ <?php echo AppletUI::DropZone('next'); ?>
+ </div><!-- .vbx-full-pane -->
+<?php endif; ?>
+</div><!-- .vbx-applet -->
6 plugin.json
@@ -0,0 +1,6 @@
+{
+ "name" : "Twitter",
+ "author" : "Chad Smith <chad@nospam.me>",
+ "description" : "Returns the latest tweet from the specified user.",
+ "url" : "http://twitter.com/chadsmith"
+}

0 comments on commit e44fe3b

Please sign in to comment.