An Ambivert’s Guide to Azure Functions
Tags: azure, javascript, twilio, tutorial
Published: 2019-04-03 11:10:00

---
title: "An Ambivert’s Guide to Azure Functions"
published: true
description: "Using the Power of Technology to Make Social Situations Less Awkward"
tags: azure, javascript, twilio, tutorial
cover_image: https://cdn-images-1.medium.com/max/2000/1*CWI-FQlOf53SWrNcTE__KQ.jpeg
canonical_url: https://medium.com/microsoftazure/an-ambiverts-guide-to-azure-functions-95931976c565
---

*The following blog post will walk you through how to use [Azure Functions](https://azure.microsoft.com/en-us/services/functions/?WT.mc_id=devto-blog-chcondon), [Twilio](https://www.twilio.com/), and a [Flic Button](http://flic.io/shop/flic-1pack?aff=10) 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 [starting here with our documentation](https://docs.microsoft.com/en-us/azure/azure-functions/?WT.mc_id=devto-blog-chcondon), or taking 4 minutes to read in more detail [how to create your first Azure Function](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function?WT.mc_id=devto-blog-chcondon), 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 👋

![ron swanson gif](https://cdn-images-1.medium.com/max/1600/1*CwJYE_zieb4o-Y6kYEJf5w.gif)

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 [ambivert](https://www.coursereport.com/blog/the-ambivert-s-guide-to-staying-in-tech)). 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.”​



This tweet is a great example of that

{% twitter 950994341840891906 %}

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.​

![double yikes](https://cdn-images-1.medium.com/max/2000/1*X1i_csiCioPye1yjqbVnwQ.png)![yikes](https://cdn-images-1.medium.com/max/1200/1*svDu-WwlACpfmy-sj32m4A.png)
###### What I’m feeling internally vs. showing externally

Remember… I have a theatre degree. 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!​

![simpsons gif](https://media.giphy.com/media/3o6UBiAQ9Ws8UWdmqA/giphy.gif)

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](https://twitter.com/SaraJChipps) and [Jennifer Wadella](https://twitter.com/likeOMGitsFEDAY) to see if [Jewelbots](https://jewelbots.com/)’ 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- [get them one of these](https://jewelbots.com/). 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… a [Flic Button](http://flic.io/shop/flic-1pack?aff=10)! What’s a [Flic Button](http://flic.io/shop/flic-1pack?aff=10)? 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.

![flic butttons](https://cdn-images-1.medium.com/max/1600/1*MIKFZ3smKZyRws4t97j--w.png)

[Flic](http://flic.io/shop/flic-1pack?aff=10) 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](https://twitter.com/noopkat) sent me a [Flic Button](http://flic.io/shop/flic-1pack?aff=10) 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 the [Flic Button](http://flic.io/shop/flic-1pack?aff=10) 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, [Azure Functions](https://azure.microsoft.com/en-us/services/functions/?WT.mc_id=devto-blog-chcondon) is a [serverless](https://azure.microsoft.com/en-us/solutions/serverless/?WT.mc_id=devto-blog-chcondon) 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 [serverless](https://azure.microsoft.com/en-us/solutions/serverless/?WT.mc_id=devto-blog-chcondon) 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​:

☝🏻[HTTP](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-http-webhook/?WT.mc_id=devto-blog-chcondon) (which is what I’ll be talking about today)​

✌🏻 [Timers](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer/?WT.mc_id=devto-blog-chcondon) (example: every day at 11am, execute this function, that starts + checks the temperature of my sous vide)

👌🏻 You can [create a function triggered when data is added to or changed in Azure Cosmos DB​](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-cosmos-db-triggered-function/?WT.mc_id=devto-blog-chcondon)

🖖🏻 You can [create a function triggered when files are uploaded to or updated in Azure Blob storage](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-storage-blob-triggered-function/?WT.mc_id=devto-blog-chcondon)

🖐🏻 You can [create a function that is triggered when messages are submitted to an Azure Storage queue](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-storage-queue-triggered-function/?WT.mc_id=devto-blog-chcondon)

And many more! For a complete list, tutorials, documentation, and additional details of the capabilities of Azure Functions, start with the [Azure Functions Documentation](https://docs.microsoft.com/en-us/azure/azure-functions/?WT.mc_id=devto-blog-chcondon).

![twilio logo and docs mascot](https://cdn-images-1.medium.com/max/1600/1*AwSZ0mMF1F2WJ6J9wTRCag.png)

If you haven’t played much with serverless/Azure Functions, I recommend starting with reading this [Azure Functions Overview](https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview?WT.mc_id=devto-blog-chcondon) and completing this [Create Serverless Logic with Azure Functions](https://docs.microsoft.com/en-us/learn/modules/create-serverless-logic-with-azure-functions/?WT.mc_id=devto-blog-chcondon) module to get a better idea of how all of these pieces fit together before diving into programming your [Flic Button](http://flic.io/shop/flic-1pack?aff=10). 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 Twilio to create this. [Twilio](https://www.twilio.com/) 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 [Rick Astley](https://www.youtube.com/watch?v=dQw4w9WgXcQ) Easter Egg that I will show you in a bit since I kept it in my demo 🙃

Alright- let’s review our goals!

## 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](https://www.youtube.com/watch?v=A2egRZia504).​*

![diagram of app](https://cdn-images-1.medium.com/max/1600/1*epHpHigBLPGaCK5tuxzn4w.png)

## Let’s get to the code!​

​For the sake of easy to understand visuals/screenshots I used the [Azure portal](https://azure.microsoft.com/en-us/free/?wt.mc_id=devto-blog-chcondon) to create this. You can also use [VS Code](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-function-vs-code?WT.mc_id=devto-blog-chcondon), the [Azure CLI](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function-azure-cli?WT.mc_id=devto-blog-chcondon), 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.


## Create Resource
![screenshot 1](https://cdn-images-1.medium.com/max/1200/1*0yImy-SW4IsrRgJN_UjP7Q.png)


![screenshot 2](https://cdn-images-1.medium.com/max/1200/1*VqJso6NwUPMUnLDj-Mx-WA.png)

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, a [resource group](https://docs.microsoft.com/en-us/azure/azure-resource-manager/resource-group-overview?WT.mc_id=devto-blog-chcondon) (I’m creating a new one in this case), the Operating System you’d like to use, the [hosting plan](https://docs.microsoft.com/en-us/azure/azure-functions/functions-scale?WT.mc_id=devto-blog-chcondon) (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 [storage](https://docs.microsoft.com/en-us/azure/storage/common/storage-introduction?WT.mc_id=devto-blog-chcondon) 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.

![screenshot 3](https://cdn-images-1.medium.com/max/1600/1*R7td7o0irI7STDwRsCnDDg.png)
###### For this example, I’m selecting In-portal.

![screenshot 4](https://cdn-images-1.medium.com/max/1600/1*Oqn6uiCHsF2UStDnhj_T2w.png)
###### 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.​

![screenshot 5](https://cdn-images-1.medium.com/max/1600/1*FR4GT_Q9aWPRg4uYsqsrwg.png
)

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

## Let’s Create a Fake Boyfriend

My boyfriend [Ty Smith](https://twitter.com/tsmith) 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 this [Twitter thread] (https://twitter.com/ChloeCondon/status/1105613535487225857)).

![help frog](https://media.giphy.com/media/gw3MYmhxEv8T52ow/giphy.gif)
###### 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 🌵🤠).​

![twiloi screenshot](https://cdn-images-1.medium.com/max/1600/1*0tE4564AdFNFx1EB1gWvQw.png)

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](https://twitter.com/fboucheros)’s video on [How to use Environment Variables in Azure Functions](https://www.youtube.com/watch?v=Stg----kHPg) for a great 5 minute tutorial!

👉 [Sample message trigger index.js](https://gist.github.com/ChloeCodesThings/4c41eb0fc8399d226edd67629e1ce853)


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 in this [Twitter thread] (https://twitter.com/ChloeCondon/status/1105613535487225857) 😬🤦‍♀️). But obviously, you’d replace these numbers with the numbers of your friends you wish to alert.

👉 [Sample call trigger index.js Gist](https://gist.github.com/ChloeCodesThings/b11b1c41397ff0bc9a7f27d800db968a)

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 call trigger index.js Gist](https://gist.github.com/ChloeCodesThings/881b74777753b1ce7f6019bf5e93ae59)

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 [in the repo](https://github.com/ChloeCodesThings/sos-plz-save-me)). 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.

![flic screenshot](https://cdn-images-1.medium.com/max/1200/1*ApfnDkPoOeh503gNjomqgw.png)

Now we can incorporate our [Flic Button](http://flic.io/shop/flic-1pack?aff=10). Here’s what the Flic app looks like (above). 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.

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?​​

![contact screenshott](https://cdn-images-1.medium.com/max/1200/1*_S8WDW0vo_kxOG93hfNJ4w.png)
###### My “very real” fake boyfriend

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.

{% youtube lCpO16JjoM8 %}

So, that’s the app! As you can see, it’s pretty easy to get up and running with [Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview?WT.mc_id=devto-blog-chcondon)! If you’d like more instructions on how to deploy to Azure, check out the [GitHub repo here](https://github.com/ChloeCodesThings/sos-plz-save-me). There are so many easy ways to deploy to Azure, and you can read about them in [more detail in our docs](https://docs.microsoft.com/en-us/azure/azure-functions/functions-run-local#publish/?WT.mc_id=devto-blog-chcondon).

Using simple [Azure Functions](https://docs.microsoft.com/en-us/azure/azure-functions/functions-overview?WT.mc_id=devto-blog-chcondon) 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 [the repo on Github](https://github.com/ChloeCodesThings/sos-plz-save-me) 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… 🙃)

![family matters gif](https://cdn-images-1.medium.com/max/1600/1*eufIfBleC8sMp9iMREPIIg.gif)

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:

[Azure Functions Documentation](https://docs.microsoft.com/en-us/azure/azure-functions/?WT.mc_id=devto-blog-chcondon) — a great starting point for beginners which includes 5 minute Quickstarts​ to create functions that execute based on events created via:

💻 [HTTP](https://docs.microsoft.com/en-us/azure/azure-functions/functions-create-first-azure-function?WT.mc_id=devto-blog-chcondon) (what I used for this blog)

⏲ [Timers](https://docs.microsoft.com/en-us/azure/azure-functions/functions-bindings-timer?WT.mc_id=devto-blog-chcondon)​  (if you wanted a timed/fixed notification/call/alert/etc.)

☁️ [Create Serverless Logic with Azure Functions​ module](https://docs.microsoft.com/en-us/learn/modules/create-serverless-logic-with-azure-functions/?WT.mc_id=devto-blog-chcondon) (takes about 36 mins to complete, and will walk you through each step in a sandbox mode!)

👉 [Execute an Azure Function with Triggers](https://docs.microsoft.com/en-us/learn/modules/execute-azure-function-with-triggers/?WT.mc_id=devto-blog-chcondon) (1 hour 20 mins to complete w/ sandbox as well)

⛓ [Chain Azure Functions Together Using Input and Output Bindings](https://docs.microsoft.com/en-us/learn/modules/chain-azure-functions-data-using-bindings/?WT.mc_id=devto-blog-chcondon) (1 hour 10 mins to complete w/ sandbox as well)

Have any questions? Comment below, or shoot me a message on [Twitter](https://twitter.com/ChloeCondon)!

![chloe thumbs up](https://cdn-images-1.medium.com/max/1600/1*DYCilnEAyCUmAxmbzN81cg.gif)
###### Happy Ambiverting! (GIF courtesy of Sentry.io)