aboutsummaryrefslogtreecommitdiffstats
path: root/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
diff options
context:
space:
mode:
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs')
-rw-r--r--Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs25
1 files changed, 25 insertions, 0 deletions
diff --git a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
index 06b2fd232..d8f514c42 100644
--- a/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
+++ b/Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs
@@ -25,6 +25,9 @@ using Tango.Core.Cryptography;
using Tango.MachineService.Filters;
using Tango.BL.DTO;
using Z.EntityFramework.Plus;
+using Twilio;
+using Twilio.Rest.Api.V2010.Account;
+using Twilio.Types;
namespace Tango.MachineService.Controllers
{
@@ -48,6 +51,7 @@ namespace Tango.MachineService.Controllers
{
_pendingUploads = new List<PPCPendingUpload>();
_pendingUpdates = new List<PPCPendingUpdate>();
+ TwilioClient.Init(MachineServiceConfig.TWILIO_ACCOUNT_SID, MachineServiceConfig.TWILIO_AUTH_TOKEN);
}
public PPCController()
@@ -830,6 +834,27 @@ namespace Tango.MachineService.Controllers
#endregion
+ #region SMS
+
+ [HttpPost]
+ [JwtTokenFilter]
+ public SendSMSResponse SendSMS(SendSMSRequest request)
+ {
+ var response = new SendSMSResponse();
+
+ if (MachineServiceConfig.TWILIO_ENABLE_SMS)
+ {
+ foreach (var phone in request.PhoneNumbers)
+ {
+ MessageResource.Create(from: MachineServiceConfig.TWILIO_FROM_NUMBER, to: new PhoneNumber(phone), body: request.Message);
+ }
+ }
+
+ return response;
+ }
+
+ #endregion
+
#region Version Upload
[HttpPost]