Skip to content

Commit

Permalink
Append: Optimize lark doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Pil0tXia committed Dec 16, 2023
1 parent 907ec59 commit c25b214
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 8 deletions.
11 changes: 7 additions & 4 deletions docs/design-document/03-connect/01-lark-connector.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# Lark
# Feishu/Lark

## Lark Sink Server Config And Start

Before using eventmesh-connector-lark to sink events, you need to configure the server.

- Please customize `sinkEnable``=`true`/`false` in `/resource/server-config.yml` to turn on/off the sink function.
- Regarding `/resource/sink-config.yml`, only the configuration under `sinkConnectorConfig` is explained here:
- `connectorName`, specify the connector name
Expand All @@ -17,9 +18,10 @@ Before using eventmesh-connector-lark to sink events, you need to configure the
## Sink CloudEvent To Lark

When using the eventmesh-connector-lark sinking event, you need to add the corresponding extension filed in CloudEvent:
- When key=`templatetype4lark`, value=`text`/`markdown`, indicating the text type of the event
- When the text type is markdown, you can add extension: key=`markdownmessagetitle4lark`, value indicates the title of the event.
- When key=`atusers4lark`, value=`id-0,name-0;id-1,name-1`, indicating that the event requires `@`certain users

- When key=`templatetype4lark`, value=`text`/`markdown`, indicating the text type of the event.
- When text type is markdown, you can add extension: key=`markdownmessagetitle4lark`, value indicates the title of the event.
- When key=`atusers4lark`, value=`id-0,name-0;id-1,name-1`, indicating that the event requires `@`certain users.
- It is recommended to use **open_id** for id.
- When the text is of text type, the id can be **open_id/union_id/user_id**; when the text is of markdown type, the id can be **open_id/user_id**. In particular, when the application type is [custom robot](https://open.larksuite.com/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN) and the text is of markdown type, only the use of **open_id** to `@` the user is supported.
- When the text is of text type and the id is invalid, name will be used instead for display; when the text is of markdown type and the id is invalid, an exception will be thrown directly (you should try to ensure the correctness of the id, and name can be considered omitted).
Expand All @@ -28,6 +30,7 @@ When using the eventmesh-connector-lark sinking event, you need to add the corre
## Lark Open Platform API

For the Lark open platform API involved in this module, please click the following link:

- **Send Message**, please [view here](https://open.larksuite.com/document/server-docs/im-v1/message/create?appId=cli_a5e1bc31507ed00c)
- **text**, please [view here](https://open.larksuite.com/document/server-docs/im-v1/message-content-description/create_json#c9e08671)
- **markdown**, please [view here](https://open.larksuite.com/document/common-capabilities/message-card/message-cards-content/using-markdown-tags)
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
## Lark Sink Server 的配置与启动

使用 eventmesh-connector-lark 下沉事件之前,需要进行 server 的配置。

- 请在`/resource/server-config.yml`中自定义`sinkEnable`=`true`/`false`以开启/关闭 sink 功能。
- 关于`/resource/sink-config.yml`,在此仅说明`sinkConnectorConfig`下的配置:
- `connectorName`, 指定 connector 名称
Expand All @@ -17,17 +18,19 @@
## 可下沉飞书的 CLoudEvent

使用 eventmesh-connector-lark 下沉事件时,需要在 CloudEvent 中添加对应的 extension filed:
- 当 key=`templatetype4lark`时,value=`text`/`markdown`,表明该事件的文本类型
- 当文本类型为 markdown 时,可以添加 extension:key=`markdownmessagetitle4lark`,value 表明该事件的标题。
- 当 key=`atusers4lark`时,value=`id-0,name-0;id-1,name-1`,表明该事件需要`@`某些用户

- 当 key=`templatetype4lark`时,value=`text`/`markdown`,表明该事件的文本类型。
- 当文本类型 `templatetype4lark` 为 markdown 时,可以为文本设置标题。添加 extension:key=`markdownmessagetitle4lark`,value 为该事件的标题。
- 当 key=`atusers4lark`时,value=`id-0,name-0;id-1,name-1`,表明该事件需要`@`某些用户。
- id 推荐使用 **open_id**
- 当文本属于 text 类型时,id 可以是 **open_id/union_id/user_id**; 当文本属于 markdown 类型时,id 可以是 **open_id/user_id**。特别地,当应用类型为 [自定义机器人](https://open.feishu.cn/document/ukTMukTMukTM/ucTM5YjL3ETO24yNxkjN) 且文本属于 markdown 类型,则仅支持使用 **open_id**`@`用户。
- 当文本属于 text 类型且 id 无效时,将利用 name 代替展示;当文本属于 markdown 类型时且 id 无效时,直接抛出异常 (您应该尽量保证 id 的正确性,而 name 则可以考虑省略)。
- 当文本属于 text 类型且 id 无效时,将利用 name 代替展示;当文本属于 markdown 类型时且 id 无效时,直接抛出异常(您应该尽量保证 id 的正确性,而 name 则可以考虑省略)。
- 当 key=`atall4lark`时,value=`true`/`false`,表明该事件需要`@`所有人。

## 飞书开放平台 API

有关该模块涉及到的飞书开放平台 API,请点击以下链接:

- **发送消息**,请 [查看这里](https://open.feishu.cn/document/server-docs/im-v1/message/create?appId=cli_a5e1bc31507ed00c)
- **text**,请 [查看这里](https://open.feishu.cn/document/server-docs/im-v1/message-content-description/create_json#c9e08671)
- **markdown**,请 [查看这里](https://open.feishu.cn/document/common-capabilities/message-card/message-cards-content/using-markdown-tags)

0 comments on commit c25b214

Please sign in to comment.