How can an organization’s security team defend its customers against threats at scale?
When the Twilio Security Operations team (SecOps) was founded, this challenge weighed heavily on our minds. We knew that automating all our threat investigation and response procedures would be key to safeguarding our customers, but we had no clue where to begin. We also knew that many of our peers were in the same boat.
That’s why today, we’re proud to open-source SOCless: a serverless framework to help organizations easily automate their security workflows and respond to threats quickly and at scale.
To get started with SOCless, visit the documentation at https://twilio-labs.github.io/socless/
Building automated security runbooks
When performing investigations and responding to threats, security professionals follow well-documented, pre-planned, step by step procedures. We call these procedures runbooks.
A typical runbook may require a security professional to use multiple security products, custom scripts, and decision trees to …
Artificial creativity is amazing, and I am always blown away by what people accomplish with neural networks. Lots of developers have used Python libraries like Magenta to create awesome music.
I used Magenta to train a neural network on a bunch of classic Nintendo music, and I thought it would be fun to hack around with that and make a Twilio phone number you can call to hear computer-generated NES music. If you're in the US, try calling (424) 398-8637 (424-39-TUNES) to hear!
Let's walk through how to build a phone number that plays computer generated music using Magenta.
First we need to install Magenta, which can be done using pip. Make sure you create a virtual environment before moving forward. I am using Python 3.6.5, but Magenta is compatible with both Python 2 and 3.
Run the following command to install Magenta in your …
Since I started learning how to code, one thing that has always fascinated me was the concept of computers creating music. With Magenta, a Python library built that makes it easier to process music and image data, this can be done more easily than before. Magenta has pre-trained example models you can use to generate music, as seen in a previous blog post, but it's a lot more fun to create your own.
Let's walk through how to use Magenta to train a neural network on a set of music data from classic Nintendo games to generate new Nintendo-sounding tunes.
First we need to install Magenta, which can be done using pip. Make sure you create a virtual environment before installing. I am using Python 3.6.5, but Magenta is compatible with both Python 2 and 3.
Run the following command to install Magenta in your …
If you’re reading this, you’ve probably grappled with impostor syndrome at one time or another.
Experience doesn’t always help, either. As our skills grow, we tackle harder problems. Technologists are always working at the edge of our knowledge.
What can we do to fight impostor syndrome? Studies have shown that self-affirmation can counteract negative ruminations and increase achievement. So I decided to build an Internet of Things button that delivers an SMS affirmation when pressed.
Physical responses to negative thoughts
Why use hardware to fight imposter syndrome?
This project could totally be a web application. But – taking a physical action in response to negative thoughts helps ground me emotionally.
Using SMS lets me receive the affirmation without the cognitive load of opening another browser tab. Twilio’s IoT capabilities let me take the button anywhere with cell service. No WiFi configuration required!
The imposter syndrome button was my first hardware …
MIDI is an extremely popular and versatile format for music data, whether you're using it as a digital musical instrument interface or just transcribing music in it to show your bandmates new songs. Mido is a Python library you can use to interact with MIDI in your code.
Let's walk through the basics of working with MIDI data using the Mido Python library.
Run the following command to install Mido in your virtual environment:
pip install mido==1.2.9
In the rest of this post, we will be working with these two MIDI files as examples. Download them and save them to the directory where you want your code to run.
Have you ever wanted a smart monitor that not only lets you see your kids, but also texts you the temperature in their crib, so you can be certain they are comfortable? I certainly have!
That’s why I made the Raspberry Pi (RPi) Smart Baby Monitor, and I want to show you how easy it is to build yourself using Twilio, a Raspberry Pi, and a little bit of code.
Here's my son at 4 months old along with the smart baby monitor I created for him:
The Tech Stack
The IoT app we are going to create will use the Python programming language, a Raspberry Pi, a Raspberry Pi camera, a DS18B20 temperature sensor, and the Twilio SMS API:
- Python version 3.5: The language we will write our code in
- Raspberry Pi: Environment that will hold our software (code) and our hardware (peripherals)
- RPi …
Python programmers love to help – the community publishes detailed tutorials for their fellow developers every day. Over the last month, we’ve been collecting some of those posts we found most helpful.
Each tutorial is easy enough for beginner-level programmers to follow. More experienced developers should be able to breeze through the code while building a useful project, or use them as convenient refreshers.
Whichever bucket you belong to, enjoy the posts!
Exercising, or Slacking? Build a Python Bot for Either
The term "bot" feels so 2017 in this community. However, they are still a great way to learn how to build Python applications.
- Create Your Own Personal Training Exercise Bot with Python, Zappa, AWS and Twilio SMS by Matthew Vielkind via Twilio
- Build a Slack Bot that Mimics Your Colleagues by Casey Kinsey via Lofty Labs
Use Bokeh to Visualize All the Data!
Bokeh, the wonderful Python visualization library …
So you're building a Django or Flask app and you need to programmatically send some emails. The Twilio SendGrid API for sending email is a great solution to this problem. If you have a SendGrid account and an API key set as an environment variable, here is all the code you need to send an email in Python:
import os from sendgrid import SendGridAPIClient from sendgrid.helpers.mail import Mail message = Mail( firstname.lastname@example.org', email@example.com', subject='Sending with Twilio SendGrid is Fun', html_content='<strong>and easy to do anywhere, even with Python</strong>') sg = SendGridAPIClient(os.environ.get('SENDGRID_API_KEY')) response = sg.send(message) print(response.status_code, response.body, response.headers)
Let's walk through how to get this running step by step.
Development Environment Setup
Heading into the new year I wanted to set myself up to be successful living a healthier life. Saying you’re going to do something is easy, following through with action is the hard part. To ensure success being more physically active I needed help with a seemingly simple question, what should I do for a workout? With so many options available I wanted to spend less time thinking about what I’m going to do and more time doing the actual workout.
I needed a prescriptive solution to dictate a workout each day that would be balanced with enough daily variation to avoid becoming redundant. Most of the fitness apps available allow tracking of workouts, but lack the prescriptive component I was looking for.
Unsatisfied, I decided to roll-up my sleeves and build my own SMS-enabled personal trainer bot I call twilio-fit. Twilio-fit designs a workout on-demand that incorporates my personal …
WhatsApp is a messaging service used by people all over the world. With Twilio's Messaging API you can programmatically send WhatsApp messages. Let's walk through how to use Python to send a media message over WhatsApp.
Development Environment Setup
Make sure we have the right software installed and set up that we'll need to use for the rest of this post. Throughout this post, you will need:
- Python 2 or 3 installed (do this first if you haven't already)
- A free Twilio account with an activated WhatsApp Sandbox
- The Twilio Python library
Here is a good guide to follow in general if you are going to be doing more with Twilio and Python.