template

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Mar 1, 2022 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Overview

Package template 模板消息

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddTemplate

func AddTemplate(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)

获得模板ID

从行业模板库选择模板到帐号后台,获得模板ID的过程可在微信公众平台后台完成。为方便第三方开发者,提供通过接口调用的方式来获取模板ID

See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html

POST https://api.weixin.qq.com/cgi-bin/template/api_add_template?access_token=ACCESS_TOKEN

Example
package main

import (
	"fmt"

	"github.com/fastwego/offiaccount"
	"github.com/fastwego/offiaccount/apis/message/template"
)

func main() {
	var ctx *offiaccount.OffiAccount

	payload := []byte("{}")
	resp, err := template.AddTemplate(ctx, payload)

	fmt.Println(resp, err)
}
Output:

func DelPrivateTemplate

func DelPrivateTemplate(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)

删除模板

删除模板可在微信公众平台后台完成,为方便第三方开发者,提供通过接口调用的方式来删除某帐号下的模板

See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html

POST https://api.weixin.qq.com/cgi-bin/template/del_private_template?access_token=ACCESS_TOKEN

Example
package main

import (
	"fmt"

	"github.com/fastwego/offiaccount"
	"github.com/fastwego/offiaccount/apis/message/template"
)

func main() {
	var ctx *offiaccount.OffiAccount

	payload := []byte("{}")
	resp, err := template.DelPrivateTemplate(ctx, payload)

	fmt.Println(resp, err)
}
Output:

func GetAllPrivateTemplate

func GetAllPrivateTemplate(ctx *offiaccount.OffiAccount) (resp []byte, err error)

获取模板列表

获取已添加至帐号下所有模板列表,可在微信公众平台后台中查看模板列表信息。为方便第三方开发者,提供通过接口调用的方式来获取帐号下所有模板信息

See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html

GET https://api.weixin.qq.com/cgi-bin/template/get_all_private_template?access_token=ACCESS_TOKEN

Example
package main

import (
	"fmt"

	"github.com/fastwego/offiaccount"
	"github.com/fastwego/offiaccount/apis/message/template"
)

func main() {
	var ctx *offiaccount.OffiAccount

	resp, err := template.GetAllPrivateTemplate(ctx)

	fmt.Println(resp, err)
}
Output:

func GetIndustry

func GetIndustry(ctx *offiaccount.OffiAccount) (resp []byte, err error)

获取设置的行业信息

获取帐号设置的行业信息。可登录微信公众平台,在公众号后台中查看行业信息。为方便第三方开发者,提供通过接口调用的方式来获取帐号所设置的行业信息

See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html

GET https://api.weixin.qq.com/cgi-bin/template/get_industry?access_token=ACCESS_TOKEN

Example
package main

import (
	"fmt"

	"github.com/fastwego/offiaccount"
	"github.com/fastwego/offiaccount/apis/message/template"
)

func main() {
	var ctx *offiaccount.OffiAccount

	resp, err := template.GetIndustry(ctx)

	fmt.Println(resp, err)
}
Output:

func Send

func Send(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)

发送模板消息

See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html

POST https://api.weixin.qq.com/cgi-bin/message/template/send?access_token=ACCESS_TOKEN

Example
package main

import (
	"fmt"

	"github.com/fastwego/offiaccount"
	"github.com/fastwego/offiaccount/apis/message/template"
)

func main() {
	var ctx *offiaccount.OffiAccount

	payload := []byte("{}")
	resp, err := template.Send(ctx, payload)

	fmt.Println(resp, err)
}
Output:

func SetIndustry

func SetIndustry(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)

设置所属行业

设置行业可在微信公众平台后台完成,每月可修改行业1次,帐号仅可使用所属行业中相关的模板,为方便第三方开发者,提供通过接口调用的方式来修改账号所属行业

See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/Template_Message_Interface.html

POST https://api.weixin.qq.com/cgi-bin/template/api_set_industry?access_token=ACCESS_TOKEN

Example
package main

import (
	"fmt"

	"github.com/fastwego/offiaccount"
	"github.com/fastwego/offiaccount/apis/message/template"
)

func main() {
	var ctx *offiaccount.OffiAccount

	payload := []byte("{}")
	resp, err := template.SetIndustry(ctx, payload)

	fmt.Println(resp, err)
}
Output:

func Subscribe

func Subscribe(ctx *offiaccount.OffiAccount, payload []byte) (resp []byte, err error)

推送订阅模板消息给到授权微信用户

See: https://developers.weixin.qq.com/doc/offiaccount/Message_Management/One-time_subscription_info.html

POST https://api.weixin.qq.com/cgi-bin/message/template/subscribe?access_token=ACCESS_TOKEN

Example
package main

import (
	"fmt"

	"github.com/fastwego/offiaccount"
	"github.com/fastwego/offiaccount/apis/message/template"
)

func main() {
	var ctx *offiaccount.OffiAccount

	payload := []byte("{}")
	resp, err := template.Subscribe(ctx, payload)

	fmt.Println(resp, err)
}
Output:

Types

This section is empty.

Jump to

Keyboard shortcuts

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