SMS-utskick har lagts till
This commit is contained in:
29
TrackerLibrary/SMSLogic.cs
Normal file
29
TrackerLibrary/SMSLogic.cs
Normal file
@ -0,0 +1,29 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
using System.Threading.Tasks;
|
||||
using Twilio;
|
||||
using Twilio.Rest.Api.V2010.Account;
|
||||
using Twilio.Types;
|
||||
|
||||
namespace TrackerLibrary
|
||||
{
|
||||
public class SMSLogic
|
||||
{
|
||||
public static void SendSMSMessage(string to, string textMessage)
|
||||
{
|
||||
string accountSid = GlobalConfig.AppKeyLookup("smsAccountSid");
|
||||
string authToken = GlobalConfig.AppKeyLookup("smsAuthToken");
|
||||
string fromPhoneNumber = GlobalConfig.AppKeyLookup("smsFromPhoneNumber");
|
||||
|
||||
TwilioClient.Init(accountSid, authToken);
|
||||
|
||||
var message = MessageResource.Create(
|
||||
to: new PhoneNumber(to),
|
||||
from: new PhoneNumber(fromPhoneNumber),
|
||||
body: textMessage
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user