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.