How to add a specific user to a segment in OneSignal
<p>I'm developing a C#.NET MVC Web Api for an Android application. At the moment I am using OneSignal to send push notifications to the users by calling the OneSignal Api and passing the notification content. I need to know how to add a user to a specific segment so that i can send notifications to individual users as well as users of that segment collectively. I have searched in on their documentation but I didn't understand how to do it using OneSignal.SendTag method. So basically how to do it in Visual Studio? So far i have done this:</p>

<pre><code>string api_key = "dsabjd";
        var request = WebRequest.Create("https://onesignal.com/api/v1/notifications") as HttpWebRequest;
        if (user != null)
        {
            string message = "This job is posted by: \n" + user.Name + "\n" + user.Contact + "\n" +user.City;
            if (request != null)
            {
                request.KeepAlive = true;
                request.Method = "POST";
                request.ContentType = "application/json";

                request.Headers.Add("authorization", "Basic "+api_key);


                var serializer = new JavaScriptSerializer();
                var obj = new
                {
                    app_id = "1651",
                    contents = new { en = message },
                    //data = new { image = "http://dsadasdasd.png" },
                    data = new { image = imageUrl },
                    included_segments = new string[] { "All" }
                };
                var param = serializer.Serialize(obj);
                byte[] byteArray = Encoding.UTF8.GetBytes(param);

                try
                {
                    using (var writer = request.GetRequestStream())
                    {
                        writer.Write(byteArray, 0, byteArray.Length);
                    }

                    string responseContent=null;
                    using (var response = request.GetResponse() as HttpWebResponse)
                    {
                        using (var reader = new StreamReader(response.GetResponseStream()))
                        {
                            responseContent = reader.ReadToEnd();
                        }
                    }
                    if (responseContent != null)
                    {
                        // parsing the json returned by OneSignal Push API 
                        dynamic json = JObject.Parse(responseContent);
                        int noOfRecipients = json.recipients;
                        if (noOfRecipients &gt; 0)
                        {
                            flag = true;
                        }
                    }

                }
                catch (WebException ex)
                {
                    flag = false;
                }


            }
        }
</code></pre>