- Google Account
-
Check-In URLs:
-
Getting the Cookie:
- Follow the HoyoLab Cookie Extraction Guide to obtain the cookie required for both daily check-ins and code redemption.
- Use an incognito/private browsing window as recommended in the guide to ensure you copy the correct account's cookie.
-
Create a New Project:
- Go to https://script.google.com/ (you'll need a Google account).
- Create a new project by clicking "+ New Project".
-
Paste the Code:
-
Configuration:
-
Paste your
cookie: In the config object, add the following (replace placeholders with your actual data):const config = { genshin: { data: [ // "account_cookie_1", // "account_cookie_2", // ... more account cookies ] }, honkai: { data: [ // "account_cookie_1", // "account_cookie_2", // ... more account cookies ] }, starrail: { data: [ // "account_cookie_1", // "account_cookie_2", // ... more account cookies ] } };
-
Discord notifications (optional): Set
DISCORD_WEBHOOKto your webhook URL to get a Discord message for every check-in.const DISCORD_WEBHOOK = "https://discord.com/api/webhooks/...";
-
Automatic code redemption (optional): Set
enableCodeRedemptiontotrueto redeem new codes on each scheduled run, including when the account has already checked in that day. Not supported for Honkai Impact 3rd.const config = { enableCodeRedemption: true, // redeem new codes automatically notifyOnRedeemFailure: false, // also report codes that failed to redeem // ... };
When
DISCORD_WEBHOOKis set, one summary message is sent per account listing the codes that were redeemed and the rewards they granted. Nothing is sent when there are no new codes. Turn onnotifyOnRedeemFailureif you also want to hear about codes that failed - this includes a link to redeem them manually. Codes that fail for a temporary reason (expired cookie, redemption cooldown, network errors) are retried on the next run; expired, invalid, and already-used codes are not.Authentication failures send a separate Discord alert even when
notifyOnRedeemFailureisfalse. Check-in and redemption failures are deduplicated per game and HoYoLAB account across runs. A failed delivery is retried; another alert is allowed after the cookie changes or all reported authentication failures recover. Alerts show the HoYoLAB ID, plus the game UID, nickname, and region once the account has been looked up successfully at least once. After a redemption login error, remaining codes for that account wait until the next run. Other accounts continue normally.Check-in and redemption use different tokens, so successful check-in does not prove that redemption credentials are valid. Replace the affected account's cookie when alerted. This Apps Script does not refresh cookies using
stoken.Redeemed codes are now tracked per game account. When updating from a version with shared code history, current codes may be attempted once again for each account because the old history cannot identify which account redeemed them.
-
Save the Project: Click on the floppy disk icon to save your project.
-
-
Before Running It:
-
Trigger the Function (Recommended):
- In the Apps Script editor, click on the "Triggers" icon (clock symbol) in the left sidebar.
- Click "+ Add Trigger" and configure:
- Function to run:
checkInAllGames - Event source:
Time-driven - Type of time-based trigger:
Day timer - Select time: Set your desired time for daily check-ins.
- Function to run:
- Save the trigger. This will automatically run your script every day at the specified time.
-
Final Step:
Run setupCookieKeepAlive once from the Apps Script editor and authorize it if prompted. This creates a separate trigger that runs keepAliveCookies every six hours. Running setup again replaces your existing keep-alive trigger. Your daily check-in trigger stays as configured.
Each run reads the check-in status for each configured game/account without checking in or redeeming codes. Successful requests send no Discord messages; authentication failures use the existing deduplicated alerts. A successful keep-alive does not clear a code-redemption authentication failure.
This is experimental: periodic requests have not been verified to extend cookie lifetime or prevent CAPTCHA. It does not refresh tokens using stoken, save replacement cookies, or restore expired sessions. Expired cookies still need replacing.
To stop it, run removeCookieKeepAlive from the editor. Trigger setup and removal apply to triggers created by your Google account.
- Authorization: The first time you run the script, it will ask for authorization to access your Google account.
- Logs: View the execution logs by clicking on the "Executions" icon (play button symbol) in the Apps Script sidebar.



