public static void Main(string[] args)
    {
        var client = new CallfireClient("api_login", "api_password");

        var request = new SendCallsRequest()
        {
            Recipients = new List <CallRecipient>
            {
                new CallRecipient
                {
                    PhoneNumber    = "12135551100",
                    LiveMessage    = "Hello, Alice, this is message for live answer",
                    MachineMessage = "Hello, Alice, this is message for answering machine"
                },
                new CallRecipient
                {
                    PhoneNumber    = "12135551101",
                    LiveMessage    = "Hello, Bob, this is message for live answer",
                    MachineMessage = "Hello, Bob, this is message for answering machine"
                }
            }
        };

        IList <Call> calls = client.CallsApi.Send(request);
    }
    public static void Main(string[] args)
    {
        var client = new CallfireClient("api_login", "api_password");

        var request = new FindCallsRequest
        {
            Id = new List <long> {
                11646003, 12646003, 13776003
            },
            CampaignId = 449060003,
            BatchId    = 447060003,
            FromNumber = "12135551126",
            ToNumber   = "12136666123",
            Label      = "my label",
            States     = new List <StateType> {
                StateType.FINISHED, StateType.READY, StateType.INVALID
            },
            Results = new List <Call.CallResult> {
                Call.CallResult.LA
            },
            Inbound       = true,
            IntervalBegin = new DateTime(2016, 9, 13, 15, 50, 17),
            IntervalEnd   = new DateTime(2016, 9, 13, 15, 50, 17),
            Offset        = 0,
            Limit         = 10,
            Fields        = "items(id,fromNumber,toNumber,modified,finalCallResult)"
        };
        Page <Call> calls = client.CallsApi.Find(request);
        // check Call.records.questionResponses for stored data
    }
    public static void Main(string[] args)
    {
        var client = new CallfireClient("api_login", "api_password");

        var        path   = "/contacts.csv";
        ResourceId listId = client.ContactListsApi.CreateFromCsv("My Contact List", Path.GetFullPath(path));
    }
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new FindTextsRequest
     {
         Id = new List <long> {
             11646003, 12646003, 13776003
         },
         CampaignId = 449060003,
         BatchId    = 447060003,
         ToNumber   = "12136666123",
         FromNumber = "12135551126",
         Label      = "my label",
         States     = new List <StateType> {
             StateType.FINISHED, StateType.READY, StateType.INVALID
         },
         Results = new List <TextRecord.TextResult> {
             TextRecord.TextResult.RECEIVED
         },
         Inbound       = true,
         IntervalBegin = new DateTime(2016, 9, 13, 15, 50, 17),
         IntervalEnd   = new DateTime(2016, 9, 13, 15, 50, 17),
         Offset        = 0,
         Limit         = 10,
         Fields        = "items(id,fromNumber,toNumber,modified,message)"
     };
     Page <Text> texts = client.TextsApi.Find(request);
 }
Exemple #5
0
 public static void Main(string[] args)
 {
     var client     = new CallfireClient("api_login", "api_password");
     var recipient1 = new TextRecipient
     {
         Message     = "Hello World!",
         PhoneNumber = "12135551122"
     };
     var recipient2 = new TextRecipient
     {
         ContactId = 122460000043
     };
     var recipient3 = new TextRecipient
     {
         PhoneNumber = "12135558090",
         Attributes  = new Dictionary <string, string>
         {
             { "custom_external_id", "30005044" },
             { "custom_name", "Alice" }
         },
         Message = "Hello, ${custom_name}!"
     };
     var recipients = new List <TextRecipient> {
         recipient1, recipient2, recipient3
     };
     var request = new SendTextsRequest
     {
         Recipients     = recipients,
         CampaignId     = 4050600003,
         DefaultMessage = "Hello!"
     };
     IList <Text> texts = client.TextsApi.Send(request);
 }
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new AddBatchRequest
     {
         CampaignId = 11646003,
         Name       = "contact batch for text",
         Recipients = new List <Recipient>
         {
             new TextRecipient {
                 PhoneNumber = "12135551122"
             },
             new TextRecipient {
                 PhoneNumber = "12135553434"
             },
             new TextRecipient
             {
                 PhoneNumber = "12135558090",
                 Attributes  = new Dictionary <string, string>
                 {
                     { "custom_external_id", "30005044" },
                     { "custom_property_1", "value1" }
                 }
             }
         },
         //or you can add contacts from particular contact list
         //ContactListId = 70055003
         ScrubDuplicates = true
     };
     var resourceId = client.TextBroadcastsApi.AddBatch(request);
 }
