简体   繁体   中英

How to log WeChat's history?

I would like to receive chat logs (ideally, automatically) from WeChat. The point is we use WeChat for corporate communication with couple Asian partners and would like to share dialogs with the whole team. it is important that all sides are agreed to save history outside of WeChat, so we are ok with all possible options.

There is an API and several libraries out there to work with. An example code in Python looks like that:

# -*- coding: utf-8 -*-

import itchat, time
from itchat.content import *

# itchat.auto_login() # in case you want to use the PNG QR version
itchat.auto_login(enableCmdQR=2)

@itchat.msg_register(itchat.content.TEXT)
def text_reply(msg):
    print ( "\nNew incoming message: " )
    print msg['Content'] # Print the received message
    print msg['User']['Alias'] # Show the senders alias

itchat.run()

I'm using this library: https://github.com/littlecodersh/ItChat/blob/master/README_EN.md

From there it would be possible to inject the messages into a CRM system for instance to keep track of the history.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM