//************************SENDIBLUE ENVIAR CORREO TRANSACCIONAL********************************************************************************************************************************* public async Task <string> SendMailSendiBlue(string endPoint) { string respuesta = string.Empty; RespuestaMailChimp resultado = new RespuestaMailChimp(); string jsonData = CreateTransaccional(); using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Clear(); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("api-key", EngineData.ApiKeySendiBlue); HttpResponseMessage response = await client.PostAsync(endPoint, new StringContent(jsonData, Encoding.UTF8, "application/json")); if (response.IsSuccessStatusCode) { respuesta = await response.Content.ReadAsStringAsync(); //Retorna solo el ID del nuevo contacto } else { respuesta = response.IsSuccessStatusCode.ToString(); } } return(respuesta); }
//***********************************************************SENDIBLUEND********************************************************************************************** //******************************************************************************************************************************************************************** //******************************************************************************************************************************************************************** //************************MAILCHIMP ********************************************************************************************************************************** public async Task <string> LogMailChimp(string endPoint) { string respuesta = string.Empty; RespuestaMailChimp resultado = new RespuestaMailChimp(); using (HttpClient client = new HttpClient()) { client.DefaultRequestHeaders.Accept.Clear(); System.Net.CredentialCache credentialCache = new System.Net.CredentialCache(); String encoded = System.Convert.ToBase64String(System.Text.Encoding.GetEncoding("ISO-8859-1").GetBytes(EngineData.ClientIdMailChimp + ":" + EngineData.ApiKeyMailChimp)); client.DefaultRequestHeaders.Authorization = new System.Net.Http.Headers.AuthenticationHeaderValue("Basic", encoded); client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); client.DefaultRequestHeaders.Add("accept-language", "en_ES"); HttpResponseMessage response = await client.GetAsync(endPoint); if (response.IsSuccessStatusCode) { respuesta = await response.Content.ReadAsStringAsync(); resultado = JsonConvert.DeserializeObject <RespuestaMailChimp>(respuesta); } else { respuesta = response.IsSuccessStatusCode.ToString(); } } return(respuesta); }