Exemple #7
0
    public static void Main(string[] args)
    {
        var          client      = new CallfireClient("api_login", "api_password");
        const string phoneNumber = "12132000384";

        client.MeApi.SendVerificationCode(phoneNumber);
    }
    public static void Main(string[] args)
    {
        var client = new CallfireClient("api_login", "api_password");

        var contact1 = new Contact
        {
            FirstName   = "Alice",
            LastName    = "Moore",
            HomePhone   = "12135551126",
            MobilePhone = "12136666123",
            WorkPhone   = "14553327789",
            Zipcode     = "40460",
            Properties  = new Dictionary <string, string>
            {
                { "custom_ext_system_id", "100200301" }
            }
        };

        var contact2 = new Contact
        {
            FirstName  = "Bob",
            LastName   = "Smith",
            HomePhone  = "12135551127",
            Properties = new Dictionary <string, string>
            {
                { "age", "30" },
                { "custom_position", "Manager" }
            }
        };

        IList <ResourceId> contacts = client.ContactsApi.Create(new List <Contact> {
            contact1, contact2
        });
    }
Exemple #9
0
        static void Main(string[] args)
        {
            // CallFire requires TLS 1.2
            ServicePointManager.SecurityProtocol = SecurityProtocolType.Tls12;

            var client  = new CallfireClient(ConfigurationManager.AppSettings["CallFireUser"], ConfigurationManager.AppSettings["CallFirePassword"]);
            var account = client.MeApi.GetBillingPlanUsage();
            int credits = (int)(account?.TotalRemainingCredits ?? 0);

            Console.WriteLine("# of credits remaining {0}", credits);

            if ((args.Length == 0) || (!IsPhoneNumber(args[0])))
            {
                Console.WriteLine("Usage: jyaas.console.exe [phonenumber:1234567890]");
                return;
            }


            var recipients = new List <CallRecipient>
            {
                new CallRecipient
                {
                    PhoneNumber           = args[0],
                    LiveMessageSoundId    = 12329299003,
                    MachineMessageSoundId = 12329299003
                }
            };
            IList <Call> calls = client.CallsApi.Send(recipients);
        }
Exemple #10
0
    public static void Main(string[] args)
    {
        var client = new CallfireClient("api_login", "api_password");

        var request = new SendCallsRequest()
        {
            DefaultVoice = Voice.MALE1,
            Fields       = "items(id,state,toNumber)",
            CampaignId   = 4050600003,
            Recipients   = new List <CallRecipient>
            {
                new CallRecipient
                {
                    PhoneNumber    = "12135551100",
                    LiveMessage    = "Hello, Alice, this is message for live answer",
                    MachineMessage = "Hello, Alice, this is message for answering machine"
                },
                new CallRecipient
                {
                    PhoneNumber    = "12135551101",
                    LiveMessage    = "Hello, Bob, this is message for live answer",
                    MachineMessage = "Hello, Bob, this is message for answering machine"
                }
            }
        };

        IList <Call> calls = client.CallsApi.Send(request);
    }
    public static void Main(string[] args)
    {
        var client    = new CallfireClient("api_login", "api_password");
        var broadcast = new CallBroadcast
        {
            Name = "Example API Call Broadcast",
            // set validated Caller ID number.
            FromNumber = "12135551189",
            // set answering machine detection
            AnsweringMachineConfig = AnsweringMachineConfig.AM_AND_LIVE,
            // set voice messages using TTS option for Live answers and when Answering Machine is detected.
            // you also can set a pre-defined TTS voice.
            Sounds = new CallBroadcastSounds
            {
                LiveSoundText    = "Hello! This is a live answer text to speech recording",
                MachineSoundText = "This is an answering machine text to speech recording"
            },
            // add new recipients
            Recipients = new List <Recipient>
            {
                new Recipient
                {
                    PhoneNumber = "2134441133"
                },
                new Recipient
                {
                    PhoneNumber = "2135551144"
                }
            },
            ResumeNextDay = true
        };

        // create broadcast with 'start' argument = true to start campaign immediately
        var id = client.CallBroadcastsApi.Create(broadcast);
    }
 public static void Main(string[] args)
 {
     var            client = new CallfireClient("api_login", "api_password");
     var            begin  = new DateTime(2016, 9, 13, 15, 50, 17);
     var            end    = new DateTime(2016, 9, 13, 15, 50, 17);
     BroadcastStats stats  = client.TextBroadcastsApi.GetStats(11646003, "totalOutboundCount,billedAmount,sentCount", begin, end);
 }
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("account_login", "account_password");
     var request = new CommonFindRequest {
         Fields = "name,enabled"
     };
     Page <ApiCredentials> apiCredentials = client.MeApi.FindApiCredentials(request);
 }
    public static void Main(string[] args)
    {
        var client = new CallfireClient("api_login", "api_password");
        var batch  = client.BatchesApi.Get(379506003);

        batch.Enabled = true;
        client.BatchesApi.Update(batch);
    }
