This document uses SCF, MTA, and WeCom bot to perform scheduled tasks such as report content collection and data display.
Log in to the SCF console and select Function Service on the left sidebar.
At the top of the Function Service page, select the Beijing region and click Create to enter the function creating page and configure the function as shown below:
Click Next. The function name is automatically generated by default and can be modified as needed.
In the Trigger Configurations section, select Automatic creation, and a scheduled trigger that will run on the hour will be created by default as shown below:
- If you need to adjust the trigger configuration according to your needs, please select Custom.
- To create a scheduled trigger after the test is successful, please select Create Later.
The current template function only can pull reports from MTA sites. For more information, please see MTA Data API Description.
Add the following code to modify the MTA parameters:
$app_id ="xxxxxx"; // MTA APPID $secret_key = 'xxxxx'; // MTA SECRET KEY
Run the following command to access the WeCom bot. For more information, please see here.
CURLOPT_URL => "https://qyapi.weixin.qq.com/cgi-bin/webhook/send?key=xxxxx", // WeCom bot API