An Ambivert’s Guide to Azure Functions

Chloe Condon
Mar 29 · 12 min read

The following blog post will walk you through how to use , , and a to create an app to trigger calls/texts to your phone. If you’re looking for a quick summary and overview on Azure Functions, I recommend , or taking 4 minutes to read in more detail , so you have some context on how to use functions within Azure.

If you’d like to skip straight to the code, scroll down to the Let’s get to the code!​ section below.

Happy learning!

-Chloe

Hello everyone, my name is Chloe, and I’m an ambivert 👋

[insert collective support group “Hi Chloe” here]

As a former actress (and current developer advocate), people often assume I’m an extrovert. The big secret is… I’m not! I’m actually an introverted extrovert (also known as an ). Day-to-day, that means I have no problem being on stage and giving a talk at a conference, socializing with attendees, doing a couple on-camera interviews, and sticking around for the schmoozing at a happy hour… in fact, I love it! But afterwards I will escape to my hotel room and watch TV under a blanket for the proceeding 3 hours because I have to “recharge.”​

I think this visual says it all.

So, here’s the definition of ambivert:​

​A person whose personality has a balance of extrovert and introvert features.​​

The best way (not so eloquent way) to describe my ambivert features would be that I equally love and hate being around other humans (only half kidding!).​ I love to socialize- conferences, meet-ups, and coffee chats are right up my alley (in fact, it’s a big part of my job!)…. but only half of the time. I have to recharge afterwards, or even schedule a couple nights at home to counter my social interaction. I’m likely very chatty at a dinner, but opt out of the evening karaoke (and trust me- ya girl LOVES karaoke).​​

So, what I’m trying to say is, if you ever see me sticking around at a conference happy hour, I’ve either had espresso later in the afternoon, I’m jetlagged, or I’m secretly dying on the inside.​

What I’m feeling internally vs. showing externally

Remember… . I’m very good at convincing people I’m not internally screaming inside 😐. I see my extroverted-ness almost like a button I can turn on and off depending on the situation… which is a great segue into the device I’ll be using to showcase how I built this.

Learning and creating ways to navigate my ambivert-ness “in the wild” at conferences, meet-ups, and meetings has been an interesting process!​​ Today, in this post, I’d like to show you one of those hacks I’ve created for myself… and hopefully, if you’re an introvert (or ambivert, or a human/robot looking to build cool things) you can try this demo yourself and code your way out of awkward or undesirable social situations!​

When deciding to take on this project, I considered several different devices to build my project with.​​ At first, I pictured it as a wearable.​ I reached out to Sara Chipps and Jennifer Wadella to see if Jewelbots’ capabilities would work for my use case. Unfortunately, while very fashionable and fun, the range of the devices is limited (but if you have a young girl in your life- . Very cool, fun way to learn programming!). I also considered FitBit as an option, but had concerns over folks thinking I was triggering my functions through it right in front of them. I needed something that was small, subtle and able to fit in my pocket.

Flic Button

So, the winner is… ! What’s a ? Great question! It’s a small button (about the size of a quarter) that acts as a Bluetooth Remote for iOS and Android. You can program these buttons to do anything from turning on Smart lights in your home, controlling music, taking photos, sending texts, making calls, posting tweets, calling Ubers, etc.

has many pre-built integrations and apps you can use within their app, ranging from sending a tweet to triggering a MP3 to play a laugh track (I may or may not have set up this specific example to bug my boyfriend in our apartment for when I tell bad jokes). Suz Hinton sent me for our mentorship sessions a few months back for an Azure exercise, and once I learned how to connect it to an Azure Function, I knew I had to build something fun with it.​ While does include a pre-built “fake call” feature in it’s app, it doesn’t actually create a call (you use a screenshot of a call, and it plays a ringtone sound). This is why using the Twilio API was necessary for this project, and how this blog post was born.

Azure Functions

