Just create the following class and install Newtonsoft.Json NuGet package. You can download the sample project using this link.
using System;
using System.Collections.Generic;
using System.IO;
using System.Net;
using System.Text;
using System.Web;
using Newtonsoft.Json;
using Newtonsoft.Json.Linq;
namespace Gateway_Sample_Application
{
    static class Gateway
    {
        private static String Server = “Your Server URL”;
        private static String Email = “Your Login Email”;
        private static String Password = “Your Login Password”;
        /// <summary>
        /// Send single message to specific mobile number.
        /// </summary>
        /// <param name=”number“>Mobile Number where you want to send message.</param>
        /// <param name=”message“>Message you want to send.</param>
        /// <param name=”device“>ID of the device you want to use to send this message.</param>
        /// <returns>Error message if there is an error otherwise false</returns>
        public static string SendSingleMessage(string number, string message, int device = 0)
        {
            List<Dictionary<stringstring>> messages = new List<Dictionary<stringstring>> { new Dictionary<stringstring> { { “number”, number }, { “message”, message } } };
            var values = new Dictionary<stringobject>
            {
           
                { “messages”, JsonConvert.SerializeObject(messages)},
                { “email”, Email },
                { “password”, Password },
                { “devices”, device }
            };
            return GetResponse($”{Server}/services/send.php”, values);
        }
        /// <summary>
        /// Send multiple messages to different mobile numbers.
        /// </summary>
        /// <param name=”messages“>Array containing numbers and messages.</param>
        /// <param name=”useAvailable“>Set it true if you want to use all available devices to send these messages.</param>
        /// <param name=”devices“>Array of ID of devices you want to use to send these messages.</param>
        /// <returns>Error message if there is an error otherwise false</returns>
        public static string SendMessages(List<Dictionary<stringstring>> messages, bool useAvailable = trueint[] devices = null)
        {
            var values = new Dictionary<stringobject>
            {
                { “messages”, JsonConvert.SerializeObject(messages)},
                { “email”, Email },
                { “password”, Password },
                { “useAvailable”, useAvailable },
                { “devices”, devices }
            };
            return GetResponse($”{Server}/services/send.php”, values);
        }
        private static string GetResponse(string url, Dictionary<stringobject> postData)
        {
            try
            {
                var request = (HttpWebRequest)WebRequest.Create(url);
                var dataString = CreateDataString(postData);
                var data = Encoding.UTF8.GetBytes(dataString);
                request.Method = “POST”;
                request.ContentType = “application/x-www-form-urlencoded”;
                request.ContentLength = data.Length;
                ServicePointManager.Expect100Continue = true;
                ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;
                using (var stream = request.GetRequestStream())
                {
                    stream.Write(data, 0, data.Length);
                }
                var response = (HttpWebResponse)request.GetResponse();
                if (response.StatusCode == HttpStatusCode.OK)
                {
                    var jsonResponse = new StreamReader(response.GetResponseStream()).ReadToEnd();
                    try
                    {
                        JObject jObject = JObject.Parse(jsonResponse);
                        if (!(bool)jObject[“success”])
                        {
                            return jObject[“error”][“message”].ToString();
                        }
                    }
                    catch (JsonReaderException)
                    {
                        if (string.IsNullOrEmpty(jsonResponse))
                        {
                            return “Missing data in request. Please provide all the required information to send messages.”;
                        }
                        return jsonResponse;
                    }
                }
                else
                {
                    return $”HTTP Error : {(int)response.StatusCode} {response.StatusCode};
                }
            }
            catch (Exception e)
            {
                return e.Message;
            }
            return String.Empty;
        }
        private static string CreateDataString(Dictionary<stringobject> data)
        {
            StringBuilder dataString = new StringBuilder();
            bool first = true;
            foreach (var obj in data)
            {
                if (obj.Value != null)
                {
                    if (first)
                    {
                        first = false;
                    }
                    else
                    {
                        dataString.Append(“&”);
                    }
                    dataString.Append(HttpUtility.UrlEncode(obj.Key));
                    dataString.Append(“=”);
                    dataString.Append(obj.Value is string[]
                        ? HttpUtility.UrlEncode(JsonConvert.SerializeObject(obj.Value))
                        : HttpUtility.UrlEncode(obj.Value.ToString()));
                }
            }
            return dataString.ToString();
        }
    }
}
You can use these methods to send single or multiple messages as shown below.
If you want to send only one message to single mobile number then you should use this code. Do not use this function if you want to send multiple messages, You should use SendMessages function in such a case.
var error = Gateway.SendSingleMessage(TextBoxNumber.Text, TextBoxMessage.Text);
if (string.IsNullOrEmpty(error))
{
    MessageBox.Show(“Success”);
}
else
{
    MessageBox.Show(error, “!Error”, MessageBoxButton.OK, MessageBoxImage.Error);
}
If you want to send multiple messages to different mobile numbers then you should use this code.
List<Dictionary<stringstring>> messages = new List<Dictionary<stringstring>>();
for (int i = 0; i < 5; i++)
{
    var message = new Dictionary<stringstring>
    {
        {“number”“Mobile Number where you want to send message”},
        {“message”“Message text”}
    };
    messages.Add(message);     
}
var error = Gateway.SendMessages(messages);
if (string.IsNullOrEmpty(error))
{
    MessageBox.Show(“Success”);
}
else
{
    MessageBox.Show(result, “!Error”, MessageBoxButton.OK, MessageBoxImage.Error);
}

error: Content is protected !!