public string Message() { string phone = ""; MemoryStream stream = new MemoryStream(); Request.Body.CopyTo(stream); stream.Position = 0; using (StreamReader reader = new StreamReader(stream)) { string requestBody = reader.ReadToEnd(); if (requestBody.Length > 0) { var obj = JsonConvert.DeserializeObject <PostData>(requestBody); if (obj != null) { phone = obj.phone; } } } String code = getCode(); //Send message to [phone] with [code]. String result = SMSManager.send(phone, code); return(result); }