Exemplo n.º 1
0
        static void Main(string[] args)
        {
            // API Key
            string key = "";

            // API Secret
            string secret = "";

            // API Url
            string url = ""; /* ej: http://<url>/api/ */


            sdk = new SmsApi(key, secret, url);

            string groupName = "";
            string msisdn    = "";
            string firstname = "";
            String lastname  = "";


            /****** Test for messages ******/
            SendMessageToContact(msisdn);
            //SendMessageToGroup(groupName);

            //GetMessageLog();


            /***** Test procedures for contacts ******/
            //CreateNewContact(msisdn, firstname, lastname);
            //GetContactByMsisdn(msisdn);

            /****** Test procedures for groups *******/
            //AddGroup(groupName);
            //GetGroupList();
            //GetGroup(groupName);
            //AddContactToGroup(groupName, msisdn);
            //GetContactListbyGroup(groupName);
            //RemoveContactFromGroup(groupName, msisdn);
            //GetContactListbyGroup(groupName);
            //UpdateGroup(groupName);
            //GetGroup(groupName);
            //DeleteGroup(groupName);



            Console.Read();
        }
Exemplo n.º 2
0
        static void Main(string[] args)
        {
            // API Key
            string key = "";

            // API Secret
            string secret = "";

            // API Url
            string url = "";

            sdk = new SmsApi(key, secret, url);

            AccountStatus();
            SendSingleContactoMessage();

            Console.Read();
        }
Exemplo n.º 3
0
        public bool SendSMS(string pBody, string pTargetPhone)
        {
            bool result = false;

            try
            {
                // API Key
                string key = ConfigurationManager.AppSettings["keynotificame"].ToString();

                // API Secret
                string secret = ConfigurationManager.AppSettings["secretnotificame"].ToString();

                // API Url
                string url = "https://notificame.claro.com.sv/api/rest/"; /* ej: http://<url>/api/ */

                sdk = new SmsApi(key, secret, url);

                Random id = new Random();

                var smsResult = sdk.Messages.SendToContact(pTargetPhone, pBody, id.Next().ToString());

                if (smsResult.ErrorCode == 200 || smsResult.ErrorCode == 50000 || smsResult.ErrorCode == 50001 || smsResult.ErrorCode == 503)
                {
                    result = true;
                }
                else
                {
                    result = false;
                }



                result = (!String.IsNullOrEmpty(smsResult.ToString())) ? true : false;
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.InnerException);
                EventViewerLoggerSVC.LogError("SendSMS: " + ex.Message);
            }

            return(result);
        }
        static void Main(string[] args)
        {
            // API Key
            string key = "";

            // API Secret
            string secret = "";

            // API Url
            string url = ""; /* ej: http://<url>/api/ */

            sdk = new SmsApi(key, secret, url);

            string groupName = "";
            string msisdn = "";
            string firstname = "";
            String lastname = "";

            /****** Test for messages ******/
            SendMessageToContact(msisdn);
            //SendMessageToGroup(groupName);

            //GetMessageLog();

            /***** Test procedures for contacts ******/
            //CreateNewContact(msisdn, firstname, lastname);
            //GetContactByMsisdn(msisdn);

            /****** Test procedures for groups *******/
            //AddGroup(groupName);
            //GetGroupList();
            //GetGroup(groupName);
            //AddContactToGroup(groupName, msisdn);
            //GetContactListbyGroup(groupName);
            //RemoveContactFromGroup(groupName, msisdn);
            //GetContactListbyGroup(groupName);
            //UpdateGroup(groupName);
            //GetGroup(groupName);
            //DeleteGroup(groupName);

            Console.Read();
        }