diff options
| author | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-11-14 14:30:42 +0200 |
|---|---|---|
| committer | Roy Ben Shabat <Roy.mail.net@gmail.com> | 2024-11-14 14:30:42 +0200 |
| commit | 7d9ab3b87aed944167d77244b00fbdd4224725e2 (patch) | |
| tree | 9a2a56059a0332182a7ecf4aa4237eae132f97f7 /Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs | |
| parent | c19568d8dc2677fe8dd57d55a737535c718f52f5 (diff) | |
| download | Tango-7d9ab3b87aed944167d77244b00fbdd4224725e2.tar.gz Tango-7d9ab3b87aed944167d77244b00fbdd4224725e2.zip | |
Added support for SMS notifications on TS & X4.
Diffstat (limited to 'Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs')
| -rw-r--r-- | Software/Visual_Studio/Web/Tango.MachineService/Controllers/PPCController.cs | 25 |
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] |
