larkwebhook

package module
v0.1.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 1, 2020 License: MIT Imports: 8 Imported by: 0

README

larkwebhook

lark bot webhook api

Documentation

Index

Constants

View Source
const (
	//TagText tag for test message
	TagText = "text"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Message

type Message interface {
	Type() string //speicit msg_type
	Content() interface{}
}

Message specific the message send by bot https://www.larksuite.com/hc/en-US/articles/360048487736#1.1.2%20Plain%20text%20messages

type MsgPost

type MsgPost struct {
	Title string
	Tags  []PostTag
}

MsgPost message in lark post format

func (*MsgPost) Content

func (mp *MsgPost) Content() interface{}

func (*MsgPost) Type

func (mp *MsgPost) Type() string

type PostTag

type PostTag struct {
	Tag  string `json:"tag"`
	Text string `json:"text"`
}

PostTag a message tag

type Robot

type Robot struct {
	// contains filtered or unexported fields
}

Robot is a webhook instance which used to send message

func NewRobot

func NewRobot(botID string) *Robot

NewRobot create a robot with specific botID

func (*Robot) Send

func (r *Robot) Send(ctx context.Context, msg Message, dst interface{}) error

Send msg and unmarshal json result into dst

func (*Robot) SendPost

func (r *Robot) SendPost(ctx context.Context, title string, tags ...PostTag) error

SendPost build and send post message via robot

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL