飞书开放平台-发送卡片消息

2023-01-10 08:38:38 浏览数 (1)

前言

本文我们基于飞书开放平台提供的服务端SDK,展示下如何发送发送卡片消息

代码示例

本文我们基于飞书开平提供的go-sdk进行展示,go-sdk的github地址为: https://github.com/larksuite/oapi-sdk-go

代码示例如下:

代码语言:javascript复制
package main

import (
    "context"
    "fmt"
    lark "github.com/larksuite/oapi-sdk-go/v3"
    larkcard "github.com/larksuite/oapi-sdk-go/v3/card"
    larkcore "github.com/larksuite/oapi-sdk-go/v3/core"
    larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1"
    "os"
)

func sendInteractiveMonitorMsg(client *lark.Client) {

    // header
    header := larkcard.NewMessageCardHeader().
        Template(larkcard.TemplateRed).
        Title(larkcard.NewMessageCardPlainText().
            Content("1 级报警 - 数据平台").
            Build()).
        Build()

    // Elements
    divElement1 := larkcard.NewMessageCardDiv().
        Fields([]*larkcard.MessageCardField{
            larkcard.NewMessageCardField().
                Text(larkcard.NewMessageCardLarkMd().
                    Content("**


	

0 人点赞