If you’re unfamiliar, is a compute service that enables you to run code on-demand without having to explicitly provision or manage infrastructure. Not only can you can use Azure Functions to run a script or piece of code in response to a variety of events, but it also lets you execute your code in a environment without having to first create a VM or publish a web application.​

You can trigger the execution of Azure Functions in a variety of ways. Here are 5 common ones​:

☝🏻 (which is what I’ll be talking about today)​

✌🏻 (example: every day at 11am, execute this function, that starts + checks the temperature of my sous vide)​

👌🏻 You can

🖖🏻 You can

🖐🏻 You can

And many more! For a complete list, tutorials, documentation, and additional details of the capabilities of Azure Functions, start with the .

Twilio + Microsoft Docs= ❤️

If you haven’t played much with serverless/Azure Functions, I recommend starting with reading this and completing this module to get a better idea of how all of these pieces fit together before diving into programming your . The Microsoft docs are a great place to get free resources and lessons on how to get started!

Speaking of great documentation/getting started, I also used to create this. Twilio allows software developers to programmatically make and receive phone calls, send and receive text messages, and perform other communication functions using its web service APIs.​ Their walk-through/demo code has a special that I will show you in a bit since I kept it in my demo 🙃

Alright- let’s review our goals!

Seriously, he’s real. I promise.

Goal:

Use Azure Functions to create a button that will save me from awkward social interactions by…​

-Texting my friends an SOS message to save me​

-Triggering a call from my “boyfriend”*

  • I’ll get into those quotes in a second. I promise my boyfriend is real.​
A diagram of what we will be setting up

Let’s get to the code!​

Create Resource

​For the sake of easy to understand visuals/screenshots I used the Azure portal to create this. You can also use , the , etc.​ With Azure Functions you are given the the ability to code and test Functions locally on your machine without having to deploy to the cloud every single time you want to test (a huge time saver!).

To create an Azure function, you can just start from the Get Started menu and select (surprise!) Function App.

Then you’ll need to fill in some basic info about your function here. Including the app name, the Azure subscription you’d like to use, (I’m creating a new one in this case), the Operating System you’d like to use, the (I’m using consumption), the location I’d like to use (I’m in California, so West US 2 is usually my default), the runtime stack I’d like to use (I’m using JavaScript in this case), and I have the option to create new or use existing. I created a new one in this case.​​

Once I have all these filled out, I can go ahead and deploy! Wait about a minute or two, then watch for the Deployment succeeded message.​

Woo! If you followed those steps, we have our resource! We’ll just select “Go to resource” to view your new Function App.​ Now we’ll add a new function

For this example, I’m selecting In-portal.
And I have selected Webhook + API

It typically takes about a minute to deploy and then we’ll have a fresh new Azure Function waiting to be called. The default code is a simple hello world app, where if you paste the function URL into your browser’s address bar. Add the query string value &name=<yourname> to the end of this URL and press the Enter key on your keyboard to execute the request. You should see the response returned by the function displayed in the browser.​

Cool! So, we see this works now. Let’s get to the fun part…

Let’s Create a Fake Boyfriend

My boyfriend Ty Smith works full-time as an Android Developer at Uber, and is an Android GDG and GDE, and also travels for conferences as well. Needless to say, he’s a busy guy and I didn’t want my app to call him, because maybe he’d be in a meeting/at dinner/playing the new Resident Evil game, and I wouldn’t want to disturb him (also, testing this would have been a bit of a nightmare- example can be seen in ).

Frog puppet reenactment of me trying to test this with Ty.

​So, everyone, please meet my new fake boyfriend Twilio Smith- he’s a Twilio # that I purchased (with a Texas area code 🌵🤠).​

He’s really handsome, right? We met online.

After reviewing the Twilio API docs, I was able to get up and running pretty quickly with some sample code (shout-out to Twilio for the excellent documentation!).​

I have 2 Azure functions I needed to create and call. One for the call, and one for the texts. Please note: it’s okay to hardcode your Twilio credentials when getting started, but you should use environment variables to keep them secret before deploying to production. Check out Frank Boucher’s video on for a great 5 minute tutorial!

