Skip to content

Push Notification via Webhook

You can configure custom webhooks to receive push notifications from your HMIs. This allows you to:

  • Integrate push notifications with your own systems or applications
  • Use your own LINE Official Account or Telegram Bot
  • Integrate with enterprise notification systems or custom applications
  • Transform push notifications into event triggers for other automation workflows

Requirements:

  • HMI with EasyAccess 2.0 activated
  • Push notification (EasyAccess 2.0) enabled in EasyBuilder Pro
  • A webhook endpoint (HTTPS recommended)
  • Domain admin privileges to configure webhooks

Setting Up a Webhook in Weincloud

Creating a Webhook

  1. Log in to Weincloud through social login (refer to Social Login for details)
  2. From the left sidebar, select Notifications to enter the "Social Settings/Notifications" page
  3. Click Create Webhook
  4. Fill in the webhook configuration:
    • Name: A descriptive name for your webhook
    • Endpoint URL: The URL where webhook requests will be sent (e.g., https://your-server.com/webhook)
    • API Key: (Optional but recommended) A secret key for authentication

Associating HMIs with Webhook

After creating a webhook, you need to associate it with specific HMIs:

  1. Select the webhook you created (the right panel will show the Information tab by default)
  2. Switch to the HMIs tab
  3. Click Add to select HMIs
  4. Choose the HMIs that should send push notifications to this webhook
  5. Click Save

Testing Your Webhook

You can test your webhook configuration before deploying:

  1. Select your configured webhook
  2. Click the Test button
  3. Weincloud will send a test payload to your endpoint
  4. Check the response status and verify your endpoint receives the request correctly

Webhook Request Format

When an event occurs on an associated HMI, Weincloud will send an HTTP POST request to your configured webhook URL.

HTTP Headers

headers
X-API-KEY: <your api key>
Content-Type: application/json

Note: You can verify the X-API-KEY header in your server to ensure it matches the configured API key for authentication.

Payload Structure

json
{
  "hwkey": "<hardware key>",
  "message": {
    "de": "Online",
    "en-US": "Online",
    "es-ES": "En linea",
    "fr-FR": "En ligne",
    "it": "Online",
    "ja": "オンライン",
    "ko": "온라인",
    "pl": "Online",
    "ru": "Онлайн",
    "zh-CN": "在线",
    "zh-TW": "連線"
  },
  "hmiName": "<device name>",
  "hmiTime": "2025-01-01 00:00:00",
  "serverTime": "2025-01-01 00:00:00",
  "eventType": "event-online-offline"
}

Note: The language keys in the message object may differ from this example. The actual languages depend on your HMI project settings in EasyBuilder Pro.

Field Descriptions

FieldTypeDescription
hwkeystringUnique hardware key of the HMI device
hmiNamestringDisplay name of the HMI (nickname if set, otherwise device name)
messageobjectEvent message in multiple languages (key-value pairs)
hmiTimestringTimestamp when the event occurred on the HMI (format: YYYY-MM-DD HH:MM:SS). Timezone follows the HMI's configuration.
serverTimestringTimestamp when the event reached the server (format: YYYY-MM-DD HH:MM:SS). Timezone depends on server region: UTC+0 for production region, UTC+8 for China region.
eventTypestringType of event that triggered the notification (see below)

Event Types

Event TypeDescription
event-triggerTrigger event - an alarm or condition was triggered
event-recoverRecover event - a previously triggered alarm has recovered
event-online-offlineHMI online/offline event

Implementation Examples

Below are implementation examples for popular serverless platforms. These examples demonstrate how to receive webhook requests, validate authentication, and forward notifications to messaging platforms.

AWS Lambda

AWS Lambda is a serverless computing service that runs your code in response to HTTP requests without managing servers.

Setup Steps (AWS Lambda)

  1. Create a Lambda Function

    • Go to AWS Lambda Console
    • Click Create function
    • Choose Author from scratch
    • Enter a function name
    • Select Python 3.13 runtime
    • Create the function
  2. Configure Environment Variables

    • Go to ConfigurationEnvironment variables
    • Add the required variables (see Environment Variables below)
    • Click Save
  3. Deploy the Code

    • Download one of the example files from Example Code Downloads below
    • Copy the code into the Lambda function editor
    • Click Deploy
  4. Create Function URL

    • Go to ConfigurationFunction URL
    • Click Create function URL
    • Auth type: NONE (You can implement your own authentication using API key)
    • Click Save
    • Copy the generated URL
  5. Configure in Weincloud

    • Use the Lambda Function URL as your webhook endpoint
    • Set the API key to match the EXPECTED_API_KEY environment variable
    • Click Test in Weincloud to verify the setup

Cloudflare Workers

Cloudflare Workers is a serverless platform that runs your code on Cloudflare's global edge network.

Setup Steps (Cloudflare Workers)

  1. Create a Worker

    • Log in to Cloudflare Dashboard
    • Navigate to Workers & Pages
    • Click Create application
    • Click Start with Hello World!
    • Give your worker a name
    • Click Deploy
  2. Deploy the Code

    • Download one of the example files from Example Code Downloads below
    • Click Edit code in your worker
    • Replace the default code with the example code
    • Click Deploy
  3. Configure Environment Variables

  4. Get Worker URL

    • Copy your worker's URL (e.g., https://your-worker.your-subdomain.workers.dev)
    • Use this URL as your webhook endpoint in Weincloud
    • Click Test in Weincloud to verify the setup

Example Code Downloads

Below are the complete example code files for implementing webhook endpoints on different platforms. These examples demonstrate how to receive webhook requests from Weincloud, validate API keys, parse payloads, and forward messages to LINE or Telegram.

AWS Lambda Examples

📥 Download aws_lambda_line.py (Python - LINE)

📥 Download aws_lambda_telegram.py (Python - Telegram)

Cloudflare Workers Examples

📥 Download cloudflare_worker_line.js (JavaScript - LINE)

📥 Download cloudflare_worker_telegram.js (JavaScript - Telegram)

What these examples include:

  • API key authentication validation
  • Webhook payload parsing and validation
  • Message forwarding to LINE Messaging API or Telegram Bot API
  • Environment variable configuration

Environment Variables

All example code requires the following environment variables to be configured in your serverless platform (AWS Lambda or Cloudflare Workers):

For LINE Integration

VariableDescriptionHow to Obtain
EXPECTED_API_KEYAPI key for webhook authenticationSet this to match the API key configured in Weincloud
LINE_CHANNEL_ACCESS_TOKENLINE Messaging API channel access tokenLINE Developers Console → Create/Select Channel → Channel settings
LINE_USER_IDLINE user ID or group ID to send messages toPersonal chat: Get from your LINE profile or use LINE Bot to collect user IDs
Group chat: Add your LINE Bot to the group, then check the LINE webhook logs or use the LINE Bot SDK to get the group ID

External Resources:

For Telegram Integration

VariableDescriptionHow to Obtain
EXPECTED_API_KEYAPI key for webhook authenticationSet this to match the API key configured in Weincloud
TELEGRAM_BOT_TOKENTelegram bot tokenCreate a bot using @BotFather
TELEGRAM_CHAT_IDChat ID to send messages toPersonal chat: Get your chat ID using bots like @userinfobot
Group chat: Add your bot to the group, send a message, then visit https://api.telegram.org/bot<YOUR_BOT_TOKEN>/getUpdates to find the group chat ID (negative number)

External Resources:

Configuration Notes:

  • For AWS Lambda: Add environment variables in ConfigurationEnvironment variables
  • For Cloudflare Workers: Add variables in SettingsVariables
  • The EXPECTED_API_KEY must match the API key you configured in Weincloud webhook settings
  • Keep all credentials and keys secure to prevent unauthorized access