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
  public static void Run(
      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