Navigate / search

Sending SMSes from Azure Functions v2 – Twilio

Please find the brief manual to sending SMSed by Twilio service in Azure Functions v2. The purpose of it is similar to text related to SendGrid case.

In case of Twilio, you need to install Microsoft.Azure.WebJobs.Extensions.Twilio NuGet package. After doing it, you should use the following code:

using Twilio.Rest.Api.V2010.Account;
using Twilio.Types;

public static class SendNotificationSMS
{
  [FunctionName("SendNotificationSMS")]
  public static void Run(
    [TwilioSms(
      From = "Assigned by Twilio number",
      Body = "...")]
    out CreateMessageOptions messageOptions)
  {
    messageOptions = new CreateMessageOptions(
      new PhoneNumber("Phone number to which you would like to send message"));
  }
}

Together with that, you should also add to applications settings two entries with the following name:

  • AzureWebJobsTwilioAccountSid
  • AzureWebJobsTwilioAuthToken

and assign values provided by Twilio.

At the end I would encourage you to see the previous article – Sending SMSes from Azure Functions – Twilio. You will find there a bigger description related to this integrations.

Sending emails from Azure Functions v2 – SendGrid

Some time ago I described how you could integrate SendGrid service with Azure Functions (article: Sending emails from Azure Functions v2 – SendGrid link). Mentioned article is still valid in the scope of SendGrid service configuration. I need to add a part related to integration with Azure Functions v2. This version is generally available from the last few months and it introduced some architectural changes.

In the previous version of functions (v1), the code that has been responsible for integration with different services providers was part of the runtime. Each time when Microsoft wanted to change something related to integration he needed to change the whole functions platform. In the second version of functions code responsible for integration have been moved outside platform. This change allowed us to introduce new services that we will be able to integrate with Azure Functions. Moreover, it changed a bit way how we will use this part in the code. Read more

How to enable/disable Azure Function programmatically

Today I would like to write about something different. I am curious… Have you ever thought about enabling/disabling Azure Function by code? In such scenario, we would be able to decide about the state of the function directly from our application. I believe that you can find a lot of useful scenarios for such behaviour. I will provide two of them.

The first one. We have some resource that is not so fast and we would like to reduce the frequency of using it during the day. In such scenario, we can use Azure Storage Queue as a buffer for actions to compute. And turn on Azure Function only for a night and then in the morning turn it off again.

Another one is strictly connected with a question that I hear quite often during meetups or hackathons. Are we able to turn off function when we use all free capacity that is provided by Azure? People that are offering some small solution for public access would like to avoid the situation when they will need to pay for it. Read more

I would like to invite you to September workshops

We still have few months to September but I would like to invite you to my workshops that will take place in that month.

First of them – CosmosDB – Database for Serverless Era – is part of ProgNET London 2018. I will be conducting 3,5 hours workshop during the second day of the conference (13th September 2018). You will learn how to use CosmosDb in your Serverless solutions. I will start with a short introduction of this service, and will present most essential features of CosmosBD. Then you will be able to learn how you can store and query data with this product. You will then try to build your first Serverless solution that will use CosmosDB as a database. Finally, you will play with query optimisation.

The second one – Serverless in Microsoft Azure – will be conducted in Cracow during conference DevConf 2018. Whole day workshop is planned for the first day of conference – 26th September 2018. During the workshop you will learn how to use Azure Functions, Logic Apps, Flow and Event Grid to build easy scalable and cost-effective back-end for your applications.

And what is the most important with this approach building scalable and secure applications has become easier. You can finally focus on solution creation and express creativity in providing new features.

Still, there is some time to September… I would like to encourage you to buy tickets for conferences right now and save a bit money.

Sending emails from Azure Functions – SendGrid

I am trying to convince people that right now we should try to think about how we can build our application effectively. Instead of building everything from scratch we should look for possibilities of composition application from different elements. This means that you should write smaller amount of code and there is also smaller chance for making an error.

In case of Azure Functions natural choice for email service provider is SendGrid. Read more

Azure Function – Uploading photos to Azure Blob Storage

Today I would like to describe another production use case for Azure Functions. This time example is quite simple. I would like to use Azure Functions to upload photos to Azure Blob Storage. Of course, you can upload photos directly to Azure Blob Storage. However, with such solution, your components are tightly connected. This can block you in the future. To avoid that you should add some middle layer.

For this, you can use Azure Function. It will act like an API that will accept photos encoder in base64 and upload it to provided location. With this approach, you will be able to change storage component in the future very easy if needed. Read more

RoyalMail API cost reduction by Azure Functions

I would like to describe you one of the last cases of Azure Functions usage. In one of my projects I was using RoyalMail API to find address that is connected with provided post code. System has been delivered to users from England. In that country when you provide post code you are able to find out quite precise address and you can speed up form filling. Read more