Esempio n. 1
0
        public static async Task <WxOpenJsonResult> SendTemplateMessageAsync(string accessTokenOrAppId, string openId, string templateId, object data, string formId, string page = null, string emphasisKeyword = null, string color = null, int timeOut = WxConfig.TIME_OUT)
        {
            return(await WxOpenApiHandlerWapper.TryCommonApiAsync(async accessToken =>
            {
                string urlFormat = WxConfig.ApiMpHost + "/cgi-bin/message/wxopen/template/send?access_token={0}";
                var msgData = new TempleteModel()
                {
                    touser = openId,
                    template_id = templateId,
                    color = color,
                    page = page,
                    form_id = formId,
                    data = data,
                    emphasis_keyword = emphasisKeyword,
                };

                return await CommonJsonSend.SendAsync <WxOpenJsonResult>(accessToken, urlFormat, msgData, timeOut: timeOut);
            }, accessTokenOrAppId));
        }