As I have mentioned in earlier blogs that we get many connectors which we can use in integration. There are some other thirds party services we can use in Azure Logic APP. In this blog we are going to integrate a very popular SMS service, which is Twilio. Twilio provides SMS, WhatsApp, voice calls etc. services. You can more details of Twilio services and its integration in its website https://www.twilio.com/
We are going to create a Logic APP which will call Twilio connector and send an SMS to the user (at the moment in my mobile obviously)
TWILIO Account:
We can
create Twilio account for free trial, where it gives you around $15 credit to
use different services, there are some restriction like, it comes with Twilio
logo and you can not choose your desired number. But for testing purpose, it
provides more than enough what we need. So, lets create an account and enable
our SMS service from the Twilio Developer Console.
· Sign up Trial account
· Verify your account with registered
email ID
· After processing the basic sign up
process we should be able to logic in Twilio Console
· You can see you get some free $$
credit to play with its services
· In next step you have to choose a
trial phone number, in free service you can only choose USA or Canada number. So,
click on “Get a trial phone Number”
· You will be redirected to below screen, where you can choose the provided number or try to find different number if you don’t like the current one. I am choosing the provided one.
· After clicking the “Choose this
Number”, you will get the greeting message
· Now we have to enable the SMS
service on this number, so click on the “Get Set Up” link on your left-hand
side in “Messaging” menu bar
· Once you enable the SMS service, you
should be getting Greeting message, which means, we are good to go.
Azure Logic APP:
We have set
up our Twilio account and now start creating a Logic APP and from this app we
will call Twilio connector in order to send SMS.
· Create a Logic APP and give a
desired name, I am giving “send-sms-twilio” name.
· Provide the HTTP request payload
schema. I am generating it with the JSON example
{
"Name":"name",
"Message":"test",
"PhoneNumber":"0123456789"
}
· Provide HTTP method as “POST”
· Click on “New Step” and search
“Twilio” connector in search bar
· Click on Twilio
· Choose “Send Text Message (SMS)” as
an action, you should be able to see below screen where we have to provide
Account ID, Access Token and connection name.
· Account ID and Access token, you
should get it from Twilio Developer console. Use these details here.
· Click on “Create” button. If all the
details are fine, then your connection should be created successfully.
· You can also see the Twilio Number
from the dropdown, the one we registered while creating Twilio account.
· Choose the phone number from the
drop down in “From Phone Number” section
· Provide dynamic values from the
window in “To Phone Number” and “Text” textbox.
· Provide the content with dynamic
variable same be below screenshot
· As soon as you save the Logic APP,
you should be getting the HTTP URL from the HTTP connector
· Try this URL with you favorite API
testing tool, I am using POSTMAN here. Provide proper values in your request
name make sure you also provide a valid phone number for example
+<Countrycode>+<Phone_Number>
(+64222XXXXX), so that you can receive the text and verify.
{
"Name":"Shri ",
"Message":" This is the test message triggered by Azure Logic APP using Twilio Service ",
"PhoneNumber":"+64123456789"
}
· Click on send and you should get the
Success dynamic message ending with your name and also you should be receiving
the Text message “This is the test message triggered by Azure Logic APP using
Twilio Service” on your mobile
· To check the log, please go to Run
History to see the parameter and flow.
No comments:
Post a Comment