Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
TuGo SMS Backup
var backup = function(options) {
$.ajax({
url: "https://api-gb.tugoapp.com/users/me/history?from_version=0&page_size=" + options.numTexts + "&page_number=1&with_source=" + options.theirNumber + "," + options.myNumber + "&with_destination=" + options.theirNumber + "," + options.myNumber,
headers: {
"X-External-Transaction-Id": "blahblah123",
"Authorization": "Bearer " + options.token,
"X-User-Version": "1.2.0",
"X-Country-Code": "GB",
"X-User-Msisdn": options.myNumber,
"Accept-Language": "en-GB,en-US;q=0.8,en;q=0.6",
"X-User-Agent":options.xUserAgent
}
}).success(options.callback);
};
// Log in to https://go.tu.com/ and look at the request headers used to get the values of 'token' and 'xUserAgent'
// -- In Chrome: right click -> inspect element -> network -> history?...
// Then copy and paste everything into the console and see your message backup!
backup({
numTexts: 10000,
myNumber: "447777112233",
theirNumber: "447777445566",
token: "This should the long oauth token string. Copy the <token> part of the 'Authorization: Bearer <token>' header and paste it here!",
xUserAgent: "Paste the contents of the X-User-Agent header in here!",
callback: function(response) {
console.log(response);
}
});
@noahlucci

This comment has been minimized.

Copy link

@noahlucci noahlucci commented Nov 1, 2017

Hi cogwirrel,

Thank you for posting this! I'm looking to export my messages from TuGo and this looks like the perfect solution.

I'm not very experienced with JavaScript, and wondered whether you could help use your code.

Am I meant to paste it all into the "JavaScript Console"? If so, do I need to change of the first section (before "//Log in to...")?

I've found the request headers. Just so I'm clear, should the "token" start with "Bearer", and should the xUserAgent be "GConnect/XX.X.XX"?

When I run it in the Console I get an error message - "Uncaught SyntaxError: Invalid or unexpected token" - referencing "myNumber", so I'm just trying to find the flaw!

Thanks so much for your help - I really appreciate it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.