Skip to main content

Python API for WeChat Work Message Bot

企业微信群机器人 Python 接口和命令行工具。

About the name: v = WeChat, me = Me, vme = WeChat Me. It's somewhat inspired by Chinese Internet meme "VME50".

vme is listed on PyPI.

vme is dependency-free.

Python API

vme.send() sends text (str) or image (bytes). Due to limitations of WeChat Work, only PNG and JPG images under 2M size are allowed. Image is recognized by detecting first few bytes (magic bits) of the binary data. An exception will be raised if payload is neither text nor image.

All texts are sent as markdown. Please note that the markdown features WeChat Work supports are extremely limited.

vme.send_file() is not implemented yet.

import vme

# send text
vme.send('your-bot-key', 'Texts with `minimal markdown` support.')

# send image, only PNG or JPG are supported
image = plot_some_curve(...)
vme.send('your-bot-key', image)

# send file (NOT implemented yet)
vme.send_file('your-bot-key', '/path/to/your/file')

Command Line Tool

vme is runnable with python3 -m vme or python3 vme.py command line.

Send text or image

Text or image data can only be read through pipe or input redirection:

# sending texts from another process
echo "hello world" | ./vme.py your-bot-key

# sending an image from file
./vme.py your-bot-key < plot.png

# sending long texts in a file
./vme.py your-bot-key < message.txt

# sending image from another process
my-plot --stdout ... | ./vme.py your-bot-key

Send file

Althrough the API is still not implemented yet, command line semantic for "send this file as a file" is designed.

# sending a file
./vme.py your-bot-key /path/to/your/file

Metadata

Release files for vme 0.0.5

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Built distribution (wheel)

Table of built distributions (wheels) for vme 0.0.5
File Interpreter ABI Platform
vme-0.0.5-py3-none-any.whl Python 3 none any Details

Release files / vme-0.0.5-py3-none-any.whl

Download URL vme-0.0.5-py3-none-any.whl
Size 4.3 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b9aa9ae5cc0223acf55ab496f4019a43ca785b971299aa18cfc906b8f7a97dfc
BLAKE2b-256 checksum
How to use checksums
f1764690b14e4a5f161ba022c7686c29399e1861f6450e26cb9ab008c01c6351
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/4.0.2 CPython/3.8.10

Security for vme 0.0.5

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page