Get started with wechat.js CDN

MIT licensed

WeChat.js is a JS SDK for integrating WeChat functionality into websites.

Tags:
  • chat
  • im
  • wechat
  • sns
  • sharing

Stable version

Copied!

How to start using wechat.js CDN


// Include the WeChat.js library
const script = document.createElement('script');
script.src = 'https://cdn.cdnhub.io/wechat.js/0.1.3/wechat.min.js';
document.head.appendChild(script);

// Wait for the library to load
window.onWeixinReady = function () {
  // Check if the user is logged in
  if (window.weixin && typeof window.weixin.onMenuShareAppMessage === 'function') {
    // Set up the share data
    window.weixin.onMenuShareAppMessage({
      title: 'Title of the shared message',
      desc: 'Description of the shared message',
      link: 'https://example.com',
      imgUrl: 'https://example.com/image.jpg'
    });
  }
};
Copied!
Copied!

All versions