微信API access_token 验证 weixin_authorize

https://github.com/lanrion/weixin_authorize


WeixinAuthorize

Installation

Add this line to your application's Gemfile:

gem 'weixin_authorize'

And then execute:

$ bundle

Or install it yourself as:

$ gem install weixin_authorize

Usage

Init a 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")

自定义菜单

发送客服信息

  • 发送文本信息:

    $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/


转载于:https://my.oschina.net/u/200705/blog/208618

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值