How to Build a DingTalk Bot for Meican Meal Ordering and Data Analysis

This article walks through the process of scraping Meican's ordering data via its APIs, analyzing restaurant popularity, and creating a Node.js‑based DingTalk robot that automatically notifies users when it’s time to place their lunch orders, complete with code snippets and visual insights.

Alibaba Cloud Developer
Alibaba Cloud Developer
Alibaba Cloud Developer
How to Build a DingTalk Bot for Meican Meal Ordering and Data Analysis

Background

The Meican app provides a daily lunch ordering service for employees, closing orders at 5 pm. Missing the deadline means going hungry, so the author decided to automate the reminder and analyze ordering data.

Data Acquisition

Because Meican is an internal corporate app, traditional web crawling does not work. By capturing the app’s network traffic, the author discovered several public APIs that return JSON data about available restaurants, ordering times, and status.

// API: https://meican.com/preorder/data/group?x={userId}
{
  groups:[
    {"title":"首开", ...},
    {"title":"方恒国际", ...},
    ...
  ]
}

Another endpoint provides the weekly calendar of orderable time slots:

// API: https://meican.com/preorder/api/v2.1/calendarItems/list?beginDate=YYYY-MM-DD&endDate=YYYY-MM-DD&withOrderDetail=false
{
  "dateList":[
    {
      "calendarItemList":[
        {
          "openingTime":{...},
          "title":"高德地图(首开外卖)晚餐1",
          "status":"NOT_YET",
          ...
        }
      ]
    }
  ]
}

Restaurant details for a specific time slot can be fetched with:

// API: https://meican.com/preorder/api/v2.1/restaurants/list?tabUniqueId=...&targetTime=YYYY-MM-DD+HH:MM
{
  "restaurantList":[
    {
      "availableDishCount":80,
      "dishLimit":100,
      "latitude":39.991464,
      "longitude":116.396763,
      "name":"宅食送(UBP店)"
    },
    ...
  ]
}

Designing the DingTalk Notification Bot

The author created a custom DingTalk robot. After adding the robot in a chat group, DingTalk provides a webhook URL. Posting a JSON payload to this webhook triggers a message in the group.

Open DingTalk, locate the chat group, and add a custom robot.

Obtain the webhook URL generated by DingTalk.

In the code, send an HTTP POST to the webhook whenever the order status becomes "AVAILABLE" and the current time is within three hours of the deadline.

The message can include Markdown formatting for better readability.

Implementation with Node.js

The service runs in a loop, fetching the calendar API every minute. When an entry has status equal to "AVAILABLE" and the deadline is less than three hours away, the bot posts a notification. The code also adds a random food image to make the alert more appetizing.

Data Analysis

After collecting about 60 days of data, the author computed two metrics:

Daily total order rate : total ordered dishes divided by total available dishes for each day.

Restaurant average order rate : sum of ordered dishes across all days divided by sum of dish limits for each restaurant.

Charts (shown in the original article) reveal fluctuations in daily order rates and identify the most and least popular restaurants. For example, "金百万" achieved an 87.7% order rate, while "兰州牛肉拉面" only reached 12.3%.

Conclusion

The bot successfully eliminates the need to manually track Meican ordering deadlines and provides data‑driven insights into restaurant popularity. The author encourages readers to apply similar scraping and analysis techniques to other food‑ordering platforms.

Original Source

Signed-in readers can open the original source through BestHub's protected redirect.

Sign in to view source
Republication Notice

This article has been distilled and summarized from source material, then republished for learning and reference. If you believe it infringes your rights, please contactadmin@besthub.devand we will review it promptly.

Node.jsdata-scrapingorder analysisDingTalk botMeican API
Alibaba Cloud Developer
Written by

Alibaba Cloud Developer

Alibaba's official tech channel, featuring all of its technology innovations.

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.