Пример #1
0
        /// <summary>
        /// To run this application, the following is required:
        ///
        /// - API token key/secret from Account -> Developer -> API Tokens
        /// - A verified Phone Number UUID from Account -> Telephony -> Phone Numbers -> Edit (in the URI)
        /// - Fill in variables to run example
        /// </summary>
        /// <param name="args"></param>
        async static Task Main(string[] args)
        {
            var tokenKey    = "";
            var tokenSecret = "";

            // Set the Phone Number ID (e.g., GncieHvbCKfMYXmeycoWZm)
            var phoneNumberId = "";

            // Sample contact information to call
            var to = ""; // In E.164 format (such as +1xxxxxxxxx)

            // Initialize SDK
            OmnigageClient.Init(tokenKey, tokenSecret);

            var message = new TextMessageResource
            {
                Body = "Sample body"
            };
            await message.Create();

            var text = new TextResource
            {
                To          = to,
                TextMessage = message,
                PhoneNumber = new PhoneNumberResource
                {
                    Id = phoneNumberId
                }
            };

            await text.Create();
        }
Пример #2
0
        async public Task TestTextMessage()
        {
            var scotchMode = ScotchMode.Replaying;
            var client     = HttpClients.NewHttpClient("IntegrationTests/Cassettes/TextMessage.json", scotchMode);

            string tokenKey    = "key";
            string tokenSecret = "secret";
            string host        = "https://dvfoa3pu2rxx6.cloudfront.net/api/v1/";

            OmnigageClient.Init(tokenKey, tokenSecret, host, client);

            TextMessageResource textMessage = new TextMessageResource();

            textMessage.Body = "Sample body";

            await textMessage.Create();

            TextResource text = new TextResource();

            text.To          = "+14076413749";
            text.TextMessage = textMessage;
            text.PhoneNumber = new PhoneNumberResource
            {
                Id = "GncieHvbCKfMYXmeycoWZm"
            };

            await text.Create();
        }