Skip to content

Commit

Permalink
first commit
Browse files Browse the repository at this point in the history
  • Loading branch information
chadsmith committed Jun 23, 2010
0 parents commit e44fe3b
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 0 deletions.
Empty file added README
Empty file.
8 changes: 8 additions & 0 deletions 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"]
}
Binary file added 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 changes: 23 additions & 0 deletions 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 changes: 16 additions & 0 deletions 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 changes: 6 additions & 0 deletions 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.