public static string  CreateMenu(string access_token, string postdata)
        {
            string url = string.Format("https://api.weixin.qq.com/cgi-bin/menu/create?access_token={0}", access_token);

            string result = HttpWebResponseUtility.PostJsonData(url, postdata);

            return(result);
        }
        public static string GetMaterialList(string access_token, string postdata)
        {
            string url = string.Format("https://api.weixin.qq.com/cgi-bin/material/batchget_material?access_token={0}", access_token);

            string result = HttpWebResponseUtility.PostJsonData(url, postdata);

            return(result);
        }
Example #3
0
        public static string SendTempletMessge(string access_token, string postdata)
        {
            string url = string.Format("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}", access_token);

            string result = HttpWebResponseUtility.PostJsonData(url, postdata);

            return(result);
        }
        public static string SendCustomerServiceImageMessge(string access_token, string media_id, string touser)
        {
            CustomerServiceImageMessage customerImageMsg = new CustomerServiceImageMessage();
            image imageid = new image();

            imageid.media_id = media_id;

            customerImageMsg.touser  = touser;
            customerImageMsg.msgtype = "image";
            customerImageMsg.image   = imageid;

            string customerImageMsgStr = JsonConvert.SerializeObject(customerImageMsg);



            string url = string.Format("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}", access_token);

            string result = HttpWebResponseUtility.PostJsonData(url, customerImageMsgStr);

            return(result);
        }
        public static string SendCustomerServiceTextMessge(string access_token, string content, string touser)
        {
            CustomerServiceTextMessage customerTextMsg = new CustomerServiceTextMessage();
            text textcontent = new text();

            textcontent.content = content;

            customerTextMsg.touser  = touser;
            customerTextMsg.msgtype = "text";
            customerTextMsg.text    = textcontent;

            string customerTextMsgStr = JsonConvert.SerializeObject(customerTextMsg);



            string url = string.Format("https://api.weixin.qq.com/cgi-bin/message/custom/send?access_token={0}", access_token);

            string result = HttpWebResponseUtility.PostJsonData(url, customerTextMsgStr);

            return(result);
        }
        public static string wechatApi(string operate, string access_token, string postdata)
        {
            string result = "";
            string url    = "";

            switch (operate)
            {
            case "SendTemplateMessage":
                url = string.Format("https://api.weixin.qq.com/cgi-bin/message/template/send?access_token={0}", access_token);
                break;

            case "GetUserListInfo":
                url = string.Format("https://api.weixin.qq.com/cgi-bin/user/info/batchget?access_token={0}", access_token);
                break;

            case "CreateMenu":
                url = string.Format("https://api.weixin.qq.com/cgi-bin/menu/create?access_token={0}", access_token);
                break;
            }
            result = HttpWebResponseUtility.PostJsonData(url, postdata);
            return(result);
        }