
Security News
New Website “Is It Really FOSS?” Tracks Transparency in Open Source Distribution Models
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
The Wechat Core Library is a code base to call the core Wechat APIs, such as fetching Access Token, and fetching Follower Profile. 微信核心库用于调用微信核心API,例如获取访问令牌,获取关注者的信息。
Check out the Road Map to find out what's the next. Check out the Change Log to find out what's new.
Add this line to your application's Gemfile:
gem 'wechat-core'
And then execute:
$ bundle
Or install it yourself as:
$ gem install wechat-core
Get the Wechat Access Token 获取微信访问令牌
response = Wechat::Core::AccessToken.load Rails.application.secrets.wechat_app_id, Rails.application.secrets.wechat_app_secret
if response.present?
access_token = response['access_token']
expires_in = response['expires_in']
end
response = Wechat::Core::Follower.index access_token
if response.present? && 0==response['errcode'].to_i
total = response['total']
count = response['count']
next_open_id = response['next_openid']
data = response['data']
data['openid'].each do |open_id|
# Show open_id
end
else
# Show response['errmsg']
end
Get the Follower List with Pagination 分页获取关注者列表
response = Wechat::Core::Follower.index access_token, next_open_id
if response.present? && 0==response['errcode'].to_i
total = response['total']
count = response['count']
next_open_id = response['next_openid']
data = response['data']
data['openid'].each do |open_id|
# Show open_id
end
else
# Show response['errmsg']
end
Get the Follower Profiles by Batch 批量获取关注者轮廓
response = Wechat::Core::FollowerProfile.index access_token, [ open_id_1, open_id_2, ... ]
if response.present? && 0==response['errcode'].to_i
response['user_info_list'].each do |profile|
subscribed = profile['subscribe']
open_id = profile['openid']
nick_name = profile['nickname']
sex = profile['sex']
language = profile['language']
city = profile['city']
province = profile['province']
country = profile['country']
portrait_link = profile['headimgurl']
subscribe_time = profile['subscribe_time']
union_id = profile['unionid']
remark = profile['remark']
group_id = profile['groupid']
end
else
# Show response['errmsg']
end
Get the Follower Profile 获取用户基本信息
response = Wechat::Core::FollowerProfile.load access_token, open_id
if response.present? && 0==response['errcode'].to_i
subscribed = response['subscribe']
open_id = response['openid']
nick_name = response['nickname']
sex = response['sex']
language = response['language']
city = response['city']
province = response['province']
country = response['country']
portrait_link = response['headimgurl']
subscribe_time = response['subscribe_time']
union_id = response['unionid']
remark = response['remark']
group_id = response['groupid']
else
# Show response['errmsg']
end
response = Wechat::Core::ServerAddress.index access_token
if response.present? && 0==response['errcode'].to_i
response['ip_list'].each do |ip_address|
# Do something with the IP Address...
end
else
# Show response['errmsg']
end
response = Wechat::Core::TinyLink.create access_token, 'http://product.company.com/promotion/page.html'
if response.present? && 0==response['errcode'].to_i
tiny_link = response['short_url']
else
# Show response['errmsg']
end
After checking out the repo, run bin/setup
to install dependencies. Then, run rake spec
to run the tests. You can also run bin/console
for an interactive prompt that will allow you to experiment.
To install this gem onto your local machine, run bundle exec rake install
. To release a new version, update the version number in version.rb
, and then run bundle exec rake release
, which will create a git tag for the version, push git commits and tags, and push the .gem
file to rubygems.org.
Bug reports and pull requests are welcome on GitHub at https://github.com/topbitdu/wechat-core. This project is intended to be a safe, welcoming space for collaboration, and contributors are expected to adhere to the Contributor Covenant code of conduct.
The gem is available as open source under the terms of the MIT License.
FAQs
Unknown package
We found that wechat-core demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
A new site reviews software projects to reveal if they’re truly FOSS, making complex licensing and distribution models easy to understand.
Security News
Astral unveils pyx, a Python-native package registry in beta, designed to speed installs, enhance security, and integrate deeply with uv.
Security News
The Latio podcast explores how static and runtime reachability help teams prioritize exploitable vulnerabilities and streamline AppSec workflows.