Exemple #15
0
    public static void Main(string[] args)
    {
        var client = new CallfireClient("api_login", "api_password");

        client.ContactListsApi.RemoveListItems(11646003, new List <long> {
            22277003, 23377003
        });
    }
 public static void Main(string[] args)
 {
     var           client   = new CallfireClient("api_login", "api_password");
     List <string> keywords = new List <string> {
         "SUN", "MOON"
     };
     IList <Keyword> avaialbeKeywords = client.KeywordsApi.Find(keywords);
 }
 public void QueryCallfireThroughProxyWithBasicAuth()
 {
     RestApiClient.getClientConfig().Add(ClientConstants.PROXY_ADDRESS_PROPERTY, "localhost:3128");
     RestApiClient.getClientConfig().Add(ClientConstants.PROXY_CREDENTIALS_PROPERTY, "proxyuser:proxypass");
     CallfireClient Client = new CallfireClient("", "");
     var account = Client.MeApi.GetAccount();
     Console.WriteLine("account: " + account);
 }
    public static void Main(string[] args)
    {
        var client    = new CallfireClient("api_login", "api_password");
        var broadcast = new CallBroadcast
        {
            Id        = 11646003,
            Schedules = new List <Schedule>
            {
                // schedule a campaign to run on Saturday and Sunday between 2016-12-01 10:00:00
                //  and 2016-12-10 18:00:00
                new Schedule
                {
                    StartDate = new LocalDate {
                        Year = 2016, Month = 12, Day = 1
                    },
                    StartTimeOfDay = new LocalTime {
                        Hour = 10, Minute = 0, Second = 0
                    },
                    StopDate = new LocalDate {
                        Year = 2016, Month = 12, Day = 10
                    },
                    StopTimeOfDay = new LocalTime {
                        Hour = 18, Minute = 0, Second = 0
                    },
                    // set weekly schedule
                    DaysOfWeek = new HashSet <DayOfWeek> {
                        DayOfWeek.SATURDAY, DayOfWeek.SUNDAY
                    },
                    // set optional time zone, if leave empty account's timezone will be used
                    TimeZone = "America/New_York"
                },
                // add another schedule for campaign to start on Saturday and Sunday between 2016-12-20 10:00:00
                //  and 2016-12-30 18:00:00
                new Schedule
                {
                    StartDate = new LocalDate {
                        Year = 2016, Month = 12, Day = 20
                    },
                    StartTimeOfDay = new LocalTime {
                        Hour = 10, Minute = 0, Second = 0
                    },
                    StopDate = new LocalDate {
                        Year = 2016, Month = 12, Day = 30
                    },
                    StopTimeOfDay = new LocalTime {
                        Hour = 18, Minute = 0, Second = 0
                    },
                    // set weekly schedule
                    DaysOfWeek = new HashSet <DayOfWeek> {
                        DayOfWeek.SATURDAY, DayOfWeek.SUNDAY
                    }
                }
            }
        };

        // update broadcast with new schedules
        client.CallBroadcastsApi.Update(broadcast);
    }
    public static void Main(string[] args)
    {
        var            client      = new CallfireClient("account_login", "account_password");
        ApiCredentials credentials = new ApiCredentials {
            Name = "api-integration"
        };

        credentials = client.MeApi.CreateApiCredentials(credentials);
    }
        public void QueryCallfireThroughProxyWithBasicAuth()
        {
            RestApiClient.getClientConfig().Add(ClientConstants.PROXY_ADDRESS_PROPERTY, "localhost:3128");
            RestApiClient.getClientConfig().Add(ClientConstants.PROXY_CREDENTIALS_PROPERTY, "proxyuser:proxypass");
            CallfireClient Client  = new CallfireClient("", "");
            var            account = Client.MeApi.GetAccount();

            Console.WriteLine("account: " + account);
        }
 public static void Main(string[] args)
 {
     var client = new CallfireClient("api_login", "api_password");
     // limit returned fields if needed
     var fields = "totalOutboundCount,billedAmount,callsAttempted";
     var begin  = new DateTime(2016, 9, 13, 15, 50, 17);
     var end    = new DateTime(2016, 9, 13, 15, 50, 17);
     var stats  = client.CallBroadcastsApi.GetStats(11646003, fields, begin, end);
 }
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new KeywordPurchaseRequest
     {
         Keywords = { "SUN", "MOON" }
     };
     ResourceId resourceId = client.OrdersApi.OrderKeywords(request);
 }
