Automation
Automation Basic Concepts Action is a node in the robot execution process, and the simplest way to understand it is that it is a function. The simplest implementation is also a clo
Automation
Basic Concepts
Actionis a node in the robot execution process, and the simplest way to understand it is that it is a function. The simplest implementation is also a cloud function- A function only focuses on doing one thing.
Actioncan be combined to orchestrate workflows and complete a series of tasks.
serviceis a collection of actions. To provide an action, you must first register a service.- For example, the
Apitableservice provides 「create record」 and 「query record」 actions.
- For example, the
Pre-conditions
- In the environment variables of the config.yaml file, please refer to: Configuring GM Administrator.
- Obtain the API token of the GM administrator, please refer to: API Interface Call Certificate.
- The apitable version needs to be greater than or equal to v0.21.0.
Publishing Process
Unpublishing Process
How to create a new Automation?
To prepare for calling the robot API interface, you can choose a framework or tool according to your familiar programming language to implement it.
- If you are familiar with Java, you can create a Spring Boot project, add Spring Web-related dependencies, then add an API interface that meets the requirements, and deploy it to the server.
- If you are familiar with Node.js, you can create an Express project, add an API interface that meets the requirements, and deploy it to the server.
- Alternatively, you can also use serverless cloud functions to implement the API interface.
1. Create automation service
1.1.1 Create an automation service
Interface address /api/v1/automation/service/create
Request method POST
Interface request Content-Type application/json
Interface description
Creating a automation service
Request parameters
| Parameter name | Parameter description | necessary? | Data type |
|---|---|---|---|
| serviceId | This is the unique identifier of the service | TRUE | string |
| slug | The identifier of the service. | TRUE | string |
| name | The name of the service | TRUE | string |
| description | The description of the service | FALSE | string |
| logo | The logo of the service, an image address | TRUE | string |
| baseUrl | If the API interface prepared in step one is: https://service.xxx.gcp.com/release/sendMessage ,then the value here is https://service.xxx.gcp.com/release/ | TRUE | string |
| i18n | multiple languages, the value can be: ‘{}‘ ,eg: ‘{"en": {"$webhook": "Webhook"}, "zh": {"$webhook": "网络请求"}}’ | TRUE | string |
Sample request parameters
{
"serviceId": "asvnbL206pqzmZfr6a",
"slug": "webhook",
"name": "webhook",
"description": "",
"logo": "https://s1.apitable.com/xxx",
"baseUrl": "https://service.xxx.gcp.com/release/",
"i18n": "{\"en\": {\"webhook": "Webhook"}, "zh": {"$webhook": "网络请求"}}"
}Response Result Parameters
| Parameter name | Parameter description | Data type |
|---|---|---|
| code | Result response code, 200 means success | integer(32) |
| message | Response result description | String |
| success | Whether successful | boolean |
| body | ServiceId | String |
Return result example
{
"success": true,
"code": 200,
"message": "SUCCESS",
"data": "asvnbL206pqzmZfr6a"
}1.1.2 Update automation service
Interface address /api/v1/automation/service/edit/{serviceId}
Request method POST
Interface request Content-Type application/json
Interface description
Update automation service information
Request parameters
| Parameter name | Parameter description | Request type | necessary? | Data type |
|---|---|---|---|---|
| serviceId | This is the unique identifier of the service | path | TRUE | string |
| name | The name of the service | body | TRUE | string |
| description | The description of the service | body | FALSE | string |
| logo | The logo of the service, an image address | body | FALSE | string |
| baseUrl | If the API interface prepared in step one is: https://service.xxx.gcp.com/release/sendMessage ,then the value here is https://service.xxx.gcp.com/release/ | body | FALSE | string |
| i18n | multiple languages, the value can be: ‘{}‘ ,eg: ‘{"en": {"$webhook": "Webhook"}, "zh": {"$webhook": "网络请求"}}’ | body | FALSE | string |
Sample request parameters
url:
/api/v1/automation/service/edit/asvnbL206pqzmZfr6a
Request body:
{
"name": "webhook",
"description": "",
"logo": "https://s1.apitable.com/xxx",
"baseUrl": "https://service.xxx.gcp.com/release/",
"i18n": "{\"en\": {\"webhook": "Webhook"}, "zh": {"$webhook": "网络请求"}}"
}Response Result Parameters
| Parameter name | Parameter description | Data type |
|---|---|---|
| code | Result response code, 200 means success | integer(32) |
| message | Response result description | String |
| success | Whether successful | boolean |
| data | String |
Return result example
{
"success": true,
"code": 200,
"message": "SUCCESS",
"data": "asvnbL206pqzmZfr6a"
}1.1.3 Delete automation service
Interface address /api/v1/automation/service/delete/{serviceId}
Request method POST
Interface request Content-Type application/json
Interface description
Delete automation service information
Request parameters
| Parameter name | Parameter description | Request type | necessary? | Data type |
|---|---|---|---|---|
| serviceId | This is the unique identifier of the service | path | TRUE | string |
Sample request parameters
url:
/api/v1/automation/service/delete/asvnbL206pqzmZfr6a
Request body:
{
}Response Result Parameters
| Parameter name | Parameter description | Data type |
|---|---|---|
| code | Result response code, 200 means success | integer(32) |
| message | Response result description | String |
| success | Whether successful | boolean |
| data | String |
Return result example
{
"success": true,
"code": 200,
"message": "SUCCESS",
"data": {}
}2. Create an automation ActionType
2.1.1 Create an automation ActionType
Interface address /api/v1/automation/service/create
Request method POST
Interface request Content-Type application/json
Interface description
Creating a automation service
Request parameters
| Parameter name | Parameter description | necessary? | Data type |
|---|---|---|---|
| serviceId | This is the unique identifier of the service, from create automation service | TRUE | string |
| actionTypeId | The unique identifier of the actionTypeId. | FALSE | string |
| name | The name of the actionType | TRUE | string |
| description | The description of the actionType | FALSE | string |
| inputJsonSchema | The JsonSchema description of the JSON string of the API request body | FALSE | string |
| outputJsonSchema | The JsonSchema description of the data property in the API response content. | FALSE | string |
| endpoint | If the API interface prepared in step one is: https://service.xxx.gcp.com/release/sendMessage, then the value here is sendMessage. | TRUE | string |
| i18n | multiple languages, the value can be: ‘{}‘ | TRUE | string |
Sample request parameters
{
"serviceId": "asvnbL206pqzmZfr6a",
"actionTypeId": "aatSSHdFkR7B719Iks",
"name": "$robot_action_send_web_request_title",
"description": "$robot_action_send_web_request_desc",
"inputJsonSchema": "{\"schema\": {\"type\": \"object\", \"required\": [\"url\", \"method\"],\"properties\": {\"url\": {\"type\": \"string\",\"title\": \"$robot_action_send_web_request_config_2\"},\"method\": {\"enum\": [\"GET\",\"POST\",\"PATCH\",\"DELETE\"],\"type\": \"string\",\"title\": \"$robot_action_send_web_request_config_1\",\"default\": \"GET\",\"description\": \"$robot_action_send_web_request_config_1_desc\"}},\"additionalProperties\": false},\"uiSchema\": {\"ui:order\": [\"method\",\"url\"]}}",
"outputJsonSchema": "{\"schema\": {\"type\": \"object\",\"required\": [\"status\"],\"properties\": {\"status\": {\"title\": \"状态码\",\"type\": \"number\"},\"json\": {\"title\": \"消息\",\"type\": \"object\"}},\"additionalProperties\": false},\"uiSchema\": {\"ui:order\": [\"status\",\"json\"]}}",
"endpoint": "sendRequest",
"i18n": "{\"en\": {\"$robot_action_send_web_request_desc\": \"When the robot starts working, it will automatically send a web request to a specific URL\",\"$robot_action_send_web_request_title\": \"Send web request\",\"$robot_action_send_web_request_config_1\": \"Request method\",\"$robot_action_send_web_request_config_2\": \"Request address\",\"$robot_action_send_web_request_config_1_desc\": \"Send web request via the GET, POST or other method\"},\"zh\": {\"$robot_action_send_web_request_desc\": \"机器人开始运行后,会自动向指定地址发送网络请求\",\"$robot_action_send_web_request_title\": \"发送网络请求\",\"$robot_action_send_web_request_config_1\": \"请求方法\",\"$robot_action_send_web_request_config_2\": \"请求地址\",\"$robot_action_send_web_request_config_1_desc\": \"通过 GET 或 POST 等方式向指定地址发送网络请求\"}}"
}Response Result Parameters
| Parameter name | Parameter description | Data type |
|---|---|---|
| code | Result response code, 200 means success | integer(32) |
| message | Response result description | String |
| success | Whether successful | boolean |
| shareId | The public share link ID of the node, a unique value | String |
Return result example
{
"success": true,
"code": 200,
"message": "SUCCESS",
"data": "aatSSHdFkR7B719Iks"
}1.1.2 Update automation ActionType
Interface address /api/v1/automation/actionType/edit/{actionTypeId}
Request method POST
Interface request Content-Type application/json
Interface description
Update automation service information
Request parameters
| Parameter name | Parameter description | Request type | necessary? | Data type |
|---|---|---|---|---|
| actionTypeId | The unique identifier of the actionTypeId. | path | TRUE | string |
| name | The name of the service | body | TRUE | string |
| description | The description of the service | body | FALSE | string |
| endpoint | If the API interface prepared in step one is: https://service.xxx.gcp.com/release/sendMessage, then the value here is sendMessage. | body | FALSE | string |
| i18n | multiple languages, the value can be:’{}’ | body | FALSE | string |
Sample request parameters
url:
/api/v1/automation/actionType/edit/aatSSHdFkR7B719Iks
Request body:
{
"serviceId": "asvnbL206pqzmZfr6a",
"actionTypeId": "aatSSHdFkR7B719Iks",
"name": "$robot_action_send_web_request_title",
"description": "$robot_action_send_web_request_desc",
"inputJsonSchema": "{\"schema\": {\"type\": \"object\", \"required\": [\"url\", \"method\"],\"properties\": {\"url\": {\"type\": \"string\",\"title\": \"$robot_action_send_web_request_config_2\"},\"method\": {\"enum\": [\"GET\",\"POST\",\"PATCH\",\"DELETE\"],\"type\": \"string\",\"title\": \"$robot_action_send_web_request_config_1\",\"default\": \"GET\",\"description\": \"$robot_action_send_web_request_config_1_desc\"}},\"additionalProperties\": false},\"uiSchema\": {\"ui:order\": [\"method\",\"url\"]}}",
"outputJsonSchema": "{\"schema\": {\"type\": \"object\",\"required\": [\"status\"],\"properties\": {\"status\": {\"title\": \"状态码\",\"type\": \"number\"},\"json\": {\"title\": \"消息\",\"type\": \"object\"}},\"additionalProperties\": false},\"uiSchema\": {\"ui:order\": [\"status\",\"json\"]}}",
"endpoint": "sendRequest",
"i18n": "{\"en\": {\"$robot_action_send_web_request_desc\": \"When the robot starts working, it will automatically send a web request to a specific URL\",\"$robot_action_send_web_request_title\": \"Send web request\",\"$robot_action_send_web_request_config_1\": \"Request method\",\"$robot_action_send_web_request_config_2\": \"Request address\",\"$robot_action_send_web_request_config_1_desc\": \"Send web request via the GET, POST or other method\"},\"zh\": {\"$robot_action_send_web_request_desc\": \"机器人开始运行后,会自动向指定地址发送网络请求\",\"$robot_action_send_web_request_title\": \"发送网络请求\",\"$robot_action_send_web_request_config_1\": \"请求方法\",\"$robot_action_send_web_request_config_2\": \"请求地址\",\"$robot_action_send_web_request_config_1_desc\": \"通过 GET 或 POST 等方式向指定地址发送网络请求\"}}"
}Response Result Parameters
| Parameter name | Parameter description | Data type |
|---|---|---|
| code | Result response code, 200 means success | integer(32) |
| message | Response result description | String |
| success | Whether successful | boolean |
| body | actionTypeId | String |
Return result example
{
"success": true,
"code": 200,
"message": "SUCCESS",
"data": "aatSSHdFkR7B719Iks"
}1.1.3 Delete automation ActionType
Interface address /api/v1/automation/actionType/delete/{actionTypeId}
Request method POST
Interface request Content-Type application/json
Interface description
Delete automation service information
Request parameters
| Parameter name | Parameter description | Request type | necessary? | Data type |
|---|---|---|---|---|
| actionTypeId | This is the unique identifier of the service | path | TRUE | string |
Sample request parameters
url:
/api/v1/automation/actionType/delete/{actionTypeId}
Request body:
{
}Response Result Parameters
| Parameter name | Parameter description | Data type |
|---|---|---|
| code | Result response code, 200 means success | integer(32) |
| message | Response result description | String |
| success | Whether successful | boolean |
| body | String |
Return result example
{
"success": true,
"code": 200,
"message": "SUCCESS",
"data": {}
}