In today’s fast-paced digital world, real-time information is key — especially when it comes to cryptocurrency prices. Traders and enthusiasts often rely on instant updates to make informed decisions. One powerful way to deliver timely crypto price data is through a WeChat group bot that responds to user queries with up-to-the-minute market information.
This article walks you through building a cryptocurrency price quotation robot for WeChat groups using the Python Wechaty library. With just a few lines of code, you can create an intelligent bot that listens for coin symbols in group chats and automatically replies with accurate, formatted pricing data — all while mentioning the person who requested it.
Whether you're a developer exploring chatbot automation or a crypto enthusiast looking to enhance your WeChat community experience, this guide offers a practical, step-by-step implementation.
Core Features of the Crypto WeChat Bot
The bot delivers the following core functionalities:
- Keyword detection: Scans incoming messages in WeChat groups for cryptocurrency symbol keywords (e.g., BTC, ETH).
- Real-time price fetching: Retrieves live market data from trusted sources.
- Smart response with mention: Replies directly in the group chat with detailed price info and @mentions the requester.
- Lightweight & customizable: Built using modular code, easy to extend or adapt.
👉 Discover how easy it is to integrate real-time crypto tools into your workflow.
How It Works: Architecture Overview
At its core, the bot uses python-wechaty — a Python SDK for WeChat automation that allows developers to build bots capable of interacting with contacts, rooms (groups), and messages programmatically.
When a user types a cryptocurrency symbol (like btc
) or mentions the bot with @Robot btc
, the system triggers a chain of actions:
- Message is captured by the
on_message
event listener. - The bot extracts the coin symbol.
- Validates if the coin is supported.
- Fetches current market data.
- Sends back a rich-text message with price details, including USD/CNY values, 24h change, market cap, and more.
Step-by-Step Implementation
1. Project Setup & Configuration
Before running the bot, configure essential parameters in the settings file:
class Notice:
EVENT_NAME = 'notice_python'
TOKEN = '{your IFTTT TOKEN}'
KEY = '{your notice key}'
class Zengr:
APP_CODE = '{your app code}'
class PATH:
PATH_JSON = path_root + '/coin_list.json'
class WECHAT:
TOKEN = '{your wechaty token}'
class CoinGK:
PATH_JSON = path_root + '/conin_list_cgk.json'
Key Components Explained:
- Notice: Optional IFTTT integration for mobile notifications (tested on iPhone).
- Zengr: A lesser-known crypto data provider; limited free tier, not recommended for production.
- CoinGK: Uses CoinGecko-like APIs; free but rate-limited.
- Default Source – Feixiaohao (Non-official Crypto Tracker): The project currently defaults to data from Feixiaohao, a popular Chinese crypto tracking site. No API key required — but please use responsibly to avoid overloading their servers.
⚠️ Note: The default Wechaty token is from the official free version, which only supports a 7-day trial. For long-term use, consider contributing to Wechaty or purchasing a license. Alternatively, explore the UOS web protocol for login-free access: Use Web Protocol Guide
2. Core Message Handling Logic
Here’s the main message processing function:
async def on_message(msg: Message):
text: str = msg.text()
room: Optional[Room] = msg.room()
if text.startswith('@Robot'):
rev_str = text.replace(' ', '')
symbol = rev_str.split(' ')[-1]
else:
symbol = text
talker = msg.talker()
if get_conin_seq(symbol) > 0:
await room.say(get_price(symbol), mention_ids=[talker.contact_id])
This function:
- Listens for messages starting with
@Robot
or plain coin symbols. - Strips whitespace and isolates the cryptocurrency symbol.
- Checks if the coin is supported via
get_conin_seq()
. - Calls
get_price()
and sends a formatted reply with mention.
3. Price Data Formatting Function
def get_price(symbol):
symbol = symbol.upper()
idx = get_conin_seq(symbol)
result = get_coin(idx)
ret = '\n' \
'【名称】 ' + result['data'][0]['fullname'] + '-' + result['data'][0]['name'] + '\n' \
'【USD价格】 ' + '$' + str(result['data'][0]['current_price_usd']) + '\n' \
'【CNY价格】 ' + '¥' + str(result['data'][0]['current_price']) + '\n' \
'【全球市值】 ' + '$' + str('%.2f' % (result['data'][0]['marketcap']/100000000)) + '亿\n' \
'【24H涨幅】 ' + str(result['data'][0]['change_percent']) + '%\n' \
'【24H换手】 ' + str(result['data'][0]['turnoverrate']) + '%\n\n' \
+ str(time.strftime("%Y-%m-%d %H:%M:%S", time.localtime())) + '\n' \
'数据来源:非小号'
return ret
This returns a clean, readable message containing:
- Full name and symbol
- USD and CNY prices
- Market cap (in billions)
- 24-hour price change and turnover rate
- Timestamp and data source attribution
Currently supports the top 500 coins listed on Feixiaohao.
👉 Stay ahead with live crypto insights — start integrating smart tools today.
4. Running the Bot
To launch your bot:
python wechat/wechaty.py
After scanning the QR code to log in, add the bot to any WeChat group. Users can then query prices by simply typing a symbol like btc
or @Robot eth
.
Within seconds, the bot responds with structured pricing info — making it perfect for trading groups, investor communities, or educational chats.
Best Practices & Considerations
While powerful, this bot operates within certain constraints:
- Avoid frequent requests: Excessive queries may trigger rate limiting or IP blocking from data providers.
- Respect usage policies: Since no authentication is needed for Feixiaohao, abuse could jeopardize public access.
- Monitor stability: WeChat’s unofficial protocols may break after app updates; regular maintenance is advised.
Frequently Asked Questions (FAQ)
Q: Can I use this bot on personal WeChat accounts?
A: Yes, as long as your account can join groups and send messages. However, avoid aggressive automation to prevent account restrictions.
Q: Is the Feixiaohao API documented?
A: Not officially. This project reverse-engineers public endpoints. Always verify response formats and handle errors gracefully.
Q: Can I switch to CoinGecko or Binance API?
A: Absolutely. You can modify get_coin()
to pull data from Binance, OKX, or CoinGecko APIs for broader coverage and reliability.
Q: Does this work on Windows, macOS, and Linux?
A: Yes — since it's Python-based, it runs cross-platform. Ensure Python 3.8+ and dependencies are installed.
Q: How do I extend support beyond 500 coins?
A: Update the coin_list.json
file with additional symbols or connect to a dynamic API that supports full listings.
Q: Can I deploy this bot 24/7?
A: Yes — run it on a VPS or cloud server with persistent internet. Use process managers like pm2
or supervisor
for uptime.
Final Thoughts
Building a cryptocurrency price bot for WeChat groups enhances communication efficiency and brings real-time financial intelligence directly into social conversations. Powered by Python Wechaty, this solution demonstrates how minimal code can yield high utility — ideal for developers aiming to automate information delivery in private communities.
With proper configuration and responsible usage, this tool becomes a valuable asset for crypto traders, educators, and community managers alike.
👉 Explore advanced crypto data tools that power next-gen trading strategies.
Keywords: cryptocurrency price bot, Python Wechaty, WeChat group bot, real-time crypto prices, crypto quotation robot, automated messaging, blockchain notification system