public void call(String consumer, String ckey, String token, String secret) { //FIRST: creating the SMS clients: BV_MTSMS clientMT = new BV_MTSMS(BVMode.SANDBOX, consumer, ckey, token, secret); BV_MOSMS clientMO = new BV_MOSMS(BVMode.SANDBOX, consumer, ckey); //SECOND: Making the petitions: //Note that every possible parameter is here displayed in the service call, //but only the mandatory ones are necessary. SMSMessage[] inboxMessages = null; /////////////////////////////////////////////////////////////////////// try { //SENDING AN SMS clientMT.Send( destination: "546780", //MANDATORY text: "SANDBLUEDEMOS This is a Dummie SMS for SMS_MO", //MANDATORY endpoint: null, //Optional correlator: null //Optional ); //GETTING THE MESSAGES LIST inboxMessages = clientMO.GetAllMessages( registrationId: "546780" //MANDATORY ); try { Console.WriteLine("\nThe response from Bluevia for the Example_SMS_MO when retrieving the list is:\n"); Console.WriteLine("There are: " + inboxMessages.Length + " messages"); Console.WriteLine("The message 0: " + inboxMessages[0].message); } catch (Exception em) { Console.WriteLine("\n No messages where found.\n"); Console.WriteLine(em.Message); return; } } catch (BlueviaException e) { Console.WriteLine("\nExample_SMS_MO has failed:\n"); Console.WriteLine("The Exception is:" + e.Message); } catch (Exception e) { Console.WriteLine("\nExample_SMS_MO has failed:\n"); while (e.InnerException != null) { e = e.InnerException; } Console.WriteLine(e.Message + "\n"); } }
public void call(String consumer, String ckey, String token, String secret) { //FIRST: creating the SMS MT client: BV_MTSMS client = new BV_MTSMS(BVMode.SANDBOX, consumer, ckey, token, secret); //SECOND: Making the petitions: //Note that every possible parameter is here displayed in the service call, //but only the mandatory ones are necessary. DeliveryInfo[] deliveryInfos = null; /////////////////////////////////////////////////////////////////////// try { //SENDING AN SMS string statusId = client.Send( destination: "54666112233", //MANDATORY text: "SANDBLUEDEMOS This is a Dummie SMS for SMS_MT", //MANDATORY endpoint: null, //Optional correlator: null //Optional ); /*Showing Response*/ Console.WriteLine("\nThe response from Bluevia for the Example_SMS_MT when sending an SMS is:\n"); Console.WriteLine(statusId + "\n"); Console.WriteLine("\nPress any key to continue."); var enter = Console.ReadKey(); //RETRIEVING THE SMS STATUS deliveryInfos = client.GetDeliveryStatus( messageId: statusId //MANDATORY ); /*Showing Response*/ Console.WriteLine("\nThe response from Bluevia for the Example_SMS_MT when retrieving the status is:\n"); Console.WriteLine(deliveryInfos[0].statusDescription + "\n"); } catch (BlueviaException e) { Console.WriteLine("\nExample_SMS_MT has failed:\n"); Console.WriteLine("The Exception is:" + e.Message); } catch (Exception e) { Console.WriteLine("\nExample_SMS_MT has failed:\n"); while (e.InnerException != null) { e = e.InnerException; } Console.WriteLine(e.Message + "\n"); } }