Sign Up and send free SMS messages.

C# - SMS API Code Resources

using System;
using System.Collections.Generic;
using System.Linq;
using System.Net.Http;
using System.Net.Http.Headers;
using System.Text;
using System.Threading.Tasks;

namespace CallAPI
{
    class Program
    {
        static void Main(string[] args)
        {
            var t = Task.Run(() => SendMessage(new Uri("https://smspoh.com/api/v2/send")));
            t.Wait();

            Console.WriteLine(t.Result);
            Console.ReadLine();
        }

        static async Task<string> SendMessage(Uri u)
        {
            string DATA = @"{""to"":""09XXXXXXX"",""message"":""Hello SMSPoh""}";
            var response = string.Empty;
            using (var client = new HttpClient())
            {
                client.DefaultRequestHeaders.Authorization = new AuthenticationHeaderValue("Bearer",  "API_KEY");
                HttpContent content = new StringContent(DATA);
                HttpResponseMessage result = await client.PostAsync(u, content);
                if (result.IsSuccessStatusCode)
                {
                    response = await result.Content.ReadAsStringAsync();
                }
            }
            return response;
        }
    }
}