Git Product home page Git Product logo

we-api's Introduction

Wechat API

npm version install size npm downloads

基于 Model 形式对微信公众号 API 进行封装,并且支持 Typescript。它有以下优点

  • 支持 Typescript
  • Model Style
  • 上传素材时,会提前自动上传非微信域名图片

快速使用

使用 npm 装包

$ npm i we-api

使用 we-api 进行素材上传

import Wechat, { Article } from 'we-api'

const wechat = new Wechat(appId, appSecret)

await Article.init({ modelName: 'article', wechat })

await Article.create({
  thumbMediaId: 'yspyRwTb0m9UyK78TLER8E_wdRSWjp6KJF8d2p_vVP4',
  title: '前端部署发展史',
  author: '山月',
  showCoverPic: 0,
  content: '前端一说起刀耕火种,那肯定紧随着前端工程化这一话题。...',
  contentSourceUrl: 'https://shanyue.tech/frontend-engineering/deploy.html'
})

API

Article

  • Article.create(article): 上传文章,如果文章内容包含图片,则会自动转成微信域名内图片
  • Article.bulkCreate(article): 上传多图文消息

News

  • News.create(news)

Media

  • Media.create(media)

we-api's People

Contributors

shfshanyue avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.