Giter Club home page Giter Club logo

gowechat's Introduction

gowechat

一款由Go语言开发的微信公众号后台框架,通过本框架可快速搭建起微信公众号后台服务器,支持订阅号和服务号。 由于公众号后台服务在用户交互时大部分情景需要交互响应,此处涉及的模板推荐参考接下来会开源的开发样例。

功能

功能 描述 完成状态
TOKEN定时刷新 定时刷新微信服务器Token,默认刷新周期3600秒。
自定义菜单 支持自定义菜单设置,启动刷新调整
接收普通消息 接收并保存用户返回的普通消息(文本、图片、语音、视频、小视频、地理位置)
接收事件推送 接收并保存用户与公众号交互产生的事件
被动消息回复 支持被动消息回复功能
客服消息 支持外部客服消息接入
安全模式 支持安全模式的加密解密功能
模板消息 支持模板消息发送
安全模式 支持安全模式的加密解密功能

使用方法

获取gowechat库

go get github.com/dennismao/gowechat

程序调用

import(
	"github.com/dennismao/wechat"
)

使用示例

package main

import (
	"fmt"
	_ "teaer/routers"

	"github.com/astaxie/beego"
	"github.com/dennismao/gowechat"
)

const (
	Appid     = ""
	Appsecret = ""
	Token     = ""
)

func main() {

	//	Substantialize server
	myWechat, err := gowechat.New("", "", "")
	if err != nil {
		fmt.Println(err)
		return
	}

	//	refresh token
	go myWechat.Token_Refresh()

	//	Initialization
	//	Create custom menu
	err = myWechat.CustomMenuCreate([]gowechat.CustomButton{
		wechat.CustomButton{
			Name: "主菜单",
			SubButton: []gowechat.Button{
				wechat.Button{
					Type: "views",
					Name: "百度搜索",
					Url:  "www.baidu.com",
				},
				gowechat.Button{
					Type: "click",
					Name: "点击事件",
					Key:  "V1000_button1",
				},
			},
		},
	})
	if err != nil {
		fmt.Println(err)
	}

	//	Run the http server
	beego.Run()
}

License

gowechat source code is licensed under the MIT Licence

gowechat's People

Contributors

dennismao avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.