https://github.com/lanrion/weixin_authorize php
Add this line to your application's Gemfile:git
gem 'weixin_authorize'
github
And then execute:微信
$ bundle
微信開發
Or install it yourself as:app
$ gem install weixin_authorize
curl
client
$client ||= WeixinAuthorize.configure do |config| config.app_id = ENV["APPID"] config.app_secret = ENV["APPSECRET"] config.expired_at = Time.now.to_iend# Or$client ||= WeixinAuthorize::Client.new(ENV["APPID"], ENV["APPSECRET"])
建立分組:
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")
response = $client.create_menu(menu)
response = $client.menu
response = $client.delete_menu
發送文本信息:
$client.send_text_custom(to_user, content)
發送圖片信息:
$client.send_image_custom(to_user, media_id)
發送語音消息:
$client.send_voice_custom(to_user, media_id)
發送視頻消息:
$client.send_video_custom(to_user, media_id, options)
發送音樂消息:
$client.send_music_custom(to_user, media_id, musicurl, hqmusicurl, options)
發送圖文消息:
$client.send_news_custom(to_user, *articles)
有問題能夠前往:微信開發論壇:http://weixin-dev.com/