using RestSharp; namespace n4_whatsapi { class Program { static void Main(string[] args) { Program.SendMessage().Wait(); Program.SendMessageWithImage().Wait(); Program.SendMessageWithVideo().Wait(); Program.SendMessageWithFile().Wait(); } private static async Task SendMessage() { var whatsapiURL = "https://whatsapi.nube4.cloud/whatsapi/msg"; var client = new RestClient(whatsapiURL); var request = new RestRequest(whatsapiURL, Method.Post); request.AddBody("{\"instanceid\":\"instance14116\", \"token\":\"r3gkujuqh8erl340\", \"to\":\"+50258797957\", \"msg\":\"este es un mensaje de prueba c#\"}"); RestResponse reponse = await client.ExecuteAsync(request); var output = reponse.Content; Console.WriteLine(output); } private static async Task SendMessageWithImage() { var whatsapiURL = "https://whatsapi.nube4.cloud/whatsapi/img"; var client = new RestClient(whatsapiURL); var request = new RestRequest(whatsapiURL, Method.Post); request.AddBody("{\"instanceid\":\"instance14116\", \"token\":\"r3gkujuqh8erl340\", \"to\":\"+50258797957\", \"imageurl\":\"https://resources.nube4.cloud/wifi.jpg\", \"caption\":\"Imagen de prueba\" }"); RestResponse reponse = await client.ExecuteAsync(request); var output = reponse.Content; Console.WriteLine(output); } private static async Task SendMessageWithVideo() { var whatsapiURL = "https://whatsapi.nube4.cloud/whatsapi/video"; var client = new RestClient(whatsapiURL); var request = new RestRequest(whatsapiURL, Method.Post); request.AddBody("{\"instanceid\":\"instance14116\", \"token\":\"r3gkujuqh8erl340\", \"to\":\"+50258797957\", \"videourl\":\"https://resources.nube4.cloud/test.mov\", \"caption\":\"Video de prueba\" }"); RestResponse reponse = await client.ExecuteAsync(request); var output = reponse.Content; Console.WriteLine(output); } private static async Task SendMessageWithFile() { var whatsapiURL = "https://whatsapi.nube4.cloud/whatsapi/doc"; var client = new RestClient(whatsapiURL); var request = new RestRequest(whatsapiURL, Method.Post); request.AddBody("{\"instanceid\":\"instance14116\", \"token\":\"r3gkujuqh8erl340\", \"to\":\"+50258797957\", \"filename\":\"Prueba.pdf\",\"documenturl\":\"https://resources.nube4.cloud/test.pdf\", \"caption\":\"Documento adjunto\" }"); RestResponse reponse = await client.ExecuteAsync(request); var output = reponse.Content; Console.WriteLine(output); } } }