{"id":28378180,"url":"https://github.com/tsinglinrain/wechatpay_to_notion","last_synced_at":"2025-06-26T21:31:28.244Z","repository":{"id":157263330,"uuid":"618437198","full_name":"tsinglinrain/WeChatPay_to_Notion","owner":"tsinglinrain","description":"Notion API记账|将导出的微信支付宝付款账单再次导入至Notion（注意：没有使用Wechat Pay, Alipay官方API）","archived":false,"fork":false,"pushed_at":"2025-03-05T10:55:26.000Z","size":16348,"stargazers_count":35,"open_issues_count":2,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-06-06T02:23:26.831Z","etag":null,"topics":["alipay","billing","notion-api","notion-client","notion-integration","wechatpay"],"latest_commit_sha":null,"homepage":"https://tsinglin.notion.site/68951a1caaba487a884cafcd5086810c?v=3d0c405e7cae405599aed2fe0f5233cc","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/tsinglinrain.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2023-03-24T13:18:16.000Z","updated_at":"2025-06-01T06:23:44.000Z","dependencies_parsed_at":"2024-06-04T14:18:11.407Z","dependency_job_id":"73d66add-30cf-41c9-9027-9e8ec903d99c","html_url":"https://github.com/tsinglinrain/WeChatPay_to_Notion","commit_stats":null,"previous_names":[],"tags_count":9,"template":false,"template_full_name":null,"purl":"pkg:github/tsinglinrain/WeChatPay_to_Notion","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsinglinrain%2FWeChatPay_to_Notion","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsinglinrain%2FWeChatPay_to_Notion/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsinglinrain%2FWeChatPay_to_Notion/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsinglinrain%2FWeChatPay_to_Notion/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/tsinglinrain","download_url":"https://codeload.github.com/tsinglinrain/WeChatPay_to_Notion/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/tsinglinrain%2FWeChatPay_to_Notion/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":262145147,"owners_count":23265876,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["alipay","billing","notion-api","notion-client","notion-integration","wechatpay"],"created_at":"2025-05-30T02:05:54.104Z","updated_at":"2025-06-26T21:31:28.232Z","avatar_url":"https://github.com/tsinglinrain.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\r\n  \u003cimg src=\"./image/logo/Bill2notion24.svg\" alt=\"Bill2NotionLogo\" style=\"width:12%; height:auto;\" /\u003e\r\n\u003c/div\u003e\r\n\r\n\u003cp align=\"center\"\u003e\u003cb\u003eWeChat and Alipay bills are sent to emails, and email attachments are extracted and imported into Notion\u003c/b\u003e\u003c/p\u003e\r\n\u003cp align=\"center\"\u003e\u003cb\u003e微信和支付宝账单发送至邮箱，邮件提取附件导入Notion\u003c/b\u003e\u003c/p\u003e\r\n\r\n\u003cp align=\"center\"\u003e\r\n  \u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/Notion-Integration-black\"\u003e\r\n  \u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/Bill-WeChat%20Pay-1AAD19\"\u003e\r\n  \u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/Bill-Alipay-1890FF\"\u003e\r\n  \u003ca href=\"https://github.com/ambv/black\"\u003e\u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/code_style-black-black\"\u003e\u003c/a\u003e\r\n  \u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/Python-3-green\"\u003e\r\n  \u003ca href=\"https://github.com/ramnes/notion-sdk-py\"\u003e\u003cimg alt=\"Static Badge\" src=\"https://img.shields.io/badge/notion--sdk--py-notion--client-blue\"\u003e\u003c/a\u003e\r\n\u003c/p\u003e\r\n\r\n\u003cp align=\"center\"\u003e\r\n  [\u003ca href=\"docs/README_EN.md\"\u003eEnglish\u003c/a\u003e] | [\u003ca href=\"docs/README_zh_Hant.md\"\u003e中文(繁體)\u003c/a\u003e]\r\n\u003c/p\u003e\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n  \u003cimg src=\"./image/preview.gif\" alt=\"Bill2Notion_zh_cn\" style=\"width:100%; height:auto;\" /\u003e\r\n\u003c/div\u003e\r\n\r\n\u003cdiv align=\"center\"\u003e\r\n  \u003cimg src=\"./image/Bill2Notion_zh_cn.excalidraw.svg\" alt=\"Bill2Notion_zh_cn\" style=\"width:100%; height:auto;\" /\u003e\r\n\u003c/div\u003e\r\n\r\n\u003cdetails\u003e\r\n  \u003csummary\u003e导入效果静态图\u003c/summary\u003e\r\n    \u003cdiv align=\"center\"\u003e\r\n      \u003cimg src=\"./image/visualization_static.png\" alt=\"visualization_static\" style=\"width:100%; height:auto;\" /\u003e\r\n\u003c/div\u003e\r\n\u003c/details\u003e\r\n\r\n\u003cdetails\u003e\r\n  \u003csummary\u003e项目具体偏向代码的流程图\u003c/summary\u003e\r\n    \u003cdiv align=\"center\"\u003e\r\n      \u003cimg src=\"./image/Bill_to_Notion_excalidraw.svg\" alt=\"Bill_to_Notion_excalidraw\" style=\"width:100%; height:auto;\" /\u003e\r\n\u003c/div\u003e\r\n\u003c/details\u003e\r\n\r\n## 其他说明\r\n\r\n\u003e 寻找相关记账的模板，配合使用效果更佳哦。\r\n\r\n\u003e 没有使用WeChat Pay以及Alipay的官方API）微信支付和支付宝官方API仅仅对商户开放使用，普通人目前无法使用。\u003cbr\u003e\r\n详情点击:\u003cbr\u003e\r\n    [简介-接口规则 | 微信支付商户平台文档中心](https://pay.weixin.qq.com/wiki/doc/apiv3/wechatpay/wechatpay-1.shtml) \u003cbr\u003e\r\n    [查询账单接口 - 支付宝文档中心 (alipay.com)](https://opendocs.alipay.com/open-v3/b6ddabc9_alipay.ebpp.bill.get)\r\n\r\n\u003e 灵感来源于**少数派**的[这篇文章](https://sspai.com/post/66658)，感谢少数派提供的思路。\r\n\r\n## 快速开始\r\n\r\n- 开通某个邮箱的IMAP协议，请自行互联网搜寻。\r\n- 这里给163邮箱的开通流程作为示例，[帮助中心_常见问题IMAP (163.com)](https://help.mail.163.com/faqDetail.do?code=d7a5dc8471cd0c0e8b4b8f4f8e49998b374173cfe9171305fa1ce630d7f67ac2a5feb28b66796d3b)\r\n- 这里给出QQ邮箱示例，[QQ邮箱开通IMAP步骤](https://i.mail.qq.com/app/app_register_help/imap_163.html)\r\n\r\n- 导出账单，发送至邮箱\r\n\u003cdiv align=\"center\"\u003e\r\n  \u003cimg src=\"./image/wechatpay_bill.png\" alt=\"wechatpay_bill\" style=\"width:100%; height:auto;\"/\u003e\r\n  \u003cimg src=\"./image/alipay_bill.png\" alt =\"aliapy_bill\" style=\"width:100%; height:auto;\"/\u003e\r\n\u003c/div\u003e\r\n\r\n- 拷贝示例数据库，建议`duplicate`此[账单导入Notion模板](https://tsinglin.notion.site/68951a1caaba487a884cafcd5086810c?v=3d0c405e7cae405599aed2fe0f5233cc)，熟悉之后可自行修改\r\n\r\n- 内部集成认证流程设置\r\n  \r\n  \u003cdetails\u003e\r\n    \u003csummary\u003eNotion Integration\u003c/summary\u003e\r\n\r\n    可以参考官方文档[Internal integration auth flow set-up](https://developers.notion.com/docs/authorization)\r\n\r\n    键入`https://www.notion.so/profile/integrations`\r\n\r\n    \u003cimg src=\"./image/Notion_Integration/Notion_Integration_step1.png\" alt=\"Notion_Integration_step1\" style=\"width:80%; height:auto;\"/\u003e\r\n    \u003cimg src=\"./image/Notion_Integration/Notion_Integration_step2.png\" alt=\"Notion_Integration_step2\" style=\"width:80%; height:auto;\"/\u003e\r\n    \u003cimg src=\"./image/Notion_Integration/Notion_Integration_step3.png\" alt=\"Notion_Integration_step3\" style=\"width:80%; height:auto;\"/\u003e\r\n    \u003cimg src=\"./image/Notion_Integration/Notion_Integration_step4.png\" alt=\"Notion_Integration_step4\" style=\"width:80%; height:auto;\"/\u003e\r\n    \u003cimg src=\"./image/Notion_Integration/Notion_Integration_step5.png\" alt=\"Notion_Integration_step5\" style=\"width:80%; height:auto;\"/\u003e\r\n    \u003cimg src=\"./image/Notion_Integration/Notion_Integration_step6.png\" alt=\"Notion_Integration_step6\" style=\"width:80%; height:auto;\"/\u003e\r\n    \u003cimg src=\"./image/Notion_Integration/Notion_Integration_step7.png\" alt=\"Notion_Integration_step7\" style=\"width:80%; height:auto;\"/\u003e\r\n    \u003cimg src=\"./image/Notion_Integration/Notion_Integration_step8.png\" alt=\"Notion_Integration_step8\" style=\"width:80%; height:auto;\"/\u003e\r\n  \u003c/details\u003e\r\n\r\n- 下载本项目\r\n\r\n- 安装所需库\r\n\r\n  ```python\r\n  pip install -r requirements.txt\r\n  ```\r\n\r\n- 运行`config_duplicate.py`文件\r\n\r\n- 填写`config_private.yaml`文件，如下\r\n\r\n  ```yaml\r\n  email_config:\r\n    imap_url: \"l3*********@163.com\"\r\n    password: \"HZ************TG\"\r\n    username: \"imap.163.com\"\r\n\r\n  notion_config:\r\n    database_id: \"c1a348********************4c7\"  # 数据库ID\r\n    token: \"secret_OHvKVP*******************Lq\" # token\r\n  ```\r\n\r\n  \u003cdetails\u003e\r\n    \u003csummary\u003edatabase_id details\u003c/summary\u003e\r\n    \r\n      https://www.notion.so/tsinglin/68111a1sssssss487a884cafcd5333310c?v=3d0c405e7cae405599aed2fe0f5233cc\r\n\r\n      database_id: 68111a1sssssss487a884cafcd5333310c\r\n\r\n  \u003c/details\u003e\r\n\r\n- 账单发送到邮箱后，会有消息告知密码。请复制此密码，**自己邮箱发送密码给自己**，**格式必须如下**：\r\n  ```text\r\n  wechatpay解压密码110110\r\n  alipay解压密码110110\r\n  ```\r\n  \u003cdetails\u003e\r\n  \u003csummary\u003e格式具体示例\u003c/summary\u003e\r\n  \u003cimg src=\"./image/alipay_password.jpg\" alt=\"Notion_Integration_step8\" style=\"width:40%; height:auto;\"/\u003e\r\n\r\n  即自己发给自己且标题必须形为`alipay解压密码123456`或者`wechatpay解压密码123456`，原因是代码规定如此，改了必报错。\r\n  ```python\r\n  def get_passwd(self):\r\n    # 检查邮件发件邮箱是否是自己的邮箱\r\n    flag = False\r\n    if self.from_addr == self.username:\r\n        print(\"Subject,from get_passwd:\", self.subject)\r\n        if self.payment_platform == \"alipay\":\r\n            if re.match(\"^alipay解压密码[0-9]{6}$\", self.subject):\r\n                print(\"Subject:\", self.subject)\r\n                self.paswd = self.subject[-6:]\r\n                print(\"Password:\", self.paswd)\r\n                flag = True\r\n        elif self.payment_platform == \"wechatpay\":\r\n            if re.match(\"^wechatpay解压密码[0-9]{6}$\", self.subject):\r\n                print(\"Subject:\", self.subject)\r\n                self.paswd = self.subject[-6:]\r\n                print(\"Password:\", self.paswd)\r\n                flag = True\r\n    return flag\r\n  ```\r\n  \u003c/details\u003e\r\n- 运行`main.py`\r\n\r\n## 自定义\r\n\r\npass\r\n\r\n## 下一步计划\r\n\r\n- `Linux`环境下自动化\r\n\r\n- 导入成功后邮件返回提醒\r\n\r\n- 可以设置每月自动导出提醒\r\n\r\n## Star History\r\n\r\n[![Star History Chart](https://api.star-history.com/svg?repos=tsinglinrain/WeChatPay_to_Notion\u0026type=Date)](https://star-history.com/#tsinglinrain/WeChatPay_to_Notion\u0026Date)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsinglinrain%2Fwechatpay_to_notion","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Ftsinglinrain%2Fwechatpay_to_notion","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Ftsinglinrain%2Fwechatpay_to_notion/lists"}