前言
本文我们基于飞书开放平台提供的服务端SDK,展示下如何发送文本&富文本消息
代码示例
本文我们基于飞书开平提供的go-sdk进行展示,go-sdk的github地址为:
https://github.com/larksuite/oapi-sdk-go
代码示例如下:
package main
import (
"context"
"fmt"
lark "github.com/larksuite/oapi-sdk-go/v3"
larkcore "github.com/larksuite/oapi-sdk-go/v3/core"
larkim "github.com/larksuite/oapi-sdk-go/v3/service/im/v1"
"os"
)
func sendTextMsg(client *lark.Client) {
// Build the text message content
//content := "{\"text\":\"hello,world\\n<at user_id=\\\"ou_c245b0a7dff2725cfa2fb104f8b48b9d\\\">加多</at>\"}"
content := larkim.NewTextMsgBuilder().
Text("hello,world").
AtUser("ou_c245b0a7dff2725cfa2fb104f8b48b9d", "加多").
Build()
resp, err :&