Exemple #23
0
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new DateIntervalRequest
     {
         IntervalBegin = new DateTime(2037, 12, 31, 20, 53, 20),
         IntervalEnd   = new DateTime(2038, 1, 1, 8, 0, 0)
     };
     CreditsUsage creditsUsage = client.MeApi.GetCreditUsage(request);
 }
Exemple #24
0
 public static void Main(string[] args)
 {
     var client = new CallfireClient("api_login", "api_password");
     var tts    = new TextToSpeech
     {
         Message = "This is a TTS sound",
         Voice   = Voice.MALE1
     };
     ResourceId resourceId = client.CampaignSoundsApi.CreateFromTts(tts);
 }
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new CallerIdVerificationRequest
     {
         CallerId         = "12132000384",
         VerificationCode = "1234"
     };
     bool?verified = client.MeApi.VerifyCallerId(request);
 }
Exemple #26
0
    public static void Main(string[] args)
    {
        var client    = new CallfireClient("api_login", "api_password");
        var broadcast = client.TextBroadcastsApi.Get(11646003);

        broadcast.Name    = "Campaign name updated";
        broadcast.Message = "a new test message";
        // update campaign
        client.TextBroadcastsApi.Update(broadcast);
    }
Exemple #27
0
 public static void Main(string[] args)
 {
     var client          = new CallfireClient("api_login", "api_password");
     var callCreateSound = new CallCreateSound
     {
         Name     = "Sound 1",
         ToNumber = "12135551122"
     };
     ResourceId resourceId = client.CampaignSoundsApi.RecordViaPhone(callCreateSound);
 }
    public static void Main(string[] args)
    {
        var client    = new CallfireClient("api_login", "api_password");
        var broadcast = new TextBroadcast
        {
            Name = "Charity Campaign",
            // set validated Caller ID number.
            FromNumber = "19206596476",
            // attach custom labels if needed
            Labels = new List <string> {
                "charity", "id-10003"
            },
            // set message text
            Message = @"Hello {u_name} ...",
            // add new recipients
            Recipients = new List <TextRecipient>
            {
                new TextRecipient
                {
                    PhoneNumber = "13233834422",
                    // set custom recipient attributes, they are available only to a single Call/Text
                    //  action, do not confuse them with contact fields which are stored with contact
                    //  and are available to each Call/Text where contact is attached to
                    Attributes = new Dictionary <string, string>
                    {
                        { "u_name", "Alice" },
                        { "age", "30" }
                    }
                },
                new TextRecipient
                {
                    PhoneNumber = "13233834433",
                    Attributes  = new Dictionary <string, string>
                    {
                        { "u_name", "Mark" },
                        { "age", "45" }
                    }
                },
                new TextRecipient
                {
                    PhoneNumber = "13233834488",
                    // you can override a message set in broadcast for a particular recipient
                    Message    = "Hi ${u_name}, the megic number is ${magic_number}",
                    Attributes = new Dictionary <string, string>
                    {
                        { "u_name", "Jane" },
                        { "magic_number", "10" }
                    }
                }
            }
        };

        // create broadcast with 'start' argument = true to start campaign immediately
        var id = client.TextBroadcastsApi.Create(broadcast, true);
    }
 public static void Main(string[] args)
 {
     var client  = new CallfireClient("api_login", "api_password");
     var request = new CommonFindRequest
     {
         Offset = 0,
         Limit  = 10,
         Fields = "items(keyword,leaseBegin,leaseEnd)"
     };
     Page <KeywordLease> leases = client.KeywordLeasesApi.Find(request);
 }
Exemple #30
0
    public static void Main(string[] args)
    {
        var client  = new CallfireClient("api_login", "api_password");
        var request = new UpdateContactListRequest
        {
            Id   = 11646003,
            Name = "contact list updated"
        };

        client.ContactListsApi.Update(request);
    }
Exemple #31
0
    public static void Main(string[] args)
    {
        var client = new CallfireClient("api_login", "api_password");
        var lease  = new KeywordLease
        {
            KeywordName = "SUN",
            AutoRenew   = false
        };

        client.KeywordLeasesApi.Update(lease);
    }
 public AbstractIntegrationTest()
 {
     ReadAllSettings();
     Client = new CallfireClient(apiUserName, apiUserPassword);
 }
 public AbstractApiTest()
 {
     Client = new CallfireClient("username", "password");
     Serializer = new CallfireJsonConverter();
     Deserializer = Serializer as IDeserializer;
 }