Twilio正在向同一个号码发送多条消息

时间:2017-10-06 15:54:43

标签: c# twilio

我正在尝试学习如何使用Twilio发送短信,我正在使用教程中的示例代码。当我运行代码时,它会将消息发送到我的手机至少两次。我错过了什么吗?

这是C#代码:

using System;
using System.Collections.Generic;
using Twilio;
using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;

namespace Quickstart
{
class SmsSender
{
    static void Main(string[] args)
    {
        // Find your Account Sid and Auth Token at twilio.com/user/account
        const string accountSid = "xxxxxxxxxxxxxxxxxxxxxxx";
        const string authToken = "xxxxxxxxxxxxxxxxxxxxxx";

        // Initialize the Twilio client
        TwilioClient.Init(accountSid, authToken);


            // Send a new outgoing SMS by POSTing to the Messages resource
            MessageResource.Create(
                from: new PhoneNumber("XXXXXXXXX"), // From number, must be an SMS-enabled Twilio number
                to: new PhoneNumber("XXXXXXXXX"), // To number, if using Sandbox see note above
                                                 // Message content
                body: $"This is a test.");

            Console.WriteLine($"Sent message to Andrew");
    }
}

}

0 个答案:

没有答案