public async Task Send(SmsResource model)
        {
            string url        = $"https://api.kavenegar.com/v1/{this.key}/sms/send.json";
            var    httpClient = new HttpClient();
            var    content    = new FormUrlEncodedContent(new [] {
                new KeyValuePair <string, string>("receptor", model.PhoneNumber),
                new KeyValuePair <string, string>("message", model.Context)
            });
            var resp = await httpClient.PostAsync(url, content);

            if (resp.StatusCode != HttpStatusCode.OK)
            {
                throw new System.Exception(await resp.Content.ReadAsStringAsync());
            }
        }
Example #2
0
 public async virtual Task Send(SmsResource model)
 {
     logger.LogInformation($"Sending '{model.Context}' to '{model.PhoneNumber}'");
     await Task.CompletedTask;
     //throw new System.NotImplementedException();
 }