Skip to content

Instantly share code, notes, and snippets.

@alfonsokim
Forked from garkbit/force.js
Created January 24, 2017 21:01
Show Gist options
  • Save alfonsokim/61090addcaa4e605286519ec21a49654 to your computer and use it in GitHub Desktop.
Save alfonsokim/61090addcaa4e605286519ec21a49654 to your computer and use it in GitHub Desktop.
Force Habitica quest to start
(function(){
let userid = window.amplitude.options.userId;
let groupid = window.amplitude.options.userProperties.partyID;
let token = JSON.parse(window.localStorage.getItem('habit-mobile-settings')).auth.apiToken;
let url = `/api/v3/groups/${groupid}/quests/force-start`;
let http = new XMLHttpRequest();
http.open('POST', url, true);
http.setRequestHeader("x-api-key", token);
http.setRequestHeader("x-api-user", userid);
http.onreadystatechange = function() {
console.log(http.responseText);
}
http.send();
})();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment