前言
本文我们基于飞书开放平台提供的服务端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 sendShardChatMsg(client *lark.Client) {
msgShareChat := larkim.MessageShareChat{ChatId: "oc_3c91943a1276c5d9fe44717deb1682b7"}
content, err := msgShareChat.String()
if err != nil {
fmt.Println(err)
return
}
resp, err := client.Im.Message.Create(context.Background(), larkim.NewCreateMessageReqBuilder().
ReceiveIdType(larkim.ReceiveIdTypeOpenId).
Body(larkim.Ne