Turned out to be a piece of cake! (Note: replace xyz@us.ibm.com with your internal ibm id). Just open the command editor (chrome://ubiquity/content/editor.html), cut and paste this code below and run the bluetwit command.
const BLUETWIT_STATUS_MAXLEN = 160;
CmdUtils.CreateCommand({
name: "bluetwit",
takes: {status: noun_arb_text},
preview: function(previewBlock, statusText) {
var previewTemplate = "Updates your BlueTwit status to: <br/>" +
"<b>${status}</b><br /><br />" +
"Characters remaining: <b>${chars}</b>";
var truncateTemplate = "<br />The last <b>${truncate}</b> " +
"characters will be truncated!";
var previewData = {
status: statusText.text,
chars: BLUETWIT_STATUS_MAXLEN - statusText.text.length
};
var previewHTML = CmdUtils.renderTemplate(previewTemplate,
previewData);
if(previewData.chars < 0) {
var truncateData = {
truncate: 0 - previewData.chars
};
previewHTML += CmdUtils.renderTemplate(truncateTemplate,
truncateData);
}
previewBlock.innerHTML = previewHTML;
},
execute: function(statusText) {
if(statusText.text.length < 1) {
displayMessage("BlueTwit requires a status to be entered");
return;
}
var updateUrl = "https://bluetwit.hursley.ibm.com/BlueTwit2/xyz@us.ibm.com";
jQuery.ajax({
type: "POST",
url: updateUrl,
data: "comment=" + statusText.text,
dataType: "xml",
error: function() {
displayMessage("BlueTwit error - status not updated");
},
success: function() {
displayMessage("BlueTwit status updated");
}
});
}
});
I seem to get an error message but post is successful.
Comment by ragtag — September 2, 2008 @ 5:06 pm
[...] Embraces Social Media, BusinessWeek by Stephen Baker Social Networking: The Twitterverse Debates Porting Twitter Script for Ubiquity to BlueTwit Twitter Behind the Firewall (Photos on Flickr) [...]
Pingback by Enterprise Microsharing Apps: Read All About Em | Pistachio — November 3, 2008 @ 3:07 am
Works for me…the ’success’ messages don’t work for me but it posts so what the heck. Thanks very much for the code.
Comment by emilyobyrne — January 6, 2009 @ 7:48 am
Was able to eliminate the error seen by changing jQuery.ajax call data return type to “text” and not “xml” since the return is not xml.
Comment by John — February 3, 2009 @ 11:38 am