How to create and Advanced service (XaaS) to send SMS with vRealize Automation
In this article, we are going to show how easy it is to create advanced services in vRealize Automation (vRA). We will take as an example the ability to send text messages. This will showcase how easy it is to create advanced service (XaaS) into vRA which are not related to VM, vSphere, Networks, etc…
This is (one of) the end result:
So what do we need?
- First, a service provider with an API
- Second, vRealize Orchestrator (vRO) will consume this API by creating a workflow
- Third, vRA will turn this workflow into a service
To get through the technical stuff, it is expected you have basic understanding of what a REST API is and have a good knowledge of vRealize automation and vRO
Let’s go for the step by step:
The Service provider I chose is clickatell since they gave me immediately the API I needed. It costs me 20€ for 400 credits which translate into several hundred SMS (much more than I need here).
You’ll need to create an account and get to this page where you’ll find all the information you need.
- The URL for your request
- The JSON (or XML) structure
- Your Auth token
(optional) To get up to speed with this API, you can play with Postman
Open your vRO and add a REST host. Select Host Authentication type = OAuth2 and enter your token key
Now, add a REST Operation
Great, you now have linked vRO with your service provider
Now, we are going to create a workflow to avoid doing these steps each time. Right click on the sendSMS operation/Run Workflow/Genereate a new workflow from the REST operation
Automagically, vRO has created the workflow for you (this is really great stuff).
All you need is to add your Auth token your service provider gave you earlier.
You can now start your workflow and start sending SMS
Great, it's working. Now, let's clean things a little bit.
Customize the code to make the input more user friendly, create 2 inputs.
And use it in your code:
That’s it you now have a user friendly workflow to send text messages from vRO
Pretty cool right?
Now, how do we turn this workflow into a service?
Use the vRealize Automation magic:
In vRA, go to Design/XaaS Blueprints/New, pick your workflow, set the form as you want it, publish the service and entitle it.
Pretty neat right?
And that’s not all, you can actually turn this workflow into a service in different ways.
For example, in the vRA designer as “XaaS service”
Or leave the users enter their phone number at the request step.
I hope you found this interesting.
Let me know and feel free to share this post.