asp.net - Not getting WeChat Follow response -
i have debugging official account wechat. have entered public url , token field provided http://admin.wechat.com/debug/sandbox , attempted debugging request http://admin.wechat.com/debug/
my asp.net [.net4.5] web api application's post method looks following :
public httpresponsemessage postmessage([frombody]strikemedia.api.wechat.textmessage value) { if (value == null) { var richmediamessage = new richmediamessage(); richmediamessage.touser = value.fromusername; //create article var item = new article() { title = "didn't receive back", description = "mind entering 'test'", picurl = "url", url = "url" }; var articles = new list<article>(); articles.add(item); richmediamessage.articles = articles; richmediamessage.articlecount = articles.count; return request.createresponse(httpstatuscode.ok, richmediamessage, "application/json"); } var exploded = value.content.split(' ')[0]; var richmedia = new richmediamessage(); richmedia.touser = value.fromusername; //create article var article = new article() { title = response.keyworddescription, description = response.response, picurl = "url", url = "url" }; var _articles = new list<article>(); _articles.add(article); richmedia.articles = _articles; richmedia.articlecount = _articles.count; //return response var resp = request.createresponse(httpstatuscode.ok, richmedia, "application/json"); //resp.requestmessage.content.headers.contenttype = new system.net.http.headers.mediatypeheadervalue("application/json"); return resp; }
it needs respond richmessagetype in json format , received in xml format
am missing or have overlooked something?
can confirm have submitted url , token admin.wechat.com , url , token accepted?
also note xml , respond xml no json response.
have had at: http://youtu.be/kb20zf51qwu , http://youtu.be/_2fszd2b2f0
this documentation xml can found when google "wechat guide message api"
so if still not receiving success message when submitting app on admin.wechat.com can send me test url here. find url check access logs see url wechat calling. post here. please note when hit url wechat should see "echostr" printed on screen (when viewing source in browser). no xml no html echostr.
also make sure there no spaces or newlines after or before "echostr". when view source should 1 line echostr param's value.
the xml response comes in later when start responding messages users. wechat confirming if security setup correctly.
also note if server load balanced have skip signature validation , build own validation when echostr parameter gets passed through , echo "echostr" param screen.
Comments
Post a Comment