A lightweight, secure, and free script that automatically collect HoYoLAB daily check in rewards.
Supports Genshin Impact, Honkai Impact 3rd, and Honkai: Star Rail. Support multiple accounts.
- Lightweight - The script only requires minimal configuration and it's only around 110 lines of code.
- Secure - The script can be self-deployed to Google Apps Script, no worries about data leaks.
- Free - Google Apps Script is currently a free service.
- Simple - The script can run without a browser and will automatically notify you through Discord or Telegram.
-
Go to Google Apps Script and create a new project with your custom name.
-
Select the editor and paste the code English ver / Chinese ver / Russia ver / Japan ver / Indonesia ver. Refer to the instructions below to configure the config file and save it.
-
Select "main" and click the "Run" button at the top.
-
Grant the necessary permissions and confirm that the configuration is correct (Execution started > completed).
-
Click the
Trigger
button on the left side / left tab and add a new trigger onAdd Trigger
button at bottom right.
Select the function to run: main
Select the event source: Time-driven
Select the type of time based trigger: Day timer
Select the time of day: recommended to choose any off-peak time between 09:00 to 15:00 or 09:00 AM to 03:00 PM.
const profiles = [
{
token: "account_mid_v2=1l9XXXXXXXXXX; account_id_v2=28XXXXXXX; ltoken_v2=v2_CANARIAXXXXXXXXXXXXXXX; ltmid_v2=1lXXXXXXX_XX; ltuid_v2=28XXXXXX;",
genshin: true,
honkai_star_rail: true,
honkai_3: true,
accountName: "YOUR NAME"
}
];
HoYoLAB has changed the rules for tokens on July 2023, switching from the previous "ltoken" and "ltuid" to "ltoken_v2" and "ltuid_v2".
Important
HoYoLAB has changed the cookie to HttpOnly cookie. It is no longer possible to read the cookies by using the getToken.js code.
Please use the method of manually copying the cookie to obtain the account_mid_v2, account_id_v2, ltoken_v2, ltmid_v2, and ltuid_v2.
HoYoLAB cookie settings
Follow this Intruction to get tokens
-
Go to HoYoLAB (https://www.hoyolab.com/) and log in.
-
Go to your profile page.
-
Open the developer tools (F12 or Ctrl+Shift+I). 4, Go to the "Network" tab.
-
Click on the "Preserve Log" / "Persist Logs" button.
-
Refresh the page.
-
Click on the getGameRecordCard request where the method is "GET" (it should be named "getGameRecordCard" with your HoYoLab UID).
-
Go to the "Cookies" tab.
-
Copy the "account_mid_v2", "account_id_v2", "ltoken_v2", "ltmid_v2", and "ltuid_v2"
Discord notification settings (only for Discord version)
const discord_notify = true
const myDiscordID = "20000080000000040"
const discordWebhook = "https://discord.com/api/webhooks/1050000000000000060/6aXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXnB"
-
discord_notify
Whether to enable Discord notify.
If you want to enable auto check-in notify, set it to true. If not, please set it to false. -
myDiscordID - Please enter your Discord user ID.
Whether you want to be ping when there is an unsuccessful check-in.
Copy your Discord user ID which like23456789012345678
and fill it in "quotes".
You can refer to this article to find your Discord user ID.
If you don't want to be pinged, leave the "quotes" empty. -
discordWebhook - Please enter the Discord webhook for the server channel to send notify.
You can refer to this article to create a Discord webhook.
Once you have finished creating the Discord webhook, you will receive your Discord webhook URL, which likehttps://discord.com/api/webhooks/1234567890987654321/PekopekoPekopekoPekopeko06f810494a4dbf07b726924a5f60659f09edcaa1
.
Copy the webhook URL and paste it in "quotes".
Telegram notification settings (only for Telegram version)
const telegram_notify = true
const myTelegramID = "1XXXXXXX0"
const telegramBotToken = "6XXXXXXXXX:AAAAAAAAAAXXXXXXXXXX8888888888Peko"
-
telegram_notify
Whether to enable Telegram notify.
If you want to enable auto check in notify, set it to true. If not, please set it to false. -
myTelegramID - Please enter your Telegram ID.
Use the
/getid
command to find your Telegram user ID by messaging @IDBot.
Copy your Telegram ID which like123456780
and fill it in "quotes". -
telegramBotToken - Please enter your Telegram Bot Token.
Use the
/newbot
command to create a new bot on Telegram by messaging @BotFather.
Once you have finished creating the bot, you will receive your Telegram Bot Token, which like110201543:AAHdqTcvCH1vGWJxfSeofSAs0K5PALDsaw
.
Copy your Telegram Bot Token and fill it in "quotes".
For more detailed instructions, you can refer to this article.
If the auto check in process is success, it will send "OK".
If you have already check in today, it will send "Traveler/Trailblazer/Captain, you've already checked in today"
Single HoYoLAB account auto check-in with Discord notification and ping.
Enable Genshin Impact and Honkai: Star Rail auto check in, enable Discord notify, ping in Discord./** Example **/
const profiles = [
{ token: "account_mid_v2=123xyzabcd_hi; account_id_v2=26XXXXX20; ltoken_v2=v2_CANARIAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX3406; ltmid_v2=123xyzabcd_hi; ltuid_v2=26XXXXX20;",
genshin: true,
honkai_star_rail: true,
honkai_3: false,
accountName: "HuTao" }
];
const discord_notify = true
const myDiscordID = "240000800000300040"
const discordWebhook = "https://discord.com/api/webhooks/10xxxxxxxxxxxxxxx60/6aXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXnB"
Two HoYoLAB accounts auto check-in with Telegram notification.
Enable Genshin Impact auto check-in on accountA, Honkai Impact 3rd auto check-in on accountB, enable Telegram notify./** Example **/
const profiles = [
{ token: "account_mid_v2=123xyzabcd_hi; account_id_v2=26XXXXX20; ltoken_v2=v2_CANARIAXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX3406; ltmid_v2=123xyzabcd_hi; ltuid_v2=26XXXXX20;",
genshin: true,
honkai_star_rail: false,
honkai_3: false,
accountName: "accountA" },
{ token: "account_mid_v2=456qwertyu_hi; account_id_v2=28XXXXX42; ltoken_v2=v2_GENSHINXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX5566; ltmid_v2=456qwertyu_hi; ltuid_v2=28XXXXX42;",
genshin: false,
honkai_star_rail: false,
honkai_3: true,
accountName: "accountB" }
];
const telegram_notify = true
const myTelegramID = "1XXXXXXX0"
const telegramBotToken = "6XXXXXXXXX:AAAAAAAAAAXXXXXXXXXX8888888888Peko"
- 2022-12-30: Project launched.
- 2023-04-27: Added support for Honkai Impact 3rd, and Honkai: Star Rail.
- 2023-04-27: Added switch for Discord notify.
- 2023-05-12: Updated get token process (#2).
- 2023-05-12: Added Telegram notify support (#3).
- 2023-05-13: Added support for multiple HoYoLAB accounts (#4).
- 2024-02-02: Improved readability, maintainability and added an experimental version which have discord and telegram notification in 1 code.
- 2024-12-03: Added support for Tears of Themis and Zenless Zone Zero, also added language specific for some country.