Saturday, July 19, 2008

T-Mobile Address Manager export "Hack"

Edit: Thanks to yincrash for pointing out that they changed their namespace on this object to TMO.ABPORTAL.



My friend Candice got a 1st Gen iPhone on the cheap and needed to get her numbers from T-Mobile's new online Address Manager (TAB). It does syncing to and from a regular T-Mobile phone but the iPhone isn't a regular T-Mobile Phone. The app is new and they have a note about it not syncing changes made on the website to the phone yet and either by design or evil plotting there was no way to export the contacts.



My vocation to the rescue! They were using the prototype.js library to run the app and after some digging around I found the data store.
TMO.ABPORTAL.ABIHM.ContactManager is the object that manages the contacts' actions and the _datas property is an array of contact javascript objects. So in the firebug console I wrote some code to get the contacts and wrote a csv file to an empty div. I then took that div into Wordpad to get the lines to break correctly on Windows and did an import into Windows Address Book. The rest is history!



Here's the code I used:



var data = ["firstname,lastname,name,homeMobile,homePhone1,homePhone2,workMobile,workPhone1,workPhone2"];
TMO.ABPORTAL.ABIHM.contactManager._datas.each(function(person) {
var a = [];
a.push(person.firstname);
a.push(person.lastname);
a.push(person.name);
a.push(person.homeMobile);
a.push(person.homePhone1);
a.push(person.homePhone2);
a.push(person.workMobile);
a.push(person.workPhone1);
a.push(person.workPhone2);
data.push(a.join(","));
});
$('L_footer_pane').update(data.join('\r\n'));


8 comments:

yincrash said...

I was really excited to find this, but it appears that t-mobile has changed their web contact manager because firebug gives me the error:
ABIHM is not defined.

yincrash said...

ah. it appears that the DOM changed.

ABIHM is now TMO.ABPORTAL.ABIHM

yincrash said...

thanks!

prodrive555 said...

Thanks for the update. I've edited the code.

Unknown said...

How exactly did u get this to work?

kelli said...

i'm curious how this works too. which section do i put the code in?

yincrash said...
This comment has been removed by the author.
yincrash said...

decided to make a blog post of my own for owners of the new T-Mobile G1. I edited your code to work with Google's CSV format and made it so it is wrapped with a <textarea> tag for easy copy/pasting. Also, I made a little step by step tutorial to try and make it more accessible for everyone! :)

How to export t-mobile contacts to google contacts!