All Products
Search
Document Center

Logic Composer:Create a workflow

Last Updated:Apr 12, 2024

This topic describes how to create and run a workflow in Logic Composer, including adding a trigger and actions to the workflow. This topic also introduces the general concepts. In this topic, we use an example to show you how to automate your daily tasks by using workflows in Logic Composer.

In the example, an automated workflow is created to check whether a specified domain name is registrable at a scheduled time every day. If the domain name is registrable, the workflow sends a notification to the DingTalk group that you specify.

Create a workflow

1. Log on to the Logic Composer console. In the left-side navigation pane, click Workflows. At the top of the console, select the region where you want to create a workflow. Then, click Create Workflow.

2. In the Create Workflow dialog box that appears, set the Workflow Name and Resource group parameters. In this example, Default Resource Group is selected for Resource group. Then, click OK.

3. The message Created. is displayed in the Create Workflow dialog box. Then, click OK.

4. On the Graphic View tab, design the workflow by following the instructions in the sections below.

Select Trigger

In this example, we want to check whether a specified domain name is registrable on a daily basis. To this end, we need to add the Recurrence task trigger.

Important

Each workflow starts from a trigger that is invoked when a specific event occurs or when a specific condition is met.

1. On the Graphic View tab, click Recurrence in the Select Trigger dialog box.

2. In the Recurrence dialog box, click Recurrence task under the Triggers tab.

3. To trigger the workflow at a scheduled time, for example, 09:00 every day, perform the following operations: In the Recurrence task dialog box, select Day from the Frequency drop-down list. In the At these hours field, click the delete icon next to 0, and then select 9 from the drop-down list.

4. Click Save in the upper-right corner of the toolbar to save the workflow. A workflow with the Recurrence task trigger is created. However, no action is taken after the workflow is triggered at 09:00 every day. We need to add actions such as checking whether a specified domain name is registrable.

Add actions

This section describes how to call an API operation provided by Alibaba Cloud to check whether a specified domain name is registrable. In this example, the CheckDomain operation provided by Alibaba Cloud Domain Name Service is called. This operation is available for use for free.

1. Click Add Step below the Recurrence task dialog box. In the Select Action dialog box, enter Domains in the search box, and then click the Domains connector.

2. In the Domains dialog box, enter checkdomain in the search box, and then click the CheckDomain action.

3. If you are using Logic Composer for the first time, the Authorize button appears. Logic Composer must be assigned an authorized RAM role to call the required API operation before Logic Composer can run a workflow as expected. Click Authorize. The Grant Role panel appears on the right side. In the Grant Role panel, you can view the name of the RAM role to be created, the role description, and the authorization policy to be attached to the role. Logic Composer automatically recommends the appropriate system permissions based on the action you want to add. Click Confirm to complete authorization.

Important

1. If you log on to Logic Composer as a RAM user, the authorization method varies based on the permissions of the RAM user. For more information, see Authorize a RAM user to orchestrate workflows.

2. The authorization method varies based on different connectors that require identity authentication. For more information, see the usage of each specific connector.

4. After authorization is complete, enter the domain name to be checked in the DomainName field.

5. Add a conditional judgment action to check whether the specified domain name is registrable. The method is similar to that used for adding the domain name to be checked. Perform the following operations: Scroll to the bottom of the Graphic View tab and click Add Step. In the Select Action dialog box, enter Control in the search box, and then click the Control connector. In the Control dialog box, click the If action.

6. The Control connector does not require identity authentication. You need to supplement the conditional judgment logic for the If action. In the response of the CheckDomain operation, the Avail parameter indicates whether a domain name is registrable. The Avail parameter has multiple valid values. A value of 1 indicates that the domain name is registrable. In this case, configure the If action to check whether the value of the Avail parameter is equal to 1. Perform the following operations: Click the input box on the left side. The Dynamic Content tab appears on the right side. The Dynamic Content tab lists the response parameters of the CheckDomain operation. Click the Avail parameter on the Dynamic Content tab. The input box on the left side is automatically filled with the parameter. Enter 1 in the input box.

Note

In this example, the workflow is designed to send a notification when the value of the Avail parameter is 1. If you want the workflow to send a notification when the domain name can be reserved for registration or the reservation can be deleted, modify the conditional judgment logic based on your business requirements. For example, you want the workflow to send a notification when the domain name can be registered or reserved for registration or when the reservation can be deleted. In this case, you can select Greater Than as the judgment logic and enter 0 in the input box on the right side.

7. Add an action to send a notification when the specified condition is met. Click Add Step in the If True pane. In the Select Action dialog box, click the DingTalk connector. In the DingTalk dialog box, click Send Message Via Chatbot on the Actions tab. In the Send Message Via Chatbot dialog box, set the Chatbot Access Token parameter. You can refer to the DingTalk group settings to obtain the webhook URL of your custom chatbot, and then enter the value of the access_token parameter in the URL in this field. Set the Content parameter based on your business requirements. You can select a parameter on the Dynamic Content tab on the right side.

Important

You must select at least one security mode in the settings of the custom chatbot. Otherwise, the chatbot cannot send messages. You can select Custom Keywords and add custom keywords based on the message content that you set in the Send Message Via Chatbot dialog box. In this example, the message content is xxx is registrable. Hence, you can add registrable as the keyword.

8. Click Save in the upper-right corner of the toolbar to save the workflow. Then, test whether the workflow can run as expected.

Run a workflow

After you save the orchestrated workflow, the workflow automatically runs at 09:00 every day. You can click Run in the upper-right corner of the toolbar to manually run the workflow. This section describes how to manually run the workflow to verify that the workflow is orchestrated as expected.

1. Click Run in the upper-right corner of the toolbar to run the workflow.

2. The workflow enters the running state and finishes running quickly. You can see a green check mark in the upper-right corner of each step. This indicates that the workflow is run as expected.

3. Click each step to check the input and output of the step. For example, click Domains_CheckDomain to check the output. If the value of the Avail parameter in the output is 1, the specified domain name is registrable.

4. View the DingTalk group to which the custom chatbot belongs and verify that you can receive a notification indicating that the specified domain name is registrable. The DomainName parameter in the message body is automatically replaced with the specified domain name.

The whole procedure for creating and running a workflow is complete.