#!/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", # 来源 source_desc="智能IT服务平台", # 主标题 main_title="您的IT咨询即将关闭", main_title_desc="请尽快回复", # 副标题 sub_title_text="点击下方按钮直接跳转到咨询页面", # 高亮 emphasis_title="2分钟", emphasis_desc="剩余处理时间", # 关键信息 horizontal_content_list=[ {"keyname": "咨询内容", "value": "IT问题咨询"}, {"keyname": "坐席状态", "value": "已回复"}, ], # 按钮 jump_list=[ {"type": 1, "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())