lark icon indicating copy to clipboard operation
lark copied to clipboard

Does it support multi-lines post message

Open Nanyan opened this issue 2 years ago • 3 comments

Currently I found it seems do not support multi-lines message when I'm using the PostNotificationV2 method.

Am I missing something?

Will it be supported?

Thanks.

Nanyan avatar Mar 14 '23 10:03 Nanyan

Currently I found it seems do not support multi-lines message when I'm using the PostNotificationV2 method.

Am I missing something?

Will it be supported?

Thanks.

May I ask what is a multi-line message? I think it's available to just use \n to post multi-line.

crispgm avatar Mar 14 '23 13:03 crispgm

Great, using \n to start a new line works fine.

I saw there's a different example from the official docs to post a rich text, as follows:

{
    "chat_id": "oc_5ce6d572455d361153b7cb51da133945",
    "msg_type": "post",
    "content": {
        "post": {
            "zh_cn": {
                "title": "I am a title",
                "content": [
                    [
                        {
                            "tag": "text",
                            "un_escape": true,
                            "text": "line 1 :",
                        },
                        {
                            "tag": "a",
                            "text": "super link",
                            "href": "www.baidu.com"
                        },
                        {
                            "tag": "at",
                            "user_id": "ou_18eac85d35a26f989317ad4f02e8bbbb"
                        }
                    ],
                    [
                        {
                            "tag": "text",
                            "text": "line 2 :",
                        },
                        {
                            "tag": "text",
                            "text": "text content",
                        }
                    ],
                    [
                        {
                            "tag": "text",
                            "text": "",
                        },
                        {
                            "tag": "img",
                            "image_key": "b15a91e5-156d-4d81-8bac-3d27c321001b",
                            "width": 300,
                            "height": 300
                        }
                    ]
                ]
            }
        }
    }
}

It seems currently this package do not support the above rich text. Do you think it's better to support it?

Nanyan avatar Mar 15 '23 02:03 Nanyan

Great, using \n to start a new line works fine.

I saw there's a different example from the official docs to post a rich text, as follows:

{
    "chat_id": "oc_5ce6d572455d361153b7cb51da133945",
    "msg_type": "post",
    "content": {
        "post": {
            "zh_cn": {
                "title": "I am a title",
                "content": [
                    [
                        {
                            "tag": "text",
                            "un_escape": true,
                            "text": "line 1 :",
                        },
                        {
                            "tag": "a",
                            "text": "super link",
                            "href": "www.baidu.com"
                        },
                        {
                            "tag": "at",
                            "user_id": "ou_18eac85d35a26f989317ad4f02e8bbbb"
                        }
                    ],
                    [
                        {
                            "tag": "text",
                            "text": "line 2 :",
                        },
                        {
                            "tag": "text",
                            "text": "text content",
                        }
                    ],
                    [
                        {
                            "tag": "text",
                            "text": "",
                        },
                        {
                            "tag": "img",
                            "image_key": "b15a91e5-156d-4d81-8bac-3d27c321001b",
                            "width": 300,
                            "height": 300
                        }
                    ]
                ]
            }
        }
    }
}

It seems currently this package do not support the above rich text. Do you think it's better to support it?

This is available but you may use MsgBuffer to build one. Refer to here: https://github.com/go-lark/lark/blob/main/api_notification_test.go#L39

crispgm avatar Mar 15 '23 02:03 crispgm