Twilio

Brief:

Twilio is a cloud communications (PaaS) company. Twilio allows software developers to programmatically make and receive phone calls and send and receive text messages using its web service APIs. Twilio's services are accessed over HTTP and are billed based on usage. It provides SDK for different programming languages like php, Ruby, Python, .Net, Java, Node.js & Sales Force Apex.

Need:

Two-Factor Authentication (2FA)
Generate a one-time code that meets your security requirements. Your app makes an HTTP request to Twilio.
Twilio receives the request and delivers a text message or phone call with the specified passcode.
User receives passcode through SMS or phone call.
User inputs passcode into the 2FA workflow. If there's been no authentication within the defined time period, your app can choose to expire the code and deliver a new security code via SMS or text-to-speech.

Appointment Reminders
Integrate with the appointment system to find upcoming appointments.
Send a reminder text or call 24-hours before an appointment.
Follow it up with an SMS link with directions, two hours before the appointment.
Let customers respond to the text or punch in options on the call to change the appointment.


How It works:


Appointment Reminders Server:

using System;
using System.Linq;
using System.Net;
using System.Web.Mvc;
using AppointmentReminders.Web.Models;
using AppointmentReminders.Web.Models.Repository;

namespace AppointmentReminders.Web.Controllers
{
    public class AppointmentsController : Controller
    {
        private readonly IAppointmentRepository _repository;

        public AppointmentsController() : this(new AppointmentRepository()) { }

        public AppointmentsController(IAppointmentRepository repository)
        {
            _repository = repository;
        }

        public SelectListItem[] Timezones
        {
            get
            {
                var systemTimeZones = TimeZoneInfo.GetSystemTimeZones();
                return systemTimeZones.Select(systemTimeZone => new SelectListItem
                {
                    Text = systemTimeZone.DisplayName,
                    Value = systemTimeZone.Id
                }).ToArray();
            }
        }
      
       // GET: Appointments
        public ActionResult Index()
        {
            var appointments = _repository.FindAll();
            return View(appointments);
        }

        // GET: Appointments/Details/5
        public ActionResult Details(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            var appointment = _repository.FindById(id.Value);
            if (appointment == null)
            {
                return HttpNotFound();
            }

            return View(appointment);
        }

        // GET: Appointments/Create
        public ActionResult Create()
        {
            ViewBag.Timezones = Timezones;
            // Use an empty appointment to setup the default
            // values.
            var appointment = new Appointment
            {
                Timezone = "Pacific Standard Time",
                Time = DateTime.Now
            };

            return View(appointment);
        }

        [HttpPost]
        public ActionResult Create([Bind(Include = "ID,Name,PhoneNumber,Time,Timezone")]Appointment appointment)
        {
            appointment.CreatedAt = DateTime.Now;

            if (ModelState.IsValid)
            {
                _repository.Create(appointment);

                return RedirectToAction("Details", new { id = appointment.Id });
            }

            return View("Create", appointment);
        }

        // GET: Appointments/Edit/5
        [HttpGet]
        public ActionResult Edit(int? id)
        {
            if (id == null)
            {
                return new HttpStatusCodeResult(HttpStatusCode.BadRequest);
            }

            var appointment = _repository.FindById(id.Value);
            if (appointment == null)
            {
                return HttpNotFound();
            }

            ViewBag.Timezones = Timezones;
            return View(appointment);
        }

        // POST: /Appointments/Edit/5
        [HttpPost]
        public ActionResult Edit([Bind(Include = "ID,Name,PhoneNumber,Time,Timezone")] Appointment appointment)
        {
            if (ModelState.IsValid)
            {
                _repository.Update(appointment);
                return RedirectToAction("Details", new { id = appointment.Id });
            }
            return View(appointment);
        }

        // GET: Appointments/Delete/5
        [HttpGet]
        public ActionResult Delete(int id)
        {
            _repository.Delete(id);
            return RedirectToAction("Index");
        }
    }
}

Appointment Reminders Client:

using System.Web.Configuration;
using Twilio;

namespace AppointmentReminders.Web.Domain.Twilio
{
    public class RestClient
    {
        private readonly TwilioRestClient _client;

        private readonly string _accountSid = WebConfigurationManager.AppSettings["AccountSid"];
        private readonly string _authToken = WebConfigurationManager.AppSettings["AuthToken"];
        private readonly string _twilioNumber = WebConfigurationManager.AppSettings["TwilioNumber"];

        public RestClient()
        {
            _client = new TwilioRestClient(_accountSid, _authToken);
        }

        public void SendSmsMessage(string phoneNumber, string message)
        {
            _client.SendSmsMessage(_twilioNumber, phoneNumber, message);
        }
    }
}

Boston Byte Grabs a Spot in Clutch’s List of Top Software Developers in Massachusetts

Boston Byte is a collective of highly-skilled and highly-professional developers dedicated to solving your technological ...