Feishu
Feishu sink connector
Support Those Engines
Spark
Flink
SeaTunnel Zeta
Key Features
Description
Used to launch Feishu webhooks using upstream data.
For example, if the data from upstream is [
age: 12, name: tyrantlucifer], the body content is the following:{"age": 12, "name": "tyrantlucifer"}
The Feishu sink sends POST requests. Each upstream row is converted to JSON and used as the request body. When array_mode = true, multiple rows are accumulated into one JSON array before sending.
tip
Feishu webhook URLs and custom authentication headers are sensitive. Do not print real tokens in logs or examples.
Data Type Mapping
| SeaTunnel Data Type | Feishu Data Type |
|---|---|
| ROW MAP | Json |
| NULL | null |
| BOOLEAN | boolean |
| TINYINT | byte |
| SMALLINT | short |
| INT | int |
| BIGINT | long |
| FLOAT | float |
| DOUBLE | double |
| DECIMAL | BigDecimal |
| BYTES | byte[] |
| STRING | String |
| TIME TIMESTAMP TIME | String |
| ARRAY | JsonArray |
Sink Options
| Name | Type | Required | Default | Description |
|---|---|---|---|---|
| url | String | Yes | - | Feishu webhook URL. The current sink writer sends requests to this fixed URL and does not replace table-name placeholders. |
| headers | Map | No | - | HTTP request headers. Use it when the webhook gateway requires extra headers. |
| params | Map | No | - | Accepted by the option rule, but the current sink writer does not pass it to requests. Put non-sensitive query parameters directly in url when needed. |
| retry | Int | No | - | The maximum retry times when the HTTP request fails with an IOException. |
| retry_backoff_multiplier_ms | Int | No | 100 | Retry backoff multiplier in milliseconds. |
| retry_backoff_max_ms | Int | No | 10000 | Maximum retry backoff in milliseconds. |
| array_mode | Boolean | No | false | Send rows as a JSON array when true, or as one JSON object per request when false. |
| batch_size | Int | No | 1 | The maximum number of rows sent in one request. Only works when array_mode is true. |
| request_interval_ms | Int | No | 0 | Interval in milliseconds between two HTTP requests, used to avoid sending requests too frequently. |
| multi_table_sink_replica | Int | No | 1 | Number of sink replicas used for multi-table write. See Sink Common Options. |
| common-options | No | - | Sink plugin common parameters, please refer to Sink Common Options for details. |
Usage Notes
- The sink always sends
POSTJSON requests; it does not expose amethodoption. - If the webhook URL needs query parameters, include non-sensitive parameters directly in
url. Preferheadersfor authentication material when the gateway supports it, because the full URL, including its query string, may appear in logs or job metadata. - Multi-table jobs can use
multi_table_sink_replica, but the Feishu sink sends every row to the configured fixedurl. It does not replace${database_name},${schema_name}, or${table_name}in the URL. array_modeis useful when the receiver accepts a JSON array and you want fewer HTTP requests.- Feishu webhook delivery is not exactly-once. If a retry happens after the remote service has already handled a request, the receiver may see duplicate messages.
Task Example
Simple
env {
parallelism = 1
job.mode = "BATCH"
}
source {
FakeSource {
row_num = 1
schema = {
fields {
name = string
age = int
}
}
rows = [
{
fields = [tyrantlucifer, 12]
kind = INSERT
}
]
}
}
sink {
Feishu {
url = "https://open.feishu.cn/open-apis/bot/v2/hook/<your-hook-token>"
}
}
With headers and retry
Feishu {
url = "https://open.feishu.cn/open-apis/bot/v2/hook/<your-hook-token>"
headers {
Content-Type = "application/json"
}
retry = 3
retry_backoff_multiplier_ms = 200
retry_backoff_max_ms = 5000
}
Batch rows as JSON array
Feishu {
url = "https://open.feishu.cn/open-apis/bot/v2/hook/<your-hook-token>"
array_mode = true
batch_size = 20
request_interval_ms = 500
}
Multi-table sink replica
Feishu {
url = "https://open.feishu.cn/open-apis/bot/v2/hook/<your-hook-token>"
multi_table_sink_replica = 2
}
Changelog
Change Log
| Change | Commit | Version |
|---|---|---|
| [improve] http connector options (#8969) | https://github.com/apache/seatunnel/commit/63ff9f910a | 2.3.10 |
| [Feature][Restapi] Allow metrics information to be associated to logical plan nodes (#7786) | https://github.com/apache/seatunnel/commit/6b7c53d03c | 2.3.9 |
| [Feature][Connector-V2] Support TableSourceFactory/TableSinkFactory on http (#5816) | https://github.com/apache/seatunnel/commit/6f49ec6ead | 2.3.4 |
| [Improve][build] Give the maven module a human readable name (#4114) | https://github.com/apache/seatunnel/commit/d7cd601051 | 2.3.1 |
| [Improve][Project] Code format with spotless plugin. (#4101) | https://github.com/apache/seatunnel/commit/a2ab166561 | 2.3.1 |
| [Feature][Connector-V2][Http] Add option rules && Improve Myhours sink connector (#3351) | https://github.com/apache/seatunnel/commit/cc8bb60c83 | 2.3.0 |
| [Feature][Connector-V2] Add feishu sink (#2381) | https://github.com/apache/seatunnel/commit/0fec8ca438 | 2.2.0-beta |