MeterSphere realizes the function of "robots regularly send messages in enterprise WeChat groups"

The following article comes from CSDN, the author is pytester.

This article mainly demonstrates the method and steps to realize the function of "robot regularly sending information in enterprise WeChat group" through the Metersphere one-stop open source continuous testing platform.

background

I have used PowerShell to implement the function of "robot regularly sending messages in enterprise WeChat group" and output related tutorials.

But in the process, I found some problems such as "the computer is shut down and the task can't be started as expected", so I found a tool that can replace PowerShell to send messages regularly, which is the protagonist of this issue—— Metersphere one-stop open source continuous testing platform. Metersphere can realize interface automation, and can set scheduled tasks.

Next, we can use Metersphere to gradually realize the function of "robots regularly send messages in enterprise WeChat groups".

Add group bots to corporate WeChat

Click the group where you need to add a group robot → right click → click the "Add group robot" option.

Simply send a message with a bot

1. After adding the robot, save the webhook address of the robot (for subsequent use).

2. Open Postman.

  The request method is: POST

 The request URL is: the webhook address of the robot

  Request Body is:

{    "msgtype": "text",    "text": {        "content": "Hi All ,下班前 记得填写 今日工作 & 明日计划 哦~-----------------------分割线---------------------------【今日工作】1、
【明日计划】1、        ",        "mentioned_list": [            "@all"        ]    }}

3. After filling out the above, click Send.

4. If "response.status=200 OK" is displayed, the trigger is successful. You can check whether the enterprise WeChat has received the message from the robot.

Setting up to send messages regularly in the enterprise WeChat group

MeterSphere is a one-stop open source continuous testing platform, covering test tracking, interface testing, performance testing, team collaboration and other functions, compatible with open source standards such as JMeter, effectively helping development and testing teams make full use of cloud elasticity for highly scalable automated testing, accelerating High-quality software delivery.

Notice:

If the enterprise uses Metersphere as a test management tool, it is recommended to use Metersphere to realize the function of "robots regularly send messages in the enterprise WeChat group". If it is an individual, it is not recommended to use Metersphere to achieve this function.

Although individuals can apply for a Metersphere enterprise trial, Metersphere will send the applicant's mailbox a demo account with super-administrative authority, which can see everyone's data and have the right to change other people's data, so it is best not to use your own enterprise WeChat group robot in the trial version. The Webhook address is put on it.

Specific steps are as follows:

1. Go to the Metersphere page.

2. Click an item → click the "Interface Automation" tab in the menu bar.

3. Click "+" to create a scene.

4. Fill in the required fields with "*" correctly.

5. Click the "+" button.

6. Select the Custom Request option.

7. Fill in the specific content.

• Request Name: Required

• Request Type: HTTP

• Request method: POST

• Request URL: Enterprise WeChat Robot Webhook Address

• Request parameters: JSON

• Request Body :

{    "msgtype": "text",    "text": {        "content": "Hi All ,下班前 记得填写 今日工作 & 明日计划 哦~-----------------------分割线---------------------------【今日工作】1、
【明日计划】1、        ",        "mentioned_list": [            "@all"        ]    }}

As shown below:

8. Click the "Debug" button to verify that Metersphere successfully implements the function of "robots send messages in enterprise WeChat groups".

9. The debugging is successful (Note: it will be automatically saved after the debugging is successful).

The enterprise WeChat group also receives the message from the robot, and then implements: scheduled task.

Metersphere timed task settings

1. After the above newly created interface is saved, click "..." at the end of the interface data that needs to be set to schedule tasks in the list, and then click the "Scheduled Task" option to enter the scheduled task settings.

2. Click the Generate Expression option.

3. Here you can set the running rules by yourself, and the "last 5 running times" will appear in linkage below according to the rules you set. You can preview whether the set "rules" are what you expect (note: this operation may be inconvenient in actual operation).

4. Here are some commonly used timing running rules. E.g:

5. More rules are as follows:

 0 0/30 9-17 * * ? Every half hour during 9 to 5 working hours;

 0 0 12 * * ? Triggered at 12:00 every day;

 0 15 10 ? * * Triggered at 10:15 every day;

 0 * 10 * * ? Trigger every minute from 10:00-10:59 every day;

 0 0/5 10 * * ? Trigger every 5 minutes from 10:00-10:59 every day;

 0 0/5 10,15 * * ? 10:00-10:59, 15:00-15:59 every day (triggered every 5 minutes);

 0 0-5 15 * * ? Trigger every minute from 15:00-15:05 every day;

 0 15 10 15 * ? Triggered at 10:15 on the 15th of every month;

 0 15 10 L * ? Triggered at 10:15 on the last day of every month;

 0 15 10 ? * 6L Triggered at 10:15 on Friday of the last week of each month;

 0 15 10 ? * 6L 2017-2020 Triggered at 10:15 on the last Friday of every month from 2017 to 2020;

 0 0 12 1/5 * ? Triggered every 5 days at 12:00 starting from the first day of each month.

In addition, I found that it seems difficult for Metersphere to achieve a certain time trigger from Monday to Friday, and I hope that the product can be optimized in the future.

It takes less than 5 minutes to create such a simple timed task, and everyone can try it out.

————————————————

Copyright statement: This article is an original article by CSDN blogger "pytester" and follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement for reprinting.

Original link:

https://blog.csdn.net/pytester/article/details/115664732​​​​​​​

{{o.name}}
{{m.name}}

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324124255&siteId=291194637