Question

What XML structure do I use to return a dynamic rich media card response using the WeChat API?

Was it helpful?

Solution

It is exactly the same as a text response. See below XML structure needed:

    <xml>
         <ToUserName><![CDATA[toUser]]></ToUserName>
         <FromUserName><![CDATA[fromUser]]></FromUserName>
         <CreateTime>12345678</CreateTime>
         <MsgType><![CDATA[news]]></MsgType>
         <ArticleCount>2</ArticleCount>
         <Articles>
         <item>
           <Title><![CDATA[title1]]></Title> 
           <Description><![CDATA[description1]]></Description>
           <PicUrl><![CDATA[picurl]]></PicUrl>
           <Url><![CDATA[url]]></Url>
         </item>
         <item>
           <Title><![CDATA[title]]></Title>
           <Description><![CDATA[description]]></Description>
           <PicUrl><![CDATA[picurl]]></PicUrl>
           <Url><![CDATA[url]]></Url>
         </item>
         </Articles>
     </xml> 
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top