public void call(String consumer, String ckey, String token, String secret) { string youPhoneNumber = null; string yourCorrelator = null; string yourEndpoint = null; string yourCriteria = null; //FIRST: creating the MMS MO client: BV_MOSMS client = 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. try { //SUBSCRIBING TO RECEIVE SMS string subscribe = client.StartNotification( phoneNumber: youPhoneNumber, //MANDATORY endpoint: yourEndpoint, //MANDATORY criteria: yourCriteria, //MANDATORY correlator: yourCorrelator //MANDATORY ); /*Showing Response*/ Console.WriteLine("\nThe response from Bluevia for the Example_SMS_Notifications when subscribing is:\n"); Console.WriteLine(subscribe); Console.WriteLine("Press any key to continue."); var enter = Console.ReadKey(); //UNSUBSCRIBING bool unsusbscribe = client.StopNotification( correlator: yourCorrelator //MANDATORY ); /*Showing Response*/ Console.WriteLine("\nThe response from Bluevia for the Example_SMS_Notifications when unsubscribing is:\n"); Console.WriteLine(unsusbscribe); } catch (BlueviaException e) { Console.WriteLine("\nExample_SMS_Notifications has failed:\n"); Console.WriteLine("The Exception is:" + e.Message); } catch (Exception e) { Console.WriteLine("\nExample_SMS_Notifications 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 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"); } }