Giter VIP home page Giter VIP logo

mp-push-leancloud's Introduction

MP-PUSH

LeanCloud 不再提供二级域名,建议使用docker版本,地址https://github.com/brucx/mp-push-nestjs

一个频道可以被多个微信订阅,一个微信也可以订阅多个频道。当有消息到达频道时,会向所有订阅的微信推送通知。

开发此项目的目的是实现一个自己的“Server酱”,方便自定义。

零痛苦部署,极度简单的API,代码开源,自由扩展。

准备好服务号或者测试号

如果注册不了服务号也一点关系没有,测试号完全可以满足个人使用的需求。打开这里进行注册。

先配置一个消息模板,需要带一个 text 字段。

没钱买服务器也没关系

LeanCloud 提供免费的后台托管,去这里注册一个。

然后新建一个应用,在控制台创建 ChannelUserToChannel 两个 Class

在云引擎的设置里面添加自定义环境变量:

  • WX_APP_ID 测试号 appID
  • WX_APP_SC 测试号 appsecret
  • WX_TOKEN 需和接口配置信息的 Token 一致
  • WX_TEMPLATE_ID 新建的模板 ID
  • WX_TEMPLATE_DEST 模板的详情要打开的 URL,目前可以瞎填

绑定一个二级域名

准备部署

首先确认本机已经安装 LeanCloud 命令行工具,然后执行下列指令:

$ git clone https://github.com/brucx/mp-push-leancloud.git
$ cd mp-push-leancloud

登录并关联应用:

lean login
lean switch

部署到 LeanEngine:

lean deploy

确认接口配置信息

测试号管理页面确认接口配置信息。

URL 为 https://二级域名.leanapp.cn/wx

Token 需和 WX_TOKEN 一致

测试接口

关注测试号,发送 link 频道名称 绑定频道。

发送 POST 请求触发推送

curl -X POST 'https://二级域名.leanapp.cn/push' \
-H 'content-type: application/json' \
-d '{ "channelName": "频道名称", "text": "OK" }'

mp-push-leancloud's People

Contributors

brucx avatar dependabot[bot] avatar

Watchers

 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.