notify

package
v0.0.0-...-9427a82 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2023 License: BSD-3-Clause Imports: 29 Imported by: 1

Documentation

Overview

* * @Description:移动短信 e.g.

cmSms := ChinaMobileSms{
	TemplateId:"",
	Mobiles:"",
	Params:"",
}

cmSms.Send()

* * @Description:一信通平台发短信

* 使用示例:

var dd = notify.DingDing{
	ApiUrl: "https://oapi.dingtalk.com/robot/send?access_token=xxxxx",
	Content: "xx接口异常通知测试",
}
_,err := dd.Send()

*

  • @Description telegram notify
  • @Author $
  • @Date $ $ *

* * @Description:邮件发送

/* 例:

    var dd = &notify.Email{
	EmailTo: []string{"ww@qq.cn",},
	Subject: "发件测试",
	Body: "发件内容",
}

res,err := dd.Send() fmt.Println(res,err)

* * @Description:阿里云发短信

*

  • @Description telegram notify *

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Discord

func Discord(title, content string)

func InitConfig

func InitConfig(config string)

func NotifyAll

func NotifyAll(title, message string, token ...string)

func PushPlus

func PushPlus(title, content string, token ...string)

func Telegram

func Telegram(text string)

Types

type AliSms

type AliSms struct {
	PhoneNumberJson     string //电话号码 ["1590000****","1350000****"]
	SignNameJson        string //短信签名名称,JSON数组格式。
	TemplateCode        string //短信模板CODE。如 SMS_152550005
	TemplateParamJson   string //短信模板变量对应的实际值,JSON格式。 [{"name":"TemplateParamJson"},{"name":"TemplateParamJson"}]
	SmsUpExtendCodeJson string //上行短信扩展码,JSON数组格式。无特殊需要此字段的用户请忽略此字段。
	// contains filtered or unexported fields
}

func (*AliSms) Send

func (srv *AliSms) Send(templateCode string) (aliSmsResult *dysmsapi20170525.SendBatchSmsResponse, err error)

发送短信, templateCode模板编码(默认调用配置中的)

type ChinaMobileSms

type ChinaMobileSms struct {
	TemplateId string `json:"templateId"` //模板ID
	Mobiles    string `json:"mobiles"`    //收信手机号码。英文逗号分隔,每批次限5000个号码,例:“13800138000,13800138001,13800138002”。
	Params     string `json:"params"`     //模板变量。格式:[“param1”,“param2”],无变量模板填[""]。
}

func (*ChinaMobileSms) Send

func (srv *ChinaMobileSms) Send() error

type ChinaUnicomSms

type ChinaUnicomSms struct {
	PhoneNumberJson   string //电话号码 ["1590000****","1350000****"]
	TemplateCode      string //短信模板CODE。如 SMS_152550005
	TemplateParamJson string //短信模板变量对应的实际值,JSON格式。 [{"name":"TemplateParamJson"},{"name":"TemplateParamJson"}]
}

func (*ChinaUnicomSms) Send

func (srv *ChinaUnicomSms) Send() (aliSmsResult *dysmsapi20170525.SendBatchSmsResponse, err error)

发送短信, templateCode模板编码(默认调用配置中的) 如果短信模板没有备案,则http状态码为505 接口有限制调用方IP

type DingDing

type DingDing struct {
	ApiUrl  string //接口地址
	Content string //要发送的内容
	// contains filtered or unexported fields
}

func (*DingDing) Send

func (srv *DingDing) Send() (res string, err error)

curl --location --request POST 'https://oapi.dingtalk.com/robot/send?access_token='$token \ --header 'Content-Type: application/json' \ --data "{ \"msgtype\": \"text\", \"text\": { \"Content\": \"${Content}\" } }"

type DingDingTextContent

type DingDingTextContent struct {
	Content string `json:"content"`
}

type Email

type Email struct {
	EmailTo []string //接收邮件地址
	Subject string   //标题
	Body    string   //内容
	// contains filtered or unexported fields
}

func (*Email) Send

func (srv *Email) Send() (res string, err error)

type KV

type KV map[string]string

Jump to

Keyboard shortcuts

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