using InABox.API; using InABox.Core; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Twilio; using Twilio.Rest.Api.V2010.Account; namespace InABox.Server { public class TwilioSMSProvider : ISMSProvider { public SMSProviderType ProviderType => SMSProviderType.Twilio; public TwoFactorAuthenticationType TwoFactorAuthenticationType => TwoFactorAuthenticationType.SMS; private string AccountSID { get; set; } private string AuthToken { get; set; } private string Number { get; set; } public TwilioSMSProvider(string accountSID, string authToken, string number) { AccountSID = accountSID; AuthToken = authToken; Number = number; TwilioClient.Init(accountSID, authToken); } public bool SendMessage(string recipient, string message) { var messageResource = MessageResource.Create( body: message, from: new Twilio.Types.PhoneNumber(Number), to: new Twilio.Types.PhoneNumber(recipient) ); return true; } } }