Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
weixin_authorize
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
ikcrm_common
weixin_authorize
Commits
3a2813ae
Commit
3a2813ae
authored
Mar 16, 2014
by
lanrion
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
updated README.md
parent
547343f2
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
69 additions
and
23 deletions
+69
-23
README.md
+69
-23
No files found.
README.md
View file @
3a2813ae
# WeixinAuthorize
1, 获取access_token: https://api.weixin.qq.com/cgi-bin/token?grant_type=client_credential&appid=APPID&secret=APPSECRET
## Installation
2, 上传多媒体文件
Add this line to your application's Gemfile:
http请求方式: POST/FORM
http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE
调用示例(使用curl命令,用FORM表单方式上传一个多媒体文件):
curl -F media=@test.jpg "http://file.api.weixin.qq.com/cgi-bin/media/upload?access_token=ACCESS_TOKEN&type=TYPE"
gem 'weixin_authorize'
3, 发送客服消息
And then execute:
http请求方式: POST
https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token=ACCESS_TOKEN
$ bundle
4, 获取用户基本信息
Or install it yourself as:
http请求方式: GET
https://api.weixin.qq.com/cgi-bin/user/info?access_token=ACCESS_TOKEN&openid=OPENID&lang=zh_CN
$ gem install weixin_authorize
5, 获取关注者列表
## Usage
http请求方式: GET(请使用https协议)
https://api.weixin.qq.com/cgi-bin/user/get?access_token=ACCESS_TOKEN&next_openid=NEXT_OPENID
### Init a `client`
```
ruby
## Installation
$client
||=
WeixinAuthorize
.
configure
do
|
config
|
config
.
app_id
=
ENV
[
"APPID"
]
config
.
app_secret
=
ENV
[
"APPSECRET"
]
config
.
expired_at
=
Time
.
now
.
to_i
end
Add this line to your application's Gemfile:
# Or
gem 'weixin_authorize'
$client
||=
WeixinAuthorize
::
Client
.
new
(
ENV
[
"APPID"
],
ENV
[
"APPSECRET"
])
And then execute:
```
$ bundle
### 获取用户管理信息
Or install it yourself as:
*
[
获取用户基本信息
](
http://mp.weixin.qq.com/wiki/index.php?title=获取用户基本信息
)
$ gem install weixin_authorize
`user_info = $client.user(ENV["OPENID"])`
## Usage
*
[
获取关注者列表
](
http://mp.weixin.qq.com/wiki/index.php?title=获取关注者列表
)
`followers = $client.followers`
### 分组管理
*
[
分组管理接口
](
http://mp.weixin.qq.com/wiki/index.php?title=分组管理接口
)
*
创建分组
`group = $client.create_group("test")`
*
查询所有分组
`groups = $client.groups`
*
查询用户所在分组
`group = $client.get_group_for(ENV["OPENID"])`
*
修改分组名
`group = $client.update_group_name(ENV["OPENID"], "new_group_name")`
*
移动用户分组
`group = $client.update_group_for_openid(ENV["OPENID"], "to_groupid")`
### 自定义菜单
*
[
自定义菜单创建接口
](
http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单创建接口
)
`response = $client.create_menu(menu)`
*
[
自定义菜单查询接口
](
http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单查询接口
)
`response = $client.menu`
*
[
自定义菜单删除接口
](
http://mp.weixin.qq.com/wiki/index.php?title=自定义菜单删除接口
)
`response = $client.delete_menu`
### [发送客服信息](http://mp.weixin.qq.com/wiki/index.php?title=发送客服信息)
*
发送文本信息
`send_text_custom(to_user, content)`
*
发送图片信息
`sent_image_custom(to_user, media_id)`
*
发送语音消息
`sent_voice_custom(to_user, media_id)`
*
发送视频消息
`sent_video_custom(to_user, media_id, options)`
*
发送音乐消息
`sent_music_custom(to_user, media_id, musicurl, hqmusicurl, options)`
*
发送图文消息
`send_news_custom(to_user, *articles)`
## Contributing
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment