Other Sources

Introduction #

SmartChart supports various other data sources through custom connectors, including HTTP API, Webhook, GraphQL, SMS, Telegram, Slack, MQTT, and Anthropic Claude.

Supported Sources #

Source Description
HTTP API Generic RESTful API calls with authentication and response parsing
Webhook Generic webhook push with HMAC signature support
GraphQL Query and mutation support for GraphQL endpoints
SMS Alipay and Tencent Cloud SMS services
Telegram Bot messaging with multiple parse modes
Slack Incoming webhook and chat.postMessage API
MQTT IoT messaging with publish/subscribe patterns
Anthropic Claude AI text dialogue with streaming and extended thinking support

Usage #

All these sources use the custom data source pattern. Create a connection with the appropriate driver, then write query logic in the dataset editor.

Example - HTTP API:

import requests
import json

def dataset(*args, **kwargs):
    sqlList = args[0]
    config = args[1]
    
    url = config['host']
    headers = {'Authorization': f"Bearer {config['password']}"}
    response = requests.get(url, headers=headers)
    return json.loads(response.text)

Example - Telegram Bot:

import requests

def dataset(*args, **kwargs):
    config = args[1]
    token = config['password']
    chat_id = config['user']
    url = f"https://api.telegram.org/bot{token}/sendMessage"
    data = {"chat_id": chat_id, "text": "Hello from SmartChart!"}
    requests.post(url, json=data)

Refer to “Custom Data Source” documentation for detailed implementation patterns.