mp.start()
The starting middleware, to parse a Wechat message request, and set req.body
as a JS object.
mp.end()
The ending middleware, to response a xml based on res.body
.
For how to set res.body
for multi media messages, see source code lib/xml.js
.
If your set res.body
to a string, will reply a text message. When res.body
is an object,
a res.body.msgType
is expected, otherwise it will be treated as text message,
and res.body.content
will be replied as it was a string.
典型的响应:
{
msgType: 'news',
content: [{
title: 'news 1',
url: 'http://...',
picUrl: 'http://...'
}, {
title: 'news 2',
url: 'http://...',
picUrl: 'http://...'
}]
}