#!/usr/bin/env python3 """发送最佳实践的企业微信模板卡片""" import asyncio import sys sys.path.insert(0, '/app') from app.services.wecom_service import WecomService async def main(): wecom = WecomService() try: print("📤 发送最佳实践模板卡片...") result = await wecom.send_template_card_message( user_id="sxn", # 主标题区域 main_title="您的IT咨询即将关闭", main_title_desc="请尽快回复坐席,否则咨询将自动结束", # 副标题 sub_title_text="点击下方按钮直接跳转到咨询页面", # 高亮区域 - 突出剩余时间 emphasis_title="2分钟", emphasis_desc="剩余处理时间", # 跳转按钮列表 jump_list=[ { "type": 1, # 跳转URL "title": "立即回复", "url": "https://itsupport.servyou.com.cn/h5/", }, ], # 卡片点击区域 card_action_url="https://itsupport.servyou.com.cn/h5/", ) if result.get("errcode") == 0: print(f"✅ 发送成功! msgid: {result.get('msgid')}") else: print(f"❌ 失败: {result}") finally: await wecom.close() if __name__ == "__main__": asyncio.run(main())