Conduct real-name verification of Chinese National ID(中国身份证) with a Telegram bot
- Whether an ID # exists in MPS(Ministry of Public Security) system
- Whether the name provided matches the record in MPS system
- Shows the household register(户口) area of the holder
-
Install
requests
andpython-telegram-bot
pip install requests
pip install python-telegram-bot
-
Buy real-name verification service at Aliyun Marketplace here You may use another API interface. Simply modify
cnid_checker.py
-
Replace
APP_CODE
incnid_checker.py
with your own Aliyun appcode You can find your appcode in Aliyun Console -
Replace
API_TOKEN
inguard_id_checker.py
with your Telegram bot API key -
Fill the Telegram ID(s) of Telegram client account(s) that is going to use this bot in
authorized
inguard_id_checker.py
This avoids unauthorized people using your bot and Aliyun Marketplace API(API calls are charged by the provider). If you don't know your Telegram ID, searchGet My ID
in Telegram, this bot will send you the user ID.
Run the guard_id_checker.py
script to start the bot
python guard_id_checker.py
Check an ID card number by sending this message to the bot:
[CNID]-CNID_NUMBER-CHN_NAME
Replace CNID_NUMBER
and CHN_NAME
with ID number and name in simplified Chinese(简体中文)
After you send the message in correct format to the bot, it will process the checking and reply:
实名认证通过 Real-name verification passed!
- ID # and name is successfully verified实名认证失败 Real-name verification failed!
- No record in MPS system or name/ID # does no match姓名格式不正确 Incorrect name format!
- Name is not in correct format身份证格式不正确 Incorrect ID format!
- ID # is not in correct format系统维护 System maintenance
- API interface provider's system is under maintenance
If you send message to the bot with an unauthorized client account, the request will not be processed and you will get Not authorized
message.
Distributed under the MIT License. See LICENSE.md
for more information.
Project Link: https://github.com/songyuew/cnid_telegram_checker