You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.en.md
+69-2Lines changed: 69 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -130,7 +130,44 @@ res.reply([
130
130
}
131
131
]);
132
132
```
133
-
133
+
#### Reply with social function messages
134
+
```js
135
+
res.reply({
136
+
type:'hardware',
137
+
HardWare:{
138
+
MessageView:'myrank',
139
+
MessageAction:'ranklist'
140
+
}
141
+
});
142
+
```
143
+
### Reply with device messages
144
+
Specific responses will be made as the message type is device_text or device_event.
145
+
```js
146
+
var wechat =require('wechat');
147
+
var config = {
148
+
token:'token',
149
+
appid:'appid',
150
+
encodingAESKey:'encodinAESKey'
151
+
};
152
+
153
+
app.use(express.query());
154
+
app.use('/wechat', wechat(config, function (req, res, next) {
155
+
// message is located in req.weixin
156
+
var message =req.weixin;
157
+
if (message.MsgType==='device_text') {
158
+
// device text
159
+
res.reply('This message will be pushed onto the device.');
160
+
} elseif (message.MsgType==='device_event') {
161
+
if (message.Event==='subscribe_status'||
162
+
message.Event==='unsubscribe_status') {
163
+
//subscribe or unsubscribe the WIFI device status,the reply should be 1 or 0
164
+
res.reply(1);
165
+
} else {
166
+
res.reply('This message will be pushed onto the device.')
167
+
}
168
+
}
169
+
}));
170
+
```
134
171
### WXSession
135
172
136
173
Wechat messages are not communicate like traditional C/S model, therefore nothing Cookies will be store in Wechat client. this WXSession is designed to support access user's infomation via `req.wxsession`, with `connect.session` backed.
0 commit comments