Sample message trigger index.js

You’ll probably notice that this function sends a text to me vs to friends/coworkers at a conference. For the sake of this demo, I’ve made it so the code texts me so I can show this off in-person when I demo this on stage (plus, you’ll annoy less folks with test texts while debugging… again, you can learn more about that 😬🤦‍♀️). But obviously, you’d replace these numbers with the numbers of your friends you wish to alert.

Sample call trigger index.js

The code for our phone call trigger is pretty similar except we’re making a call, not a text. You’ll also notice that I’m linking to something here.​.. let’s take a look at what that link is hosting.

Sample TwiML

As I mentioned earlier, one of the reasons I decided to use Twilio was to be able to have a real call come in on my phone. Twilio also gives us the capability to use TwiML to compose voice messages, as well as do things such as, oh, I don’t know… play an MP3 of Rick Astley perhaps? Obviously, you can record your own voice message MP3 (I’ve included several samples of my own voice as your cousin/partner/friend ). You can take a look at Microsoft’s documentation on how to use Twilio for voice and SMS capabilities from Azure if you’d like to dive deeper into TwiML, or have more questions about configuring your Application to use Twilio libraries.

Now we can incorporate our . Here’s what the Flic app looks like (left). For the sake of time, I won’t walk through every step, but essentially you just add the URL of the Azure Function and click save. Flic’s app is very straightforward, and will require a simple copy/paste of the https link we created with our 2 Azure Functions.

My “very real” fake boyfriend

Last, but certainly not least, I needed to add my fake boyfriend to my contacts (complete with an image) so it would look more legitimate when a call came through. Otherwise this would show up in my phone as an unknown #. So…. shall we go ahead and test it out?​​

As I mentioned before, I wanted to configure one of my Functions to text other people (for it’s actual use case), but I can’t really demonstrate/test that well on my own. So with this demo, my fake boyfriend is going to be texting me.

​​

“My, what a robotic voice you have!” -a modern day Little Red Riding Hood/Me

So, that’s the app! As you can see, it’s pretty easy to get up and running with ! If you’d like more instructions on how to deploy to Azure, check out the . There are so many easy ways to deploy to Azure, and you can read about them in .

Using simple just like this can open the door for a plethora of automation in your applications or even your personal life. Anything from a button for your children to press when they get home from school (to alert the bus dropped them off safely), even starting a tea kettle in the morning so your tea is ready to go while you’re groggily getting ready for work, or creating a function to check a database in your app on a timed schedule. This particular Twilio demo was created just for fun, but think about how using Azure Functions in your applications or everyday tasks could automate things for you!

So, what’s next for this project?​ Well, I’d love to add a couple more features​- please check out if you’re interested in contributing your own features and ideas! Here are a couple that folks have suggested on Twitter:

  • Create a fake PagerDuty Alert (for those who don’t feel comfortable with the fake significant other option)
  • Add several more versions/MP3s of voice (in place of the TwiML + music)
  • Build my own very realistic fake boyfriend or gal pal robot and have the button trigger them walking over to save me (jk… 🙃)
If only.

If you’ve read this far- congrats! You’ve successfully learned how to get yourself out of awkward social situations using technology. If you’d like to dive deeper into any of these topics, here are some great places to get started:

— a great starting point for beginners which includes 5 minute Quickstarts​ to create functions that execute based on events created via:

Have any questions? Comment below, or shoot me a message !

Happy Ambiverting! (GIF courtesy of Sentry.io)

Microsoft Azure

Any language. Any platform. Our team is focused on making the world more amazing for developers and IT operations communities with the best that Microsoft Azure can provide. If you want to contribute in this journey with us, contact us at medium@microsoft.com

Chloe Condon

Written by

Musical theatre actress turned developer evangelist.

Microsoft Azure

Any language. Any platform. Our team is focused on making the world more amazing for developers and IT operations communities with the best that Microsoft Azure can provide. If you want to contribute in this journey with us, contact us at medium@microsoft.com