Santa Claus SMSs Logic App

Santa Claus SMSs Logic App

Christmas is just around the corner, which means that here at home, it’s a crazy and funny period for the kids (actually for the whole family since we love Christmas!). They started asking for us to put up the Christmas decorations really early, and they already wrote a letter to Santa with their requests.

I don’t know about you, but here, Santa exists! I love playing with this idea, and although my oldest daughter is no longer a believer, the younger ones are… even though they say that Santa Claus last year was their father :). I tell them that there are many children around the world and Santa Claus cannot be everywhere at the same time, and in order for no child to be without present, they ask for the help of all fathers. We are Santa’s helpers, like the elves!

Because they are always asking if Santa had already received the letters, if he understood the requests, if he needed some help… and I always told them that Santa would send magic SMSs to all fathers (modern technology) if he had any problem or when he was able to read the letter. That worked for a while (2 years :))… but now they are asking to see the SMSs. No matter how much I say they are magical SMS that only Dad can see, they beg to see… To solve this problem, I activated my geek side and thought, why not create a Logic App that sends me SMSs with personalized messages from Santa Claus!

Azure has a service called Azure Communication Services that allows you to send SMS (along with other functionalities). Still, unfortunately, this service was not eligible for my MVP subscription, nor was it available for free accounts with credits. It has to be on an enterprise or pay-per-use subscription. This way, I was not able to test these services. However, there is another third-party connector that you can connect inside Logic Apps and use to send SMSs: the Twilio Connector.

Before you start creating the Logic App, you need to :

  • Access to Twilio website: https://www.twilio.com/en-us and create an account.
  • You have the option to Start for free (you will have $15 to test this service)
  • After you register, you will have access to your Twilio Console, where you can get a number.
    • This is a US number, but that is perfect for me. If my kids see a foreign number, it will be more credible. Santa Claus lives on the North Pole.
  • You also have access to your Account info. You will need this information to configure the connector inside the Logic App.

Now that we have configured our Twilio account let us create our Santa Claus Logic App. To do that, you need to:

  • Access the Azure Portal and create a Logic App.
    • For simplicity, we will use a Logic App Consumption and name it LA-Santa-Claus-POC
  • For the trigger, we will use a Request When a HTTP request is received. The Logic App will receive the following payload:
{
    "msg": "This is the SMS"
}
  • In order to be easier to map these values in the Twilio connector, on the Request When a HTTP request is received trigger:
    • Click on Use sample payload to generate schema
    • Copy the JSON above and click Done.
  • Click on the + New step, and from the search text box, type Twilio and select the Twilio connector followed by the Send Text Message (SMS) action.
  • The first thing you need to do is to configure the Twilio connector by setting the:
    • Connection name
    • Twilio Account Id and Access Token > These two you can be then on your Twilio Console.
  • Once you configure the connector, then we need to:
    • From the combo box From Phone Number property, select the Twilio number.
    • On the To Phone Number, add your phone number.
    • And on the Text property, map the message from the request: triggerBody()?[‘msg’]
  • And Save your Logic App.

Simple as that!

Now, if you test your Logic App you will notice that you will have a new SMS from Santa Claus!

I don’t know about you, but I will have fun with my kids tonight!

Hope you find this helpful! So, if you liked the content or found it helpful and want to help me write more content, you can buy (or help buy) my son a Star Wars Lego! 

Author: Sandro Pereira

Sandro Pereira lives in Portugal and works as a consultant at DevScope. In the past years, he has been working on implementing Integration scenarios both on-premises and cloud for various clients, each with different scenarios from a technical point of view, size, and criticality, using Microsoft Azure, Microsoft BizTalk Server and different technologies like AS2, EDI, RosettaNet, SAP, TIBCO etc.

He is a regular blogger, international speaker, and technical reviewer of several BizTalk books all focused on Integration. He is also the author of the book “BizTalk Mapping Patterns & Best Practices”. He has been awarded MVP since 2011 for his contributions to the integration community.
View all posts by Sandro Pereira