This tries to be a concise summary of: https://habitica.fandom.com/wiki/Google_Apps_Script#Auto_Accept_Quests
Prerequisites:
- Google Account
First off we need to fetch your habitica credentials.
Go here: https://habitica.com/user/settings/api and copy the User ID, i'll call this uuid, and API Token, i'll call it token.
Next we go to Google Apps Script and create a New Project: https://script.google.com/home/start
In the New Project delete everything from the input field and paste the following snippet.
const scheduleJoinQuest = () => {
const habId = '#HabiticaUserID#';
const habToken = '#HabiticaAPIToken#';
const partyAPI = 'https://habitica.com/api/v3/groups/party';
const headers = {
'x-api-user': habId,
'x-api-key': habToken,
};
const response = UrlFetchApp.fetch(
partyAPI,
{
method: 'get',
headers
}
);
const { data: { quest } } = JSON.parse(response);
if (quest.key && !quest.active && !quest.members[habId]) {
UrlFetchApp.fetch(
`${partyAPI}/quests/accept`,
{
method: 'post',
headers
}
);
}
}
Then Replace #HabiticaUserID# with the uuid and #HabiticaAPIToken# with the token.
The quotation marks around these two values are important
Now press the save symbol[optionally give the script another name then 'untitled script'].
Next up, well Execute the Script. So press the Play Button. You will get a warning for executing it. Give it Access to your Account. At some Point you have to press extend(or something like this my Google Account is german)
Will look something like the image above.
Now we are basically finished.
On the Left we'll click on the Clock. And now at the bottom on create new Trigger.
We'll just accept all the Standards which should create you a time-based hourly Trigger, meaning the Script will run every hour and check if there's a quest to accept.
After saving the Trigger you're done.
Congratulations you hopefully never have to accept a Quest again. 🥳