template

package
v1.5.4 Latest Latest
Warning

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

Go to latest
Published: Oct 7, 2019 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Overview

Package template 模版消息

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add(id, token string, keywordIDList []uint) (string, error)

Add 组合模板并添加至帐号下的个人模板库

@id 模板ID @token 微信 aceess_token @keywordIDList 关键词 ID 列表 返回新建模板ID和错误信息

func Delete

func Delete(id, token string) error

Delete 删除帐号下的某个模板

@id 模板ID @token 微信 aceess_token

func Send

func Send(openid, template, page, formID string, data Message, emphasisKeyword, token string) error

Send 发送模板消息

@openid 接收者(用户)的 openid @template 所需下发的模板消息的id @page 点击模板卡片后的跳转页面,仅限本小程序内的页面。支持带参数,(示例index?foo=bar)。该字段不填则模板无跳转。 @formID 表单提交场景下,为 submit 事件带上的 formId;支付场景下,为本次支付的 prepay_id @data 模板内容,不填则下发空模板 @emphasisKeyword 模板需要放大的关键词,不填则默认无放大

Types

type Data

type Data map[string]Keyword

Data 模板消息内容

type Keyword

type Keyword struct {
	Value string `json:"value"`
	Color string `json:"color"`
}

Keyword 关键字

type KeywordItem

type KeywordItem struct {
	KeywordID uint   `json:"keyword_id"`
	Name      string `json:"name"`
	Example   string `json:"example"`
}

KeywordItem 关键字

func Get

func Get(id, token string) (keywords []KeywordItem, err error)

Get 获取模板库某个模板标题下关键词库

@id 模板ID @token 微信 access_token

type MPTemplateMsg

type MPTemplateMsg struct {
	AppID       string             `json:"appid"`
	TemplateID  string             `json:"template_id"`
	URL         string             `json:"url"`
	Miniprogram Miniprogram        `json:"miniprogram"`
	Data        map[string]Keyword `json:"data"`
}

MPTemplateMsg 公众号模板消息

type Message

type Message map[string]interface{}

Message 模版消息体

type Miniprogram

type Miniprogram struct {
	AppID    string `json:"appid"`
	Pagepath string `json:"pagepath"`
}

Miniprogram 小程序

type Template

type Template struct {
	weapp.Response
	ID         string `json:"id,omitempty"`
	TemplateID string `json:"template_id,omitempty"`
	Title      string `json:"title"`
	Content    string `json:"content,omitempty"`
	Example    string `json:"example,omitempty"`

	KeywordList []KeywordItem `json:"keyword_list,omitempty"`
}

Template 消息模板

func List

func List(offset uint, count uint, token string) (list []Template, total uint, err error)

List 获取小程序模板库标题列表

@offset 开始获取位置 从0开始 @count 获取记录条数 最大为20 @token 微信 access_token

func Selves

func Selves(offset uint, count uint, token string) (list []Template, total uint, err error)

Selves 获取帐号下已存在的模板列表

@offset 开始获取位置 从0开始 @count 获取记录条数 最大为20 @token 微信 access_token

type Templates

type Templates struct {
	weapp.Response
	List       []Template `json:"list"`
	TotalCount uint       `json:"total_count"`
}

Templates 获取模板列表返回的数据

type UniformMsg

type UniformMsg struct {
	ToUser           string           `json:"touser"` // 用户 openid
	MPTemplateMsg    MPTemplateMsg    `json:"mp_template_msg"`
	WeappTemplateMsg WeappTemplateMsg `json:"weapp_template_msg"`
}

UniformMsg 统一服务消息

func (UniformMsg) Send

func (msg UniformMsg) Send(token string) error

Send 统一服务消息

@token access_token

type WeappTemplateMsg

type WeappTemplateMsg struct {
	TemplateID      string `json:"template_id"`
	Page            string `json:"page"`
	FormID          string `json:"form_id"`
	Data            Data   `json:"data"`
	EmphasisKeyword string `json:"emphasis_keyword,omitempty"`
}

WeappTemplateMsg 小程序模板消息

Jump to

Keyboard shortcuts

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