background
Enterprise wechat session archiving is an open regulatory function facing the financial industry. Other industries can apply to Tencent for approval and opening from the official enterprise wechat service provider [1]. The introduction of session archive is to let enterprises know the interaction between employees and customers, but also to avoid employees to take away the company’s customer resources
Accessible content images, text, voice, links, videos, applets, and even retracted messages can be retrieved
The development of
Enterprise wechat now only provides c++ and Java SDK to call the interface, but many enterprises will use python, golang, PHP and other languages to develop applications. Here’s a brief description of how Python calls the enterprise wechat session archive interface. First download the SDK for the session archive, then just need a so file in the C_sdk folder.
Python calls this so to connect to the enterprise wechat session archiving interface
dll = ctypes.cdll.LoadLibrary('libWeWorkFinanceSdk_C.so')
Copy the code
Load so above, then DLL object can call the corresponding interface, the definition of interface can refer to the weworkFinancesdk_c.h file. The key is that when Python calls so, it declares the parameters and return value types of the calling function
dll.NewSdk.argtypes = []
dll.NewSdk.restype = ctypes.c_void_p
Copy the code
In Python, the pointer type can be defined as ctypes.c_void_p, and the character array pointer can be defined as ctypes.c_char_p. The ctypes.c_char_p argument python passes byte[] when the function is actually called.
The final message is decoded and rendered as is.
reference
[1] the CRM. Bytell. Cn / 67 / blog caca…