Use Base to automate the sending of HTTP requests

Use Base to automate the sending of HTTP requests

4 min read
💡
Note: The sending of HTTP requests is an advanced developer-facing function, requiring basic programming knowledge and familiarity with API calls. Please consult a developer before using this function.
I. Intro
Base's automated workflow supports the sending of HTTP requests. With automated workflow, network requests can be sent manually or automatically to specified URLs, enabling calls to third-party platforms.
For example, you can use HTTP requests to call practically any Lark Open Platform API.
Here are some examples of what you can do:
  • Send a Base record to an individual or group as a message card.
  • Process content from a Base with the relevant API and then pull it into the original table (example: translation).
To learn about Lark's open capabilities, see the Lark Open Platform User Guide.
II. Basic concept
Request methods
There are 5 HTTP request methods available in the automated workflow:
Request methods
Description
GET
Request specified page information and get a response body. Used for retrieving or obtaining information.
POST
Submit data to a specified resource for processing (for example, submit a form or upload a file). The data is included in the request text. Used for creating new resources and modifying existing resources.
PUT
Upload new content to a specified resource location. Can be used for updating the specified resource's new data.
PATCH
Similar to the PUT method. Used for partially updating a resource.
DELETE
Request the server to delete the resource corresponding to the URL.
Parameters
Request methods
Parameter type
Parameter name
Description
GET
Input parameters
URL
The HTTP request URL. Enter manually or by using the existing link in the Base.
Note: Links with query parameters are not allowed here.
Query parameters
Fill in query parameters in HTTP requests using the key-value format. "Value" supports referencing data from Base.
Headers
Fill in header parameters in HTTP requests using the key-value format. "Value" supports referencing data from Base.
Output parameters
Response body
The parsing rules for an HTTP response; 3 types of rules are available: none, text, and JSON.
Response value (configure only when the response body is JSON)
The HTTP response body. Will parse the response body according to JSON rules and return the corresponding content.
Note: Make sure the entered content conforms to the JSON format to ensure that the content of the response value can be referenced.
POST
PUT
PATCH
DELETE
Input parameters
URL
The HTTP request URL. Enter manually or by using the existing link in the Base.
Note: Links with query parameters are not allowed here.
Query parameters
Fill in query parameters in HTTP requests using the key-value format. "Value" supports referencing data from Base.
Headers
Fill in header parameters in HTTP requests using the key-value format. "Value" supports referencing data from Base.
Request body
Types of request bodies that can be transmitted: none, raw, form-data, form-urlencoded
  • none: No request body. You can't fill in a request body in this case.
  • raw: You can use JSON or text.
  • form-data: You must use this format when performing actions in forms. The type is key-value pairs. Can't upload files.
  • form-urlencoded: Converts data in forms to key-value pairs. Can't upload files.
Output parameters
Response body
The parsing rules for an HTTP response; 3 types of rules are available: none, text, and JSON.
Response value (configure only when the response body is JSON)
The HTTP response body. Will parse the response body according to JSON rules and return the corresponding content.
Note: Make sure the entered content conforms to the JSON format to ensure that the content of the response value can be referenced.
III. Use cases
Scenario: Use a custom bot to send messages to a group. To learn more, see HTTP request scenario: Send group messages (applicable for external groups)
Steps:
  1. Add a custom bot to the group that you need to send messages to.
  1. In the desktop app, enter the group and click on the ··· icon at the upper-right corner > Settings, find the bot.
  1. Click Add Bot and select Custom Bot.
  1. Configure the bot's profile photo, name, and description, and click Add in the lower-right corner. You'll then get the bot's webhook address.
250px|700px|reset
250px|700px|reset
  1. Open the base and click Automations in the upper-right corner to create a new automation. Select the trigger condition you need, and then select HTTP request to send messages to the specified group.
  1. Select POST as the request method.
  1. For the URL under Input parameters, enter the webhook URL for the custom bot that you added.
  1. For the request body under Input parameters, select raw and enter content in JSON format.
  • Note: You can quickly generate a JSON code using the Lark card building tool. Before copying it, add the following code to the very beginning:
{
"msg_type": "interactive",
"card": the content copied from the open platform
}
  1. For the response body under Output parameters, select JSON, then enter the response value. The response value is {} by default, meaning in the next step, you can only reference the entire result of the HTTP request. If you must continue to reference the structured data in JSON in the next step, enter the following code for the response value:
{"StatusMessage":"success","Extra":null,"StatusCode":0}
250px|700px|reset
250px|700px|reset
IV. FAQs
Why does the HTTP request timeout error occur? What is the time limit for responses?
The time limit for HTTP requests is 20 seconds. This means if no response is received after 20 seconds, the request will timeout, and the result cannot be returned to the base. After timing out, the HTTP request may succeed or fail, and the final execution result needs to be confirmed with the party being called.
Does Base automations support sending HTTP requests from a fixed IP address (IP allowlist)?
Yes. Fixed IP addresses are as follows:
  • If the data residency for the organization is deployed in data centers located outside of China:
  • If the data residency for the organization is deployed in data centers located in China:
If the deployment location cannot be identified, we recommend adding all the IP addresses to the allowlist.
Can I add query parameters directly to the URL?
No you can't. Query parameters directly added to URLs cannot be recognized. If you need to, add them in Query parameters under Input parameters.
Why can't my HTTP request be parsed?
HTTP requests will be parsed only if their status code is 200–299. Otherwise you'll receive an original error message.
For the response value, what content conforms to the JSON format?
Check the following 4 requirements to determine whether the content you enter conforms to the JSON format:
  1. Strings in arrays and objects must be within double quotes.
  1. Structures must contain 1 or more key-value pairs.
  1. Keys must be strings, and keys and values must be separated by a colon.
  1. Objects must begin and end with curly brackets{}
How many key-value pairs can I enter at most?
Currently, you can enter a maximum of 100 key-value pairs.
Can I reference the array data in response to my HTTP request in the next step?
You have to reference the array data in its entirety. You can't reference a single variable in the JSON array.
What should I enter for the response body's response value for an HTTP request?
You can paste in content from the response body example that you've obtained from Postman or the API interface document. Only then will you be able to reference the value in the HTTP request result in the next step.
I copied the code from the open platform, then sent a message using the custom bot for the group. Why is it still not working?
Before copying the code from the open platform, you need to add the following code to the very beginning. Here's the format for reference:
{
"msg_type": "interactive",
"card": the content copied from the open platform
}
Written by: Lark Help Center
Updated on 2025-02-06
How satisfied are you with this content?
Thank you for your feedback!
Need more help? Please contact Support.
0
rangeDom
rangeDom
rangeDom
rangeDom
rangeDom
rangeDom
rangeDom
rangeDom
rangeDom
rangeDom