Message Push Source

Introduction #

SmartChart supports message push data sources for sending notifications to DingTalk, WeChat Work, and Feishu. This enables automated alerts, scheduled task notifications, and report delivery through enterprise messaging platforms.

Supported Platforms #

Platform Message Types
DingTalk Text, markdown, action card, link
WeChat Work Text, markdown, image, news
Feishu Text, rich text, interactive cards

Usage #

Create a connection with the webhook URL, then send messages via dataset:

import requests
import json

def dataset(*args, **kwargs):
    sqlList = args[0]
    config = args[1]
    webhook_url = config['host']
    
    message = {
        "msgtype": "text",
        "text": {
            "content": sqlList[0]
        }
    }
    
    response = requests.post(webhook_url, json=message)
    return json.loads(response.text)

Use Cases #

  • Scheduled task completion notifications
  • Exception alert pushing
  • Daily report auto-sending
  • Threshold